🇰🇷 한글 설명
Linux 커널의 Netlink 인터페이스에서 소켓이 닫힐 때 진행 중인 데이터 덤프 프로세스를 적절히 종료하지 못하는 취약점입니다. 기존의 워크큐(workqueue)를 이용한 비동기 정리 방식이 참조 카운트 관리 오류를 일으켜 메모리 관리 문제를 유발할 수 있습니다.
💡 쉬운 설명
컴퓨터가 데이터를 한꺼번에 보내주는 도중에 연결을 끊으면, 뒷정리가 제대로 되지 않아 시스템에 혼란을 줄 수 있는 문제입니다. 이로 인해 시스템의 안정성이 떨어지거나 예상치 못한 오류가 발생할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
netlink: terminate outstanding dump on socket close
Netlink supports iterative dumping of data. It provides the families
the following ops:
- start - (optional) kicks off the dumping process
- dump - actual dump helper, keeps getting called until it returns 0
- done - (optional) pairs with .start, can be used for cleanup
The whole process is asynchronous and the repeated calls to .dump
don't actually happen in a tight loop, but rather are triggered
in response to recvmsg() on the socket.
This gives the user full control over the dump, but also means that
the user can close the socket without getting to the end of the dump.
To make sure .start is always paired with .done we check if there
is an ongoing dump before freeing the socket, and if so call .done.
The complication is that sockets can get freed from BH and .done
is allowed to sleep. So we use a workqueue to defer the call, when
needed.
Unfortunately this does not work correctly. What we defer is not
the cleanup but rather releasing a reference on the socket.
We have no guarantee that we own the last reference, if someone
else holds the socket they may release it in BH and we're back
to square one.
The whole dance, however, appears to be unnecessary. Only the user
can interact with dumps, so we can clean up when socket is closed.
And close always happens in process context. Some async code may
still access the socket after close, queue notification skbs to it etc.
but no dumps can start, end or otherwise make progress.
Delete the workqueue and flush the dump state directly from the release
handler. Note that further cleanup is possible in -next, for instance
we now always call .done before releasing the main module reference,
so dump doesn't have to take a reference of its own.
📍 영향받는 시스템
Netlink를 사용하는 Linux 커널 버전 (패치 전 버전)
⚔️ 공격 벡터
Netlink 소켓을 생성하여 데이터 덤프를 요청한 후, 프로세스가 완료되기 전에 소켓을 강제로 닫아 참조 카운트 불일치를 유도함
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 Netlink 소켓 해제 핸들러를 수정함
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 해결된 최신 패치 버전인지 확인합니다.