CVE
CVE-2024-50067
CNA 原文 · 原文(英文)
In the Linux kernel, the following vulnerability has been resolved: uprobe: avoid out-of-bounds memory access of fetching args Uprobe needs to fetch args into a percpu buffer, and then copy to ring buffer to avoid non-atomic context problem. Sometimes user-space strings, arrays can be very large, but the size of percpu buffer is only page size. And store_trace_args() won't check whether these data exceeds a single page or not, caused out-of-bounds memory access. It could be reproduced by following steps: 1. build kernel with CONFIG_KASAN enabled 2. save follow program as test.c ``` \#include <stdio.h> \#include <stdlib.h> \#include <string.h> // If string length large than MAX_STRING_SIZE, the fetch_store_strlen() // will return 0, cause __get_data_size() return shorter size, and // store_trace_args() will not trigger out-of-bounds access. // So make string length less than 4096. \#define STRLEN 4093 void generate_string(char *str, int n) { int i; for (i = 0; i < n; ++i) { char c = i % 26 + 'a'; str[i] = c; } str[n-1] = '\0'; } void print_string(char *str) { printf("%s\n", str); } int main() { char tmp[STRLEN]; generate_string(tmp, STRLEN); print_string(tmp); return 0; } ``` 3. compile program `gcc -o test test.c` 4. get the offset of `print_string()` ``` objdump -t test | grep -w print_string 0000000000401199 g F .text 000000000000001b print_string ``` 5. configure uprobe with offset 0x1199 ``` off=0x1199 cd /sys/kernel/debug/tracing/ echo "p /root/test:${off} arg1=+0(%di):ustring arg2=\$comm arg3=+0(%di):ustring" > uprobe_events echo 1 > events/uprobes/enable echo 1 > tracing_on ``` 6. run `test`, and kasan will report error. ================================================================== BUG: KASAN: use-after-free in strncpy_from_user+0x1d6/0x1f0 Write of size 8 at addr ffff88812311c004 by task test/499CPU: 0 UID: 0 PID: 499 Comm: test Not tainted 6.12.0-rc3+…
受影响版本
- 6.12-rc4仅此版本
- 6.12-rc3仅此版本
- 6.12-rc2仅此版本
- 6.12-rc1仅此版本
- ≥ 6.7, < 6.11.6修复版本 6.11.6
- ≥ 6.2, < 6.6.59修复版本 6.6.59
- ≥ 3.14, < 6.1.118修复版本 6.1.118
发行版软件包(Debian、Ubuntu、Red Hat 等)会回移补丁而不改上游版本号,请同时查看所用发行版的安全公告。
公告与补丁
- git.kernel.org/stable/c/0dc3ad9ad2188da7f090b3dbe4d2fcd9ae8ae64f · Patch
- git.kernel.org/stable/c/373b9338c9722a368925d83bc622c596896b328e · Patch
- git.kernel.org/stable/c/537ad4a431f6dddbf15d40d19f24bb9ee12b55cb · Patch
- git.kernel.org/stable/c/9e5f93788c9dd4309e75a56860a1ac44a8e117b9 · Patch
- lists.debian.org/debian-lts-announce/2025/01/msg00001.html · Third Party Advisory
数据来源:NVD(公有领域)、CISA KEV(CC0)、FIRST EPSS、OSV.dev / GitHub Advisory Database(CC-BY 4.0) · 本库只列受影响版本与修复版本,不托管、不链接任何利用代码。