🇰🇷 한글 설명
리눅스 커널의 pidfd_ioctl() 함수 내 PIDFD_GET_*_NAMESPACE ioctl 처리 과정에서 race condition 취약점이 발견되었습니다. 특정 작업의 namespace 정보를 조회할 때 exec_update_lock을 보유하지 않아, 권한 검사 시점과 실제 namespace 조회 시점 사이의 불일치를 이용해 setuid 바이너리 실행 후의 정보를 탈취할 수 있습니다.
💡 쉬운 설명
프로그램이 권한을 확인하는 순간과 실제 정보를 가져오는 순간 사이에 보안 검사를 우회할 수 있는 틈이 있습니다. 공격자는 이를 이용해 원래는 볼 수 없는 다른 프로그램의 내부 정보에 접근할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
pidfd: hold exec_update_lock around namespace ioctl
The PIDFD_GET_*_NAMESPACE ioctls in pidfd_ioctl() perform a filesystem
credentials ptrace access check before handing out a namespace file
descriptor. The accompanying comment states that the code "mirrors nsfs
behavior", but, unlike the corresponding procfs paths, it does so without
holding the target task's exec_update_lock.
proc_ns_get_link() and proc_ns_readlink() both take exec_update_lock for
reading around the ptrace check and the namespace lookup, so that the
credentials used for the access decision match those of the task when its
namespace is read. Without it, a caller can pass the check against the
target's old credentials and then read the namespace after the target has
execve()'d a setuid binary and committed new credentials -- accessing
namespace information it should have been denied.
Hold exec_update_lock for reading around the ptrace check and the
namespace lookup so that pidfd truly mirrors nsfs behavior, as the comment
already claims. open_namespace() itself runs outside the lock: once a
namespace reference is obtained it carries its own refcount and is opened
with the caller's own credentials, so a concurrent execve() on the target
can no longer affect the outcome.
📍 영향받는 시스템
Linux Kernel (pidfd 관련 ioctl을 사용하는 버전)
⚔️ 공격 벡터
대상 프로세스가 execve()를 통해 권한이 변경되는 시점에 맞춰 namespace 정보를 요청하는 Race Condition 공격
🛡️ 대응 방법
리눅스 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 pidfd_ioctl() 내에 exec_update_lock이 적용되도록 조치
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 패치된 최신 버전인지 확인