🇰🇷 한글 설명
Linux 커널의 namespace 서브시스템에서 may_copy_tree() 함수가 이미 lazy unmount된 마운트 트리를 복사할 수 있는 문제가 해결되었습니다. nsfs나 pidfs 파일의 마운트 예외 처리가 unmount된 상태의 마운트도 허용하여, 재귀적 bind mount 시 분리된 하위 마운트 스택까지 함께 복사되는 결함이었습니다. 이제 unmount된 트리를 재귀적으로 복사하려고 하면 EINVAL 오류가 반환됩니다.
💡 쉬운 설명
이미 분리(unmount)된 파일시스템 구조를 다시 연결할 때, 원래 떨어져 있어야 할 하위 구조까지 잘못 복사되는 문제였습니다. 이제 분리된 구조는 재귀 복사가 차단되어 이 문제가 방지됩니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
namespace: don't copy an unmounted mount tree
may_copy_tree() accepts a mount whose root is an nsfs or pidfs file
before it checks whether that mount is mounted. This exception exists
for nsfs and pidfs mounts. They are part of no mount namespace so
neither check_mnt() nor is_mounted() would let them through and
bind-mounting a nsfsfd or a pidfd wouldn't work.
Problem is that exception also admits a bind mount of such a file when
it was lazily unmounted and is only kept alive by a file descriptor:
mount --bind /proc/self/ns/net /tmp/x
exec 3< /tmp/x
umount -l /tmp/x
mount --rbind /proc/self/fd/3 /tmp/y
With MS_REC or AT_RECURSIVE copy_tree() doesn't stop at the unmounted
mount. It copies every mount that stayed attached to it as well. So if
you have a bunch of overmounts over the nsfsfd or the pidfd the whole
unmounted stack is copied. That's a bug.
So refuse to walk an unmounted tree. Copying its root alone stays
possible. So a bind mount of a namespace that is gone can still be
recreated from a file descriptor on the old one. The file descriptor
pins that mount and its root and __has_locked_children() only reads the
direct children which don't leave the parent's list without
namespace_sem. The internal mounts carry MNT_NS_INTERNAL instead of NULL
and are still walked. Copying an unmounted tree recursively fails with
EINVAL.
📍 영향받는 시스템
패치 이전의 Linux 커널 (namespace/mount 서브시스템을 사용하는 모든 버전, 정확한 영향 범위는 커널 릴리스 노트 확인 필요)
⚔️ 공격 벡터
로컬 사용자가 lazy unmount된 nsfs/pidfs 마운트를 파일 디스크립터로 유지한 뒤, --rbind 또는 AT_RECURSIVE 옵션으로 재귀 bind mount를 수행하여 분리된 마운트 스택을 복제
🛡️ 대응 방법
Linux 커널을 해당 CVE 수정이 포함된 최신 안정 버전 또는 배포판 보안 업데이트로 업그레이드
🔧 검증 코드
출력된 커널 버전을 배포판 보안 공지 또는 kernel.org의 수정 커밋 포함 버전과 비교하여, 해당 수정이 적용된 버전인지 확인합니다.