🇰🇷 한글 설명
리눅스 커널의 BPF(Berkeley Packet Filter)에서 서로 다른 훅(hook)에 연결된 프로그램 간의 테일 콜(tail call)을 제한하지 않아 발생하는 취약점입니다. 이로 인해 검증기(verifier)가 예상하는 컨텍스트 접근 방식이나 반환 값 규칙이 우회될 수 있습니다. 패치를 통해 서로 다른 훅 간의 테일 콜을 제한하여 보안 검증을 강화했습니다.
💡 쉬운 설명
서로 다른 규칙을 가진 프로그램들이 서로를 호출할 때, 보안 검사 시스템을 속여서 잘못된 데이터를 읽거나 허용되지 않은 값을 반환할 수 있는 문제입니다. 마치 A 규칙을 따르는 사람이 B 규칙을 따르는 사람인 척하며 보안 검사를 통과하는 것과 같습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
bpf: Prevent tail call between progs attached to different hooks
bpf progs can be attached to kernel functions, and the attached functions
can take different parameters or return different return values. If
prog attached to one kernel function tail calls prog attached to another
kernel function, the ctx access or return value verification could be
bypassed.
For example, if prog1 is attached to func1 which takes only 1 parameter
and prog2 is attached to func2 which takes two parameters. Since verifier
assumes the bpf ctx passed to prog2 is constructed based on func2's
prototype, verifier allows prog2 to access the second parameter from
the bpf ctx passed to it. The problem is that verifier does not prevent
prog1 from passing its bpf ctx to prog2 via tail call. In this case,
the bpf ctx passed to prog2 is constructed from func1 instead of func2,
that is, the assumption for ctx access verification is bypassed.
Another example, if BPF LSM prog1 is attached to hook file_alloc_security,
and BPF LSM prog2 is attached to hook bpf_lsm_audit_rule_known. Verifier
knows the return value rules for these two hooks, e.g. it is legal for
bpf_lsm_audit_rule_known to return positive number 1, and it is illegal
for file_alloc_security to return positive number. So verifier allows
prog2 to return positive number 1, but does not allow prog1 to return
positive number. The problem is that verifier does not prevent prog1
from calling prog2 via tail call. In this case, prog2's return value 1
will be used as the return value for prog1's hook file_alloc_security.
That is, the return value rule is bypassed.
This patch adds restriction for tail call to prevent such bypasses.
📍 영향받는 시스템
BPF 테일 콜 기능을 사용하는 리눅스 커널 버전
⚔️ 공격 벡터
서로 다른 매개변수 구조나 반환 값 규칙을 가진 BPF 프로그램 간의 테일 콜을 유도하여 커널 검증 로직 우회
🛡️ 대응 방법
리눅스 커널을 최신 보안 패치가 적용된 버전으로 업데이트
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 해결된 패치 버전 이후인지 확인