{"id":"CVE-2025-38472","state":"PUBLISHED","title":"netfilter: nf_conntrack: fix crash due to removal of uninitialised entry","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nnetfilter: nf_conntrack: fix crash due to removal of uninitialised entry\n\nA crash in conntrack was reported while trying to unlink the conntrack\nentry from the hash bucket list:\n    [exception RIP: __nf_ct_delete_from_lists+172]\n    [..]\n #7 [ff539b5a2b043aa0] nf_ct_delete at ffffffffc124d421 [nf_conntrack]\n #8 [ff539b5a2b043ad0] nf_ct_gc_expired at ffffffffc124d999 [nf_conntrack]\n #9 [ff539b5a2b043ae0] __nf_conntrack_find_get at ffffffffc124efbc [nf_conntrack]\n    [..]\n\nThe nf_conn struct is marked as allocated from slab but appears to be in\na partially initialised state:\n\n ct hlist pointer is garbage; looks like the ct hash value\n (hence crash).\n ct->status is equal to IPS_CONFIRMED|IPS_DYING, which is expected\n ct->timeout is 30000 (=30s), which is unexpected.\n\nEverything else looks like normal udp conntrack entry.  If we ignore\nct->status and pretend its 0, the entry matches those that are newly\nallocated but not yet inserted into the hash:\n  - ct hlist pointers are overloaded and store/cache the raw tuple hash\n  - ct->timeout matches the relative time expected for a new udp flow\n    rather than the absolute 'jiffies' value.\n\nIf it were not for the presence of IPS_CONFIRMED,\n__nf_conntrack_find_get() would have skipped the entry.\n\nTheory is that we did hit following race:\n\ncpu x \t\t\tcpu y\t\t\tcpu z\n found entry E\t\tfound entry E\n E is expired\t\t<preemption>\n nf_ct_delete()\n return E to rcu slab\n\t\t\t\t\tinit_conntrack\n\t\t\t\t\tE is re-inited,\n\t\t\t\t\tct->status set to 0\n\t\t\t\t\treply tuplehash hnnode.pprev\n\t\t\t\t\tstores hash value.\n\ncpu y found E right before it was deleted on cpu x.\nE is now re-inited on cpu z.  cpu y was preempted before\nchecking for expiry and/or confirm bit.\n\n\t\t\t\t\t->refcnt set to 1\n\t\t\t\t\tE now owned by skb\n\t\t\t\t\t->timeout set to 30000\n\nIf cpu y were to resume now, it would observe E as\nexpired but would skip E due to missing CONFIRMED bit.\n\n\t\t\t\t\tnf_conntrack_confirm gets called\n\t\t\t\t\tsets: ct->status |= CONFIRMED\n\t\t\t\t\tThis is wrong: E is not yet added\n\t\t\t\t\tto hashtable.\n\ncpu y resumes, it observes E as expired but CONFIRMED:\n\t\t\t<resumes>\n\t\t\tnf_ct_expired()\n\t\t\t -> yes (ct->timeout is 30s)\n\t\t\tconfirmed bit set.\n\ncpu y will try to delete E from the hashtable:\n\t\t\tnf_ct_delete() -> set DYING bit\n\t\t\t__nf_ct_delete_from_lists\n\nEven this scenario doesn't guarantee a crash:\ncpu z still holds the table bucket lock(s) so y blocks:\n\n\t\t\twait for spinlock held by z\n\n\t\t\t\t\tCONFIRMED is set but there is no\n\t\t\t\t\tguarantee ct will be added to hash:\n\t\t\t\t\t\"chaintoolong\" or \"clash resolution\"\n\t\t\t\t\tlogic both skip the insert step.\n\t\t\t\t\treply hnnode.pprev still stores the\n\t\t\t\t\thash value.\n\n\t\t\t\t\tunlocks spinlock\n\t\t\t\t\treturn NF_DROP\n\t\t\t<unblocks, then\n\t\t\t crashes on hlist_nulls_del_rcu pprev>\n\nIn case CPU z does insert the entry into the hashtable, cpu y will unlink\nE again right away but no crash occurs.\n\nWithout 'cpu y' race, 'garbage' hlist is of no consequence:\nct refcnt remains at 1, eventually skb will be free'd and E gets\ndestroyed via: nf_conntrack_put -> nf_conntrack_destroy -> nf_ct_destroy.\n\nTo resolve this, move the IPS_CONFIRMED assignment after the table\ninsertion but before the unlock.\n\nPablo points out that the confirm-bit-store could be reordered to happen\nbefore hlist add resp. the timeout fixup, so switch to set_bit and\nbefore_atomic memory barrier to prevent this.\n\nIt doesn't matter if other CPUs can observe a newly inserted entry right\nbefore the CONFIRMED bit was set:\n\nSuch event cannot be distinguished from above \"E is the old incarnation\"\ncase: the entry will be skipped.\n\nAlso change nf_ct_should_gc() to first check the confirmed bit.\n\nThe gc sequence is:\n 1. Check if entry has expired, if not skip to next entry\n 2. Obtain a reference to the expired entry.\n 3. Call nf_ct_should_gc() to double-check step 1.\n\nnf_ct_should_gc() is thus called only for entries that already failed an\nexpiry check. After this patch, once the confirmed bit check pas\n---truncated---","publishedAt":"2025-07-28T11:21:33.977Z","updatedAt":"2026-10-15T21:52:17.084Z","severity":{"score":9.8,"label":"Critical","version":"3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","source":"Linux"},"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"1397af5bfd7d32b0cf2adb70a78c9a9e8f11d912","status":"affected","lessThan":"a47ef874189d47f934d0809ae738886307c0ea22","versionType":"git"},{"version":"1397af5bfd7d32b0cf2adb70a78c9a9e8f11d912","status":"affected","lessThan":"76179961c423cd698080b5e4d5583cf7f4fcdde9","versionType":"git"},{"version":"1397af5bfd7d32b0cf2adb70a78c9a9e8f11d912","status":"affected","lessThan":"fc38c249c622ff5e3011b8845fd49dbfd9289afc","versionType":"git"},{"version":"1397af5bfd7d32b0cf2adb70a78c9a9e8f11d912","status":"affected","lessThan":"938ce0e8422d3793fe30df2ed0e37f6bc0598379","versionType":"git"},{"version":"1397af5bfd7d32b0cf2adb70a78c9a9e8f11d912","status":"affected","lessThan":"2d72afb340657f03f7261e9243b44457a9228ac7","versionType":"git"},{"version":"594cea2c09f7cd440d1ee1c4547d5bc6a646b0e4","status":"affected","versionType":"git"},{"version":"5.18.13","status":"affected","lessThan":"5.19","versionType":"semver"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["include/net/netfilter/nf_conntrack.h","net/netfilter/nf_conntrack_core.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"5.19","status":"affected"},{"version":"0","status":"unaffected","lessThan":"5.19","versionType":"semver"},{"version":"6.1.147","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.6.100","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.40","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.15.8","status":"unaffected","lessThanOrEqual":"6.15.*","versionType":"semver"},{"version":"6.16","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["include/net/netfilter/nf_conntrack.h","net/netfilter/nf_conntrack_core.c"]}],"references":["https://git.kernel.org/stable/c/a47ef874189d47f934d0809ae738886307c0ea22","https://git.kernel.org/stable/c/76179961c423cd698080b5e4d5583cf7f4fcdde9","https://git.kernel.org/stable/c/fc38c249c622ff5e3011b8845fd49dbfd9289afc","https://git.kernel.org/stable/c/938ce0e8422d3793fe30df2ed0e37f6bc0598379","https://git.kernel.org/stable/c/2d72afb340657f03f7261e9243b44457a9228ac7","https://lists.debian.org/debian-lts-announce/2025/10/msg00008.html"],"weaknesses":[],"ingestedAt":"2026-10-29T20:09:09.358Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2025/38xxx/CVE-2025-38472.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2025-38472","state":"PUBLISHED","datePublished":"2025-07-28T11:21:33.977Z","dateUpdated":"2026-10-15T21:52:17.084Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2025-04-16T04:51:24.021Z"},"containers":{"cna":{"title":"netfilter: nf_conntrack: fix crash due to removal of uninitialised entry","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nnetfilter: nf_conntrack: fix crash due to removal of uninitialised entry\n\nA crash in conntrack was reported while trying to unlink the conntrack\nentry from the hash bucket list:\n    [exception RIP: __nf_ct_delete_from_lists+172]\n    [..]\n #7 [ff539b5a2b043aa0] nf_ct_delete at ffffffffc124d421 [nf_conntrack]\n #8 [ff539b5a2b043ad0] nf_ct_gc_expired at ffffffffc124d999 [nf_conntrack]\n #9 [ff539b5a2b043ae0] __nf_conntrack_find_get at ffffffffc124efbc [nf_conntrack]\n    [..]\n\nThe nf_conn struct is marked as allocated from slab but appears to be in\na partially initialised state:\n\n ct hlist pointer is garbage; looks like the ct hash value\n (hence crash).\n ct->status is equal to IPS_CONFIRMED|IPS_DYING, which is expected\n ct->timeout is 30000 (=30s), which is unexpected.\n\nEverything else looks like normal udp conntrack entry.  If we ignore\nct->status and pretend its 0, the entry matches those that are newly\nallocated but not yet inserted into the hash:\n  - ct hlist pointers are overloaded and store/cache the raw tuple hash\n  - ct->timeout matches the relative time expected for a new udp flow\n    rather than the absolute 'jiffies' value.\n\nIf it were not for the presence of IPS_CONFIRMED,\n__nf_conntrack_find_get() would have skipped the entry.\n\nTheory is that we did hit following race:\n\ncpu x \t\t\tcpu y\t\t\tcpu z\n found entry E\t\tfound entry E\n E is expired\t\t<preemption>\n nf_ct_delete()\n return E to rcu slab\n\t\t\t\t\tinit_conntrack\n\t\t\t\t\tE is re-inited,\n\t\t\t\t\tct->status set to 0\n\t\t\t\t\treply tuplehash hnnode.pprev\n\t\t\t\t\tstores hash value.\n\ncpu y found E right before it was deleted on cpu x.\nE is now re-inited on cpu z.  cpu y was preempted before\nchecking for expiry and/or confirm bit.\n\n\t\t\t\t\t->refcnt set to 1\n\t\t\t\t\tE now owned by skb\n\t\t\t\t\t->timeout set to 30000\n\nIf cpu y were to resume now, it would observe E as\nexpired but would skip E due to missing CONFIRMED bit.\n\n\t\t\t\t\tnf_conntrack_confirm gets called\n\t\t\t\t\tsets: ct->status |= CONFIRMED\n\t\t\t\t\tThis is wrong: E is not yet added\n\t\t\t\t\tto hashtable.\n\ncpu y resumes, it observes E as expired but CONFIRMED:\n\t\t\t<resumes>\n\t\t\tnf_ct_expired()\n\t\t\t -> yes (ct->timeout is 30s)\n\t\t\tconfirmed bit set.\n\ncpu y will try to delete E from the hashtable:\n\t\t\tnf_ct_delete() -> set DYING bit\n\t\t\t__nf_ct_delete_from_lists\n\nEven this scenario doesn't guarantee a crash:\ncpu z still holds the table bucket lock(s) so y blocks:\n\n\t\t\twait for spinlock held by z\n\n\t\t\t\t\tCONFIRMED is set but there is no\n\t\t\t\t\tguarantee ct will be added to hash:\n\t\t\t\t\t\"chaintoolong\" or \"clash resolution\"\n\t\t\t\t\tlogic both skip the insert step.\n\t\t\t\t\treply hnnode.pprev still stores the\n\t\t\t\t\thash value.\n\n\t\t\t\t\tunlocks spinlock\n\t\t\t\t\treturn NF_DROP\n\t\t\t<unblocks, then\n\t\t\t crashes on hlist_nulls_del_rcu pprev>\n\nIn case CPU z does insert the entry into the hashtable, cpu y will unlink\nE again right away but no crash occurs.\n\nWithout 'cpu y' race, 'garbage' hlist is of no consequence:\nct refcnt remains at 1, eventually skb will be free'd and E gets\ndestroyed via: nf_conntrack_put -> nf_conntrack_destroy -> nf_ct_destroy.\n\nTo resolve this, move the IPS_CONFIRMED assignment after the table\ninsertion but before the unlock.\n\nPablo points out that the confirm-bit-store could be reordered to happen\nbefore hlist add resp. the timeout fixup, so switch to set_bit and\nbefore_atomic memory barrier to prevent this.\n\nIt doesn't matter if other CPUs can observe a newly inserted entry right\nbefore the CONFIRMED bit was set:\n\nSuch event cannot be distinguished from above \"E is the old incarnation\"\ncase: the entry will be skipped.\n\nAlso change nf_ct_should_gc() to first check the confirmed bit.\n\nThe gc sequence is:\n 1. Check if entry has expired, if not skip to next entry\n 2. Obtain a reference to the expired entry.\n 3. Call nf_ct_should_gc() to double-check step 1.\n\nnf_ct_should_gc() is thus called only for entries that already failed an\nexpiry check. After this patch, once the confirmed bit check pas\n---truncated---"}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"1397af5bfd7d32b0cf2adb70a78c9a9e8f11d912","status":"affected","lessThan":"a47ef874189d47f934d0809ae738886307c0ea22","versionType":"git"},{"version":"1397af5bfd7d32b0cf2adb70a78c9a9e8f11d912","status":"affected","lessThan":"76179961c423cd698080b5e4d5583cf7f4fcdde9","versionType":"git"},{"version":"1397af5bfd7d32b0cf2adb70a78c9a9e8f11d912","status":"affected","lessThan":"fc38c249c622ff5e3011b8845fd49dbfd9289afc","versionType":"git"},{"version":"1397af5bfd7d32b0cf2adb70a78c9a9e8f11d912","status":"affected","lessThan":"938ce0e8422d3793fe30df2ed0e37f6bc0598379","versionType":"git"},{"version":"1397af5bfd7d32b0cf2adb70a78c9a9e8f11d912","status":"affected","lessThan":"2d72afb340657f03f7261e9243b44457a9228ac7","versionType":"git"},{"version":"594cea2c09f7cd440d1ee1c4547d5bc6a646b0e4","status":"affected","versionType":"git"},{"version":"5.18.13","status":"affected","lessThan":"5.19","versionType":"semver"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["include/net/netfilter/nf_conntrack.h","net/netfilter/nf_conntrack_core.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"5.19","status":"affected"},{"version":"0","status":"unaffected","lessThan":"5.19","versionType":"semver"},{"version":"6.1.147","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.6.100","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.40","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.15.8","status":"unaffected","lessThanOrEqual":"6.15.*","versionType":"semver"},{"version":"6.16","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["include/net/netfilter/nf_conntrack.h","net/netfilter/nf_conntrack_core.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/a47ef874189d47f934d0809ae738886307c0ea22"},{"url":"https://git.kernel.org/stable/c/76179961c423cd698080b5e4d5583cf7f4fcdde9"},{"url":"https://git.kernel.org/stable/c/fc38c249c622ff5e3011b8845fd49dbfd9289afc"},{"url":"https://git.kernel.org/stable/c/938ce0e8422d3793fe30df2ed0e37f6bc0598379"},{"url":"https://git.kernel.org/stable/c/2d72afb340657f03f7261e9243b44457a9228ac7"}],"metrics":[{"cvssV3_1":{"version":"3.1","vectorString":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","baseScore":9.8,"baseSeverity":"CRITICAL"},"scenarios":[{"lang":"en","value":"AV:N - The entire code path (nf_conntrack_in → init_conntrack → __nf_conntrack_confirm → __nf_conntrack_find_get → nf_ct_gc_expired) executes in softirq context on received packets, with no syscall or local entry point required. Any Linux box doing stateful filtering or NAT — routers, firewalls, Docker/k8s hosts — reaches this purely from remote traffic.\nAC:L - The attacker drives every side of the race: a flood of short-lived UDP flows creates, expires, GCs and reallocates conntrack entries concurrently across CPUs, and duplicate same-5-tuple packets sent in parallel deliberately steer confirmation into the clash-resolution/chaintoolong paths that leave the uninitialised hlist pointer. The crash was observed spontaneously on production systems under ordinary load, confirming no attacker-uncontrollable precondition is needed.\nPR:N - No authentication or privilege of any kind is required — an unauthenticated remote host merely sends packets to or through the target. Conntrack entry allocation, confirmation and expiry are performed on behalf of arbitrary unsolicited traffic.\nUI:N - Exploitation requires nothing from any local user; packet processing happens automatically in softirq context on receipt.\nS:U - The corruption is confined to kernel memory within the same security authority; no VM, IOMMU or sandbox boundary is crossed.\nC:H - The refcount imbalance frees an nf_conn still referenced by a live skb, and SLAB_TYPESAFE_BY_RCU lets the attacker immediately reclaim it with an attacker-shaped nf_conn, giving a use-after-free read primitive over conntrack/NAT state and adjacent slab contents.\nI:H - `__hlist_nulls_del()` performs `WRITE_ONCE(*pprev, next)` where pprev is NULL or the raw attacker-influenced tuple hash — a wild kernel write — and the accompanying UAF permits heap grooming for control-flow hijack; the bug also silently unlinks valid live conntrack entries, corrupting firewall/NAT policy state.\nA:H - The reported real-world symptom is a kernel oops in __nf_ct_delete_from_lists from dereferencing the uninitialised hlist pprev, and the use-after-free independently causes panics; a remote attacker can trigger it repeatedly."}]}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-08-05T12:02:11.183Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.19","versionEndExcluding":"6.1.147"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.19","versionEndExcluding":"6.6.100"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.19","versionEndExcluding":"6.12.40"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.19","versionEndExcluding":"6.15.8"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.19","versionEndExcluding":"6.16"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.18.13"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}},"adp":[{"title":"CVE Program Container","references":[{"url":"https://lists.debian.org/debian-lts-announce/2025/10/msg00008.html"}],"providerMetadata":{"shortName":"CVE","orgId":"af854a3a-2127-422b-91ae-364da2661108","dateUpdated":"2025-11-03T17:38:37.206Z"}},{"title":"CISA ADP Vulnrichment","metrics":[{"other":{"type":"ssvc","content":{"id":"CVE-2025-38472","role":"CISA Coordinator","options":[{"Exploitation":"none"},{"Automatable":"yes"},{"Technical Impact":"total"}],"version":"2.0.3","timestamp":"2026-10-15T21:50:46.455411Z"}}}],"providerMetadata":{"shortName":"CISA-ADP","orgId":"134c704f-9b21-4f2e-91b3-4a467353bcc0","dateUpdated":"2026-10-15T21:52:17.084Z"}}]}}}