🇰🇷 한글 설명
Linux 커널의 NFC 서브시스템에서 nfc_get_local_general_bytes 함수 호출 시 Use-After-Free(UAF) 취약점이 발견되었습니다. 이전 수정 시도가 참조 횟수 관리 오류로 인해 메모리 해제 후 접근을 유발하거나 메모리 누수를 발생시켰으나, 이번 패치를 통해 출력 버퍼를 직접 전달하는 방식으로 구조를 개선하여 해결되었습니다.
💡 쉬운 설명
NFC 기능을 사용할 때 컴퓨터 메모리가 이미 삭제된 데이터를 다시 사용하려고 시도하여 시스템 오류나 보안 문제가 생길 수 있는 결함입니다. 데이터를 복사하는 방식을 안전하게 바꾸어 메모리 관리 오류를 방지하도록 수정되었습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
nfc: fix use-after-free in nfc_get_local_general_bytes
Commit 6709d4b7bc2e ("net: nfc: Fix use-after-free caused by
nfc_llcp_find_local") attempted to fix a use-after-free (UAF) issue by
invoking nfc_llcp_local_put(local) after accessing local->gb. However,
if the reference count drops to zero, local is freed immediately,
leading to a use-after-free when callers access the returned pointer.
Alternative approaches using dynamic allocation (e.g. kmemdup) introduced
memory leaks because callers consistently treat the returned pointer as
borrowed memory.
Fix this properly by refactoring nfc_llcp_general_bytes() and
nfc_get_local_general_bytes() to accept a caller-provided output buffer
(out_gb) and its maximum length (gb_max_len). The general bytes are
safely copied into out_gb before calling nfc_llcp_local_put(local),
ensuring safe lifetime management without ownership transfer complications.
Update all callers across drivers (microread, pn533, pn544, st21nfca,
digital_dep, and nci) to provide their own destination buffers and pass
them to nfc_get_local_general_bytes().
📍 영향받는 시스템
Linux kernel (nfc subsystem, drivers: microread, pn533, pn544, st21nfca, digital_dep, nci)
⚔️ 공격 벡터
NFC 통신 과정에서 특정 시퀀스를 유도하여 메모리 해제 후 참조(UAF)를 유발함으로써 권한 상승이나 시스템 중단을 시도할 수 있음
🛡️ 대응 방법
커널 패치(Commit 6709d4b7bc2e 포함)를 적용하여 nfc_get_local_general_bytes 함수가 호출자 제공 버퍼를 사용하도록 업데이트해야 함
🔧 검증 코드
해당 커밋 해시가 로그에 존재하거나 최신 커널 버전이 적용되었는지 확인합니다.
git log -1 --format=%H | grep 6709d4b7bc2e || uname -r