🇰🇷 한글 설명
Linux 커널의 BPF 기능 중 kprobe와 freplace를 결합하여 사용할 때, kprobe_write_ctx 권한을 악용해 커널 레지스터(pt_regs)를 임의로 수정할 수 있는 취약점입니다. 이 취약점은 freplace 프로그램이 kprobe 프로그램에 부착될 때 서로 다른 kprobe_write_ctx 값을 가질 수 있도록 허용하여 발생합니다.
💡 쉬운 설명
커널의 특정 기능을 조작하여 시스템의 중요한 설정값을 몰래 바꿀 수 있는 보안 구멍이 발견되었습니다. 공격자가 이 기능을 악용하면 프로그램이 실행될 때 전달되는 데이터를 마음대로 조작할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
bpf: Fix abuse of kprobe_write_ctx via freplace
uprobe programs are allowed to modify struct pt_regs.
Since the actual program type of uprobe is KPROBE, it can be abused to
modify struct pt_regs via kprobe+freplace when the kprobe attaches to
kernel functions.
For example,
SEC("?kprobe")
int kprobe(struct pt_regs *regs)
{
return 0;
}
SEC("?freplace")
int freplace_kprobe(struct pt_regs *regs)
{
regs->di = 0;
return 0;
}
freplace_kprobe prog will attach to kprobe prog.
kprobe prog will attach to a kernel function.
Without this patch, when the kernel function runs, its first arg will
always be set as 0 via the freplace_kprobe prog.
To fix the abuse of kprobe_write_ctx=true via kprobe+freplace, disallow
attaching freplace programs on kprobe programs with different
kprobe_write_ctx values.
📍 영향받는 시스템
kprobe 및 freplace 기능을 사용하는 Linux 커널 버전
⚔️ 공격 벡터
freplace 프로그램을 kprobe 프로그램에 부착하여 커널 레지스터(pt_regs)의 값을 임의로 수정
🛡️ 대응 방법
kprobe_write_ctx 값이 서로 다른 freplace 프로그램이 kprobe 프로그램에 부착되지 않도록 커널 패치 적용
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 해결된 최신 보안 패치 버전인지 확인