CVE-2024-50257
Severity CVSS v4.0:
Pending analysis
Type:
CWE-416
Use After Free
Publication date:
09/11/2024
Last modified:
03/11/2025
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
netfilter: Fix use-after-free in get_info()<br />
<br />
ip6table_nat module unload has refcnt warning for UAF. call trace is:<br />
<br />
WARNING: CPU: 1 PID: 379 at kernel/module/main.c:853 module_put+0x6f/0x80<br />
Modules linked in: ip6table_nat(-)<br />
CPU: 1 UID: 0 PID: 379 Comm: ip6tables Not tainted 6.12.0-rc4-00047-gc2ee9f594da8-dirty #205<br />
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996),<br />
BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014<br />
RIP: 0010:module_put+0x6f/0x80<br />
Call Trace:<br />
<br />
get_info+0x128/0x180<br />
do_ip6t_get_ctl+0x6a/0x430<br />
nf_getsockopt+0x46/0x80<br />
ipv6_getsockopt+0xb9/0x100<br />
rawv6_getsockopt+0x42/0x190<br />
do_sock_getsockopt+0xaa/0x180<br />
__sys_getsockopt+0x70/0xc0<br />
__x64_sys_getsockopt+0x20/0x30<br />
do_syscall_64+0xa2/0x1a0<br />
entry_SYSCALL_64_after_hwframe+0x77/0x7f<br />
<br />
Concurrent execution of module unload and get_info() trigered the warning.<br />
The root cause is as follows:<br />
<br />
cpu0 cpu1<br />
module_exit<br />
//mod->state = MODULE_STATE_GOING<br />
ip6table_nat_exit<br />
xt_unregister_template<br />
kfree(t)<br />
//removed from templ_list<br />
getinfo()<br />
t = xt_find_table_lock<br />
list_for_each_entry(tmpl, &xt_templates[af]...)<br />
if (strcmp(tmpl->name, name))<br />
continue; //table not found<br />
try_module_get<br />
list_for_each_entry(t, &xt_net->tables[af]...)<br />
return t; //not get refcnt<br />
module_put(t->me) //uaf<br />
unregister_pernet_subsys<br />
//remove table from xt_net list<br />
<br />
While xt_table module was going away and has been removed from<br />
xt_templates list, we couldnt get refcnt of xt_table->me. Check<br />
module in xt_net->tables list re-traversal to fix it.
Impact
Base Score 3.x
7.80
Severity 3.x
HIGH
Vulnerable products and versions
| CPE | From | Up to |
|---|---|---|
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.15 (including) | 5.15.171 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.16 (including) | 6.1.116 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.2 (including) | 6.6.60 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.7 (including) | 6.11.7 (excluding) |
| cpe:2.3:o:linux:linux_kernel:6.12:rc1:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:6.12:rc2:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:6.12:rc3:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:6.12:rc4:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:6.12:rc5:*:*:*:*:*:* |
To consult the complete list of CPE names with products and versions, see this page
References to Advisories, Solutions, and Tools
- https://git.kernel.org/stable/c/6a1f088f9807f5166f58902d26246d0b88da03a8
- https://git.kernel.org/stable/c/ba22ea01348384df19cc1fabc7964be6e7189749
- https://git.kernel.org/stable/c/bab3bb35c03b263c486833d50d50c081d9e9832b
- https://git.kernel.org/stable/c/cb7c388b5967946f097afdb759b7c860305f2d96
- https://git.kernel.org/stable/c/f48d258f0ac540f00fa617dac496c4c18b5dc2fa
- https://lists.debian.org/debian-lts-announce/2025/01/msg00001.html



