🔍 CVE-2024-56702

5.5
CVSS Score
MEDIUM
2024-12-28
2026-10-21 13:17
✅ 완료

🇰🇷 한글 설명

Linux 커널의 BPF(Berkeley Packet Filter)에서 raw tracepoint 인자가 NULL일 수 있음에도 불구하고, 검증기(verifier)가 이를 항상 신뢰할 수 있는(non-NULL) 상태로 간주하는 취약점입니다. 이로 인해 커널 검증기가 NULL 체크 로직을 삭제하게 되어, 실제 NULL 포인터 접근 시 커널 충돌(Crash)이 발생할 수 있습니다.

💡 쉬운 설명

커널이 '이 데이터는 절대 비어있지 않을 거야'라고 잘못 믿고 있어서, 실제로 비어있는 데이터가 들어오면 시스템이 갑자기 멈추거나 꺼질 수 있는 문제입니다. 이를 해결하기 위해 데이터가 비어있을 가능성을 미리 체크하도록 수정되었습니다.

🇺🇸 원문 (English)

In the Linux kernel, the following vulnerability has been resolved: bpf: Mark raw_tp arguments with PTR_MAYBE_NULL Arguments to a raw tracepoint are tagged as trusted, which carries the semantics that the pointer will be non-NULL. However, in certain cases, a raw tracepoint argument may end up being NULL. More context about this issue is available in [0]. Thus, there is a discrepancy between the reality, that raw_tp arguments can actually be NULL, and the verifier's knowledge, that they are never NULL, causing explicit NULL checks to be deleted, and accesses to such pointers potentially crashing the kernel. To fix this, mark raw_tp arguments as PTR_MAYBE_NULL, and then special case the dereference and pointer arithmetic to permit it, and allow passing them into helpers/kfuncs; these exceptions are made for raw_tp programs only. Ensure that we don't do this when ref_obj_id > 0, as in that case this is an acquired object and doesn't need such adjustment. The reason we do mask_raw_tp_trusted_reg logic is because other will recheck in places whether the register is a trusted_reg, and then consider our register as untrusted when detecting the presence of the PTR_MAYBE_NULL flag. To allow safe dereference, we enable PROBE_MEM marking when we see loads into trusted pointers with PTR_MAYBE_NULL. While trusted raw_tp arguments can also be passed into helpers or kfuncs where such broken assumption may cause issues, a future patch set will tackle their case separately, as PTR_TO_BTF_ID (without PTR_TRUSTED) can already be passed into helpers and causes similar problems. Thus, they are left alone for now. It is possible that these checks also permit passing non-raw_tp args that are trusted PTR_TO_BTF_ID with null marking. In such a case, allowing dereference when pointer is NULL expands allowed behavior, so won't regress existing programs, and the case of passing these into helpers is the same as above and will be dealt with later. Also update the failure case in tp_btf_nullable selftest to capture the new behavior, as the verifier will no longer cause an error when directly dereference a raw tracepoint argument marked as __nullable. [0]: https://lore.kernel.org/bpf/[email protected]

📍 영향받는 시스템

Linux Kernel (BPF raw tracepoint 기능을 사용하는 버전)

⚔️ 공격 벡터

조작된 BPF 프로그램을 통해 NULL 포인터를 포함한 raw tracepoint 인자를 전달하여 커널 패닉 유도

🛡️ 대응 방법

Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트

🔧 검증 코드

출력된 커널 버전이 해당 취약점이 해결된 패치 버전 이후인지 확인

Shell / Script
uname -r

📊 CVSS Vector String

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

💻 영향받는 소프트웨어

Linux Kernel