🇰🇷 한글 설명
Linux 커널의 SMB 클라이언트에서 비동기 암호화 가속기를 사용할 때 crypt_message 함수 내에서 Use-After-Free 취약점이 발생합니다. 암호화 작업이 완료되기 전에 요청 버퍼를 해제하여 커널 크래시나 NULL 포인터 역참조를 유발할 수 있습니다.
💡 쉬운 설명
컴퓨터가 암호화 작업을 처리하는 도중에 해당 작업에 필요한 메모리를 미리 지워버려서 발생하는 오류입니다. 이로 인해 시스템이 갑자기 멈추거나 꺼지는 현상이 발생할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
smb: client: fix use-after-free in crypt_message when using async crypto
The CVE-2024-50047 fix removed asynchronous crypto handling from
crypt_message(), assuming all crypto operations are synchronous.
However, when hardware crypto accelerators are used, this can cause
use-after-free crashes:
crypt_message()
// Allocate the creq buffer containing the req
creq = smb2_get_aead_req(..., &req);
// Async encryption returns -EINPROGRESS immediately
rc = enc ? crypto_aead_encrypt(req) : crypto_aead_decrypt(req);
// Free creq while async operation is still in progress
kvfree_sensitive(creq, ...);
Hardware crypto modules often implement async AEAD operations for
performance. When crypto_aead_encrypt/decrypt() returns -EINPROGRESS,
the operation completes asynchronously. Without crypto_wait_req(),
the function immediately frees the request buffer, leading to crashes
when the driver later accesses the freed memory.
This results in a use-after-free condition when the hardware crypto
driver later accesses the freed request structure, leading to kernel
crashes with NULL pointer dereferences.
The issue occurs because crypto_alloc_aead() with mask=0 doesn't
guarantee synchronous operation. Even without CRYPTO_ALG_ASYNC in
the mask, async implementations can be selected.
Fix by restoring the async crypto handling:
- DECLARE_CRYPTO_WAIT(wait) for completion tracking
- aead_request_set_callback() for async completion notification
- crypto_wait_req() to wait for operation completion
This ensures the request buffer isn't freed until the crypto operation
completes, whether synchronous or asynchronous, while preserving the
CVE-2024-50047 fix.
📍 영향받는 시스템
비동기 암호화 가속기를 사용하는 하드웨어가 탑재된 Linux 커널 시스템
⚔️ 공격 벡터
특정 암호화 조건이 포함된 SMB 네트워크 통신을 유도하여 커널 메모리 오류 유발
🛡️ 대응 방법
비동기 암호화 완료를 대기하는 로직(crypto_wait_req)이 포함된 최신 Linux 커널로 업데이트
🔧 검증 코드
출력된 커널 버전이 취약점이 패치된 최신 보안 업데이트 버전인지 확인합니다.