🇰🇷 한글 설명
리눅스 커널의 BPF cgroup 로컬 스토리지에서 테일 콜(tail call)을 통해 경계 외 메모리 접근(OOB)이 발생할 수 있는 취약점입니다. 서로 다른 크기의 로컬 스토리지를 사용하는 두 프로그램이 테일 콜로 연결될 때, 검증기(verifier)는 통과하지만 실행 시점에 잘못된 맵을 참조하여 메모리 오류를 유발할 수 있습니다.
💡 쉬운 설명
프로그램이 다른 프로그램을 호출할 때, 메모리 저장 공간의 크기를 잘못 계산하여 허용되지 않은 영역의 데이터를 읽거나 쓸 수 있는 문제입니다. 이로 인해 시스템의 보안이 뚫리거나 프로그램이 강제로 종료될 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
bpf: Fix oob access in cgroup local storage
Lonial reported that an out-of-bounds access in cgroup local storage
can be crafted via tail calls. Given two programs each utilizing a
cgroup local storage with a different value size, and one program
doing a tail call into the other. The verifier will validate each of
the indivial programs just fine. However, in the runtime context
the bpf_cg_run_ctx holds an bpf_prog_array_item which contains the
BPF program as well as any cgroup local storage flavor the program
uses. Helpers such as bpf_get_local_storage() pick this up from the
runtime context:
ctx = container_of(current->bpf_ctx, struct bpf_cg_run_ctx, run_ctx);
storage = ctx->prog_item->cgroup_storage[stype];
if (stype == BPF_CGROUP_STORAGE_SHARED)
ptr = &READ_ONCE(storage->buf)->data[0];
else
ptr = this_cpu_ptr(storage->percpu_buf);
For the second program which was called from the originally attached
one, this means bpf_get_local_storage() will pick up the former
program's map, not its own. With mismatching sizes, this can result
in an unintended out-of-bounds access.
To fix this issue, we need to extend bpf_map_owner with an array of
storage_cookie[] to match on i) the exact maps from the original
program if the second program was using bpf_get_local_storage(), or
ii) allow the tail call combination if the second program was not
using any of the cgroup local storage maps.
📍 영향받는 시스템
cgroup 로컬 스토리지를 사용하는 BPF 기능을 포함한 리눅스 커널 버전
⚔️ 공격 벡터
서로 다른 크기의 cgroup 로컬 스토리지를 사용하는 두 BPF 프로그램을 테일 콜로 연결하여 실행
🛡️ 대응 방법
해당 취약점이 수정된 최신 버전의 리눅스 커널로 업데이트
🔧 검증 코드
출력된 커널 버전이 취약점이 패치된 최신 보안 업데이트 버전인지 확인