🔍 CVE-2024-50121

7.8
CVSS Score
HIGH
2024-11-05
2026-10-15 01:19
✅ 완료

🇰🇷 한글 설명

Linux 커널의 NFSd 모듈에서 nfsd_shrinker_work와 nfs4_state_shutdown_net 함수 간의 경합 조건으로 인해 발생하는 취약점입니다. /proc/fs/nfsd/threads를 통해 스레드를 종료할 때 동시에 실행 중인 shrinker가 이미 해제된 메모리에 접근하여 use-after-free 오류와 메모리 누수가 발생할 수 있습니다.

💡 쉬운 설명

NFSd 파일 공유 서비스를 종료할 때 동시에 메모리 정리 작업이 실행되면서 이미 정리된 메모리를 다시 접근하는 문제입니다. 이로 인해 시스템이 불안정해지거나 오류가 발생할 수 있습니다.

🇺🇸 원문 (English)

In the Linux kernel, the following vulnerability has been resolved: nfsd: cancel nfsd_shrinker_work using sync mode in nfs4_state_shutdown_net In the normal case, when we excute `echo 0 > /proc/fs/nfsd/threads`, the function `nfs4_state_destroy_net` in `nfs4_state_shutdown_net` will release all resources related to the hashed `nfs4_client`. If the `nfsd_client_shrinker` is running concurrently, the `expire_client` function will first unhash this client and then destroy it. This can lead to the following warning. Additionally, numerous use-after-free errors may occur as well. nfsd_client_shrinker echo 0 > /proc/fs/nfsd/threads expire_client nfsd_shutdown_net unhash_client ... nfs4_state_shutdown_net /* won't wait shrinker exit */ /* cancel_work(&nn->nfsd_shrinker_work) * nfsd_file for this /* won't destroy unhashed client1 */ * client1 still alive nfs4_state_destroy_net */ nfsd_file_cache_shutdown /* trigger warning */ kmem_cache_destroy(nfsd_file_slab) kmem_cache_destroy(nfsd_file_mark_slab) /* release nfsd_file and mark */ __destroy_client ==================================================================== BUG nfsd_file (Not tainted): Objects remaining in nfsd_file on __kmem_cache_shutdown() -------------------------------------------------------------------- CPU: 4 UID: 0 PID: 764 Comm: sh Not tainted 6.12.0-rc3+ #1 dump_stack_lvl+0x53/0x70 slab_err+0xb0/0xf0 __kmem_cache_shutdown+0x15c/0x310 kmem_cache_destroy+0x66/0x160 nfsd_file_cache_shutdown+0xac/0x210 [nfsd] nfsd_destroy_serv+0x251/0x2a0 [nfsd] nfsd_svc+0x125/0x1e0 [nfsd] write_threads+0x16a/0x2a0 [nfsd] nfsctl_transaction_write+0x74/0xa0 [nfsd] vfs_write+0x1a5/0x6d0 ksys_write+0xc1/0x160 do_syscall_64+0x5f/0x170 entry_SYSCALL_64_after_hwframe+0x76/0x7e ==================================================================== BUG nfsd_file_mark (Tainted: G B W ): Objects remaining nfsd_file_mark on __kmem_cache_shutdown() -------------------------------------------------------------------- dump_stack_lvl+0x53/0x70 slab_err+0xb0/0xf0 __kmem_cache_shutdown+0x15c/0x310 kmem_cache_destroy+0x66/0x160 nfsd_file_cache_shutdown+0xc8/0x210 [nfsd] nfsd_destroy_serv+0x251/0x2a0 [nfsd] nfsd_svc+0x125/0x1e0 [nfsd] write_threads+0x16a/0x2a0 [nfsd] nfsctl_transaction_write+0x74/0xa0 [nfsd] vfs_write+0x1a5/0x6d0 ksys_write+0xc1/0x160 do_syscall_64+0x5f/0x170 entry_SYSCALL_64_after_hwframe+0x76/0x7e To resolve this issue, cancel `nfsd_shrinker_work` using synchronous mode in nfs4_state_shutdown_net.

📍 영향받는 시스템

Linux kernel 6.12.0-rc3 이전 버전의 NFSd 모듈을 사용하는 시스템

⚔️ 공격 벡터

/proc/fs/nfsd/threads에 0을 기록하여 NFSd 스레드를 종료하는 동안 shrinker 작업을 동시에 실행

🛡️ 대응 방법

Linux 커널을 CVE-2024-50121 패치가 적용된 버전 이상으로 업그레이드

🔧 검증 코드

현재 커널 버전을 확인하여 6.12.0 이후 또는 5.15.156+ 패치 버전 이상인지 확인합니다. 패치된 버전이면 vulnerability가 해결되었습니다.

Shell / Script
uname -r | grep -E 'el[78]' && cat /proc/version | grep -oP '\d+\.\d+\.\d+'

📊 CVSS Vector String

CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

💻 영향받는 소프트웨어

Linux Kernel