In the Linux kernel, the following vulnerability has been resolved:
netfilter: Fix use-after-free in get_info()
ip6table_nat module unload has refcnt warning for UAF. call trace is:
WARNING: CPU: 1 PID: 379 at kernel/module/main.c:853 moduleput+0x6f/0x80 Modules linked in: ip6tablenat(-) CPU: 1 UID: 0 PID: 379 Comm: ip6tables Not tainted 6.12.0-rc4-00047-gc2ee9f594da8-dirty #205 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014 RIP: 0010:moduleput+0x6f/0x80 Call Trace: <TASK> getinfo+0x128/0x180 doip6tgetctl+0x6a/0x430 nfgetsockopt+0x46/0x80 ipv6getsockopt+0xb9/0x100 rawv6getsockopt+0x42/0x190 dosockgetsockopt+0xaa/0x180 _sysgetsockopt+0x70/0xc0 _x64sysgetsockopt+0x20/0x30 dosyscall64+0xa2/0x1a0 entrySYSCALL64after_hwframe+0x77/0x7f
Concurrent execution of module unload and get_info() trigered the warning. The root cause is as follows:
cpu0 cpu1 moduleexit //mod->state = MODULESTATEGOING ip6tablenatexit xtunregistertemplate kfree(t) //removed from templlist getinfo() t = xtfindtablelock listforeachentry(tmpl, &xttemplates[af]...) if (strcmp(tmpl->name, name)) continue; //table not found trymoduleget listforeachentry(t, &xtnet->tables[af]...) return t; //not get refcnt moduleput(t->me) //uaf unregisterpernetsubsys //remove table from xt_net list
While xttable module was going away and has been removed from xttemplates list, we couldnt get refcnt of xttable->me. Check module in xtnet->tables list re-traversal to fix it.
[
{
"signature_type": "Function",
"deprecated": false,
"signature_version": "v1",
"digest": {
"length": 950.0,
"function_hash": "170614642493028817206754839111405181"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@ba22ea01348384df19cc1fabc7964be6e7189749",
"target": {
"file": "net/netfilter/x_tables.c",
"function": "xt_find_table_lock"
},
"id": "CVE-2024-50257-08d37f85"
},
{
"signature_type": "Function",
"deprecated": false,
"signature_version": "v1",
"digest": {
"length": 950.0,
"function_hash": "170614642493028817206754839111405181"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@bab3bb35c03b263c486833d50d50c081d9e9832b",
"target": {
"file": "net/netfilter/x_tables.c",
"function": "xt_find_table_lock"
},
"id": "CVE-2024-50257-19042e6c"
},
{
"signature_type": "Line",
"deprecated": false,
"signature_version": "v1",
"digest": {
"line_hashes": [
"225555047165956422857221860303839425265",
"327208233759040078649777563095429376255",
"15369995397091098191318603627967729829",
"325011974456685537374348502917206314506"
],
"threshold": 0.9
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@bab3bb35c03b263c486833d50d50c081d9e9832b",
"target": {
"file": "net/netfilter/x_tables.c"
},
"id": "CVE-2024-50257-2d184d11"
},
{
"signature_type": "Line",
"deprecated": false,
"signature_version": "v1",
"digest": {
"line_hashes": [
"225555047165956422857221860303839425265",
"327208233759040078649777563095429376255",
"15369995397091098191318603627967729829",
"325011974456685537374348502917206314506"
],
"threshold": 0.9
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@ba22ea01348384df19cc1fabc7964be6e7189749",
"target": {
"file": "net/netfilter/x_tables.c"
},
"id": "CVE-2024-50257-444a8604"
},
{
"signature_type": "Line",
"deprecated": false,
"signature_version": "v1",
"digest": {
"line_hashes": [
"225555047165956422857221860303839425265",
"327208233759040078649777563095429376255",
"15369995397091098191318603627967729829",
"325011974456685537374348502917206314506"
],
"threshold": 0.9
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@cb7c388b5967946f097afdb759b7c860305f2d96",
"target": {
"file": "net/netfilter/x_tables.c"
},
"id": "CVE-2024-50257-556a32d9"
},
{
"signature_type": "Function",
"deprecated": false,
"signature_version": "v1",
"digest": {
"length": 950.0,
"function_hash": "170614642493028817206754839111405181"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@6a1f088f9807f5166f58902d26246d0b88da03a8",
"target": {
"file": "net/netfilter/x_tables.c",
"function": "xt_find_table_lock"
},
"id": "CVE-2024-50257-61a7b48c"
},
{
"signature_type": "Line",
"deprecated": false,
"signature_version": "v1",
"digest": {
"line_hashes": [
"225555047165956422857221860303839425265",
"327208233759040078649777563095429376255",
"15369995397091098191318603627967729829",
"325011974456685537374348502917206314506"
],
"threshold": 0.9
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f48d258f0ac540f00fa617dac496c4c18b5dc2fa",
"target": {
"file": "net/netfilter/x_tables.c"
},
"id": "CVE-2024-50257-6841d60f"
},
{
"signature_type": "Function",
"deprecated": false,
"signature_version": "v1",
"digest": {
"length": 950.0,
"function_hash": "170614642493028817206754839111405181"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@cb7c388b5967946f097afdb759b7c860305f2d96",
"target": {
"file": "net/netfilter/x_tables.c",
"function": "xt_find_table_lock"
},
"id": "CVE-2024-50257-6d6a61be"
},
{
"signature_type": "Function",
"deprecated": false,
"signature_version": "v1",
"digest": {
"length": 950.0,
"function_hash": "170614642493028817206754839111405181"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f48d258f0ac540f00fa617dac496c4c18b5dc2fa",
"target": {
"file": "net/netfilter/x_tables.c",
"function": "xt_find_table_lock"
},
"id": "CVE-2024-50257-911c2513"
},
{
"signature_type": "Line",
"deprecated": false,
"signature_version": "v1",
"digest": {
"line_hashes": [
"225555047165956422857221860303839425265",
"327208233759040078649777563095429376255",
"15369995397091098191318603627967729829",
"325011974456685537374348502917206314506"
],
"threshold": 0.9
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@6a1f088f9807f5166f58902d26246d0b88da03a8",
"target": {
"file": "net/netfilter/x_tables.c"
},
"id": "CVE-2024-50257-ebf65097"
}
]