CVE-2025-38346: ftrace: Fix UAF when lookup kallsym after ftrace disabled
In the Linux kernel, the following vulnerability has been resolved:
ftrace: Fix UAF when lookup kallsym after ftrace disabled
The following issue happens with a buggy module:
BUG: unable to handle page fault for address: ffffffffc05d0218
PGD 1bd66f067 P4D 1bd66f067 PUD 1bd671067 PMD 101808067 PTE 0
Oops: Oops: 0000 [#1] SMP KASAN PTI
Tainted: [O]=OOT_MODULE, [E]=UNSIGNED_MODULE
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
RIP: 0010:sized_strscpy+0x81/0x2f0
RSP: 0018:ffff88812d76fa08 EFLAGS: 00010246
RAX: 0000000000000000 RBX: ffffffffc0601010 RCX: dffffc0000000000
RDX: 0000000000000038 RSI: dffffc0000000000 RDI: ffff88812608da2d
RBP: 8080808080808080 R08: ffff88812608da2d R09: ffff88812608da68
R10: ffff88812608d82d R11: ffff88812608d810 R12: 0000000000000038
R13: ffff88812608da2d R14: ffffffffc05d0218 R15: fefefefefefefeff
FS: 00007fef552de740(0000) GS:ffff8884251c7000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffffffc05d0218 CR3: 00000001146f0000 CR4: 00000000000006f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
ftrace_mod_get_kallsym+0x1ac/0x590
update_iter_mod+0x239/0x5b0
s_next+0x5b/0xa0
seq_read_iter+0x8c9/0x1070
seq_read+0x249/0x3b0
proc_reg_read+0x1b0/0x280
vfs_read+0x17f/0x920
ksys_read+0xf3/0x1c0
do_syscall_64+0x5f/0x2e0
entry_SYSCALL_64_after_hwframe+0x76/0x7e
The above issue may happen as follows:
(1) Add kprobe tracepoint;
(2) insmod test.ko;
(3) Module triggers ftrace disabled;
(4) rmmod test.ko;
(5) cat /proc/kallsyms; --> Will trigger UAF as test.ko already removed;
ftrace_mod_get_kallsym()
...
strscpy(module_name, mod_map->mod->name, MODULE_NAME_LEN);
...
The problem is when a module triggers an issue with ftrace and
sets ftrace_disable. The ftrace_disable is set when an anomaly is
discovered and to prevent any more damage, ftrace stops all text
modification. The issue that happened was that the ftrace_disable stops
more than just the text modification.
When a module is loaded, its init functions can also be traced. Because
kallsyms deletes the init functions after a module has loaded, ftrace
saves them when the module is loaded and function tracing is enabled. This
allows the output of the function trace to show the init function names
instead of just their raw memory addresses.
When a module is removed, ftrace_release_mod() is called, and if
ftrace_disable is set, it just returns without doing anything more. The
problem here is that it leaves the mod_list still around and if kallsyms
is called, it will call into this code and access the module memory that
has already been freed as it will return:
strscpy(module_name, mod_map->mod->name, MODULE_NAME_LEN);
Where the "mod" no longer exists and triggers a UAF bug.
Security readout for executives and security teams
Plain-English summary
A Linux kernel bookkeeping error can leave ftrace pointing to a module after its memory has been freed. A later symbol lookup can crash the kernel and, under CVSS assumptions, could affect confidentiality, integrity, and availability. The supplied vector describes local rather than remote access, and the published scenario depends on an unusual ftrace and module failure sequence.
Executive priority
Schedule prompt kernel remediation, accelerating internet-facing multi-user systems, shared compute, and hosts using third-party modules. This is high severity but not supported as an active-exploitation emergency by the supplied evidence. Treat unexplained kernel crashes matching the documented stack as potential indicators requiring investigation.
Technical view
When ftrace_disable is set, ftrace_release_mod() returns without removing a module mapping. After module unload, ftrace_mod_get_kallsym() may dereference the freed module during a /proc/kallsyms read, causing a use-after-free and page fault. Stable-kernel commits are provided as resolutions. The supplied CVSS 3.1 score is 7.8 with a local, low-privilege vector.
Likely exposure
Hosts running affected Linux kernel branches may be exposed, particularly systems using loadable modules, ftrace or kprobes, and local user access. Exact distribution package exposure cannot be inferred from upstream versions alone because vendors may backport fixes. The supplied affected-version data is unusual and does not clearly map every fixed branch.
Exploitation context
The bundle marks KEV false and provides no cited evidence of active exploitation. The documented failure requires ftrace becoming disabled, module removal, and a later kallsyms read. A kernel crash is demonstrated, but practical exploitation beyond denial of service is not established. The CVSS assessment nevertheless assigns high confidentiality, integrity, and availability impacts.
Researcher notes
The demonstrated root cause is stale ftrace module metadata surviving module teardown after ftrace_disable. The CVSS vector says low privileges, while the described setup includes module loading and removal; the exact boundary between privileged setup and attacker-triggerable access is not fully established. Avoid destructive reproduction on production systems.
Mitigation direction
Install a vendor kernel update containing the applicable stable-kernel fix or backport.
Consult the Linux distribution advisory for package versions and reboot guidance.
Prioritize hosts permitting untrusted local access or running third-party kernel modules.
Do not rely solely on upstream version numbers because distributions may backport fixes.
Validation and detection
Inventory running kernel and package versions across Linux hosts.
Confirm the active kernel includes an applicable stable fix or vendor-documented backport.
Review kernel logs for Oops, KASAN, use-after-free, ftrace_mod_get_kallsym, or kallsyms faults.
After remediation, verify the running kernel version against vendor guidance.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cve · low confidence lookup
CVE-2025-38346 mapping review
Open the CVE-to-ATT&CK bridge for reviewed, inferred, or future official mappings tied to this CVE.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
1CVSS vectors
3Timeline events
1ADP providers
11Source links
CVSS vector scores
1 official score
We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.