{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2025-40215","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","state":"PUBLISHED","assignerShortName":"Linux","dateReserved":"2025-04-16T07:20:57.179Z","datePublished":"2025-12-04T12:38:32.517Z","dateUpdated":"2026-08-05T12:08:40.873Z"},"containers":{"cna":{"providerMetadata":{"orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","shortName":"Linux","dateUpdated":"2026-08-05T12:08:40.873Z"},"descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nxfrm: delete x->tunnel as we delete x\n\nThe ipcomp fallback tunnels currently get deleted (from the various\nlists and hashtables) as the last user state that needed that fallback\nis destroyed (not deleted). If a reference to that user state still\nexists, the fallback state will remain on the hashtables/lists,\ntriggering the WARN in xfrm_state_fini. Because of those remaining\nreferences, the fix in commit f75a2804da39 (\"xfrm: destroy xfrm_state\nsynchronously on net exit path\") is not complete.\n\nWe recently fixed one such situation in TCP due to defered freeing of\nskbs (commit 9b6412e6979f (\"tcp: drop secpath at the same time as we\ncurrently drop dst\")). This can also happen due to IP reassembly: skbs\nwith a secpath remain on the reassembly queue until netns\ndestruction. If we can't guarantee that the queues are flushed by the\ntime xfrm_state_fini runs, there may still be references to a (user)\nxfrm_state, preventing the timely deletion of the corresponding\nfallback state.\n\nInstead of chasing each instance of skbs holding a secpath one by one,\nthis patch fixes the issue directly within xfrm, by deleting the\nfallback state as soon as the last user state depending on it has been\ndeleted. Destruction will still happen when the final reference is\ndropped.\n\nA separate lockdep class for the fallback state is required since\nwe're going to lock x->tunnel while x is locked."}],"metrics":[{"cvssV3_1":{"version":"3.1","vectorString":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","baseScore":7.8,"baseSeverity":"HIGH"},"scenarios":[{"lang":"en","value":"AV:L - Triggering requires locally configuring an IPComp tunnel-mode SA via XFRM netlink and then tearing down the network namespace; a purely remote peer can pin the secpath reference but cannot create the SA or cause the netns teardown that frees the hash tables.\nAC:L - The attacker controls every element — SA creation, injecting the IPComp/fragmented packet that leaves an skb secpath reference outstanding, and the timing of namespace destruction — and the 30-second reassembly-queue window gives a large, reliable interval to groom the reclaimed kmalloc-64 bucket array and struct net.\nPR:L - XFRM state configuration is gated on netlink_net_capable(CAP_NET_ADMIN), which an unprivileged user obtains over their own namespace with `unshare -Urn`, and the ipcomp module autoloads via request_module() with no capability check.\nUI:N - The entire sequence — SA setup, packet injection, namespace exit — is performed by the attacker's own process with no action by any other user.\nS:U - The corrupted objects (xfrm hash tables, struct net, pernet data) and the vulnerable code are both kernel-resident, so impact stays within the kernel's security authority.\nC:H - The stale state is unlinked from already-freed memory, so its list/hlist traversal reads reclaimed slab contents and leaks kernel pointers into attacker-controllable objects, which is leverageable for arbitrary kernel memory disclosure.\nI:H - __xfrm_state_delete() performs list_del()/hlist_del_rcu() and net->xfrm.state_num-- on a freed struct net and a freed 64-byte bucket array, writing heap pointers at controlled offsets into reclaimed slab objects — a use-after-free write primitive usable for control-flow hijack.\nA:H - The bug immediately trips WARN_ON() in xfrm_state_fini() and xfrm6_tunnel_net_exit() (panic with panic_on_warn), and the subsequent use-after-free — including spin_lock() on freed memory — reliably produces oopses, lock corruption, or a full kernel panic."}]}],"affected":[{"product":"Linux","vendor":"Linux","defaultStatus":"unaffected","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["include/net/xfrm.h","net/ipv4/ipcomp.c","net/ipv6/ipcomp6.c","net/ipv6/xfrm6_tunnel.c","net/xfrm/xfrm_ipcomp.c","net/xfrm/xfrm_state.c"],"versions":[{"version":"9d4139c76905833afcb77fe8ccc17f302a0eb9ab","lessThan":"1b28a7fae0128fa140a7dccd995182ff6cd1c67b","status":"affected","versionType":"git"},{"version":"9d4139c76905833afcb77fe8ccc17f302a0eb9ab","lessThan":"4b2c17d0f9be8b58bb30468bc81a4b61c985b04e","status":"affected","versionType":"git"},{"version":"9d4139c76905833afcb77fe8ccc17f302a0eb9ab","lessThan":"0da961fa46da1b37ef868d9b603bd202136f8f8e","status":"affected","versionType":"git"},{"version":"9d4139c76905833afcb77fe8ccc17f302a0eb9ab","lessThan":"d0e0d1097118461463b76562c7ebaabaa5b90b13","status":"affected","versionType":"git"},{"version":"9d4139c76905833afcb77fe8ccc17f302a0eb9ab","lessThan":"dc3636912d41770466543623cb76e7b88fdb42c7","status":"affected","versionType":"git"},{"version":"9d4139c76905833afcb77fe8ccc17f302a0eb9ab","lessThan":"b441cf3f8c4b8576639d20c8eb4aa32917602ecd","status":"affected","versionType":"git"}]},{"product":"Linux","vendor":"Linux","defaultStatus":"affected","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["include/net/xfrm.h","net/ipv4/ipcomp.c","net/ipv6/ipcomp6.c","net/ipv6/xfrm6_tunnel.c","net/xfrm/xfrm_ipcomp.c","net/xfrm/xfrm_state.c"],"versions":[{"version":"2.6.29","status":"affected"},{"version":"0","lessThan":"2.6.29","status":"unaffected","versionType":"semver"},{"version":"5.10.248","lessThanOrEqual":"5.10.*","status":"unaffected","versionType":"semver"},{"version":"5.15.198","lessThanOrEqual":"5.15.*","status":"unaffected","versionType":"semver"},{"version":"6.1.160","lessThanOrEqual":"6.1.*","status":"unaffected","versionType":"semver"},{"version":"6.6.120","lessThanOrEqual":"6.6.*","status":"unaffected","versionType":"semver"},{"version":"6.12.62","lessThanOrEqual":"6.12.*","status":"unaffected","versionType":"semver"},{"version":"6.16","lessThanOrEqual":"*","status":"unaffected","versionType":"original_commit_for_fix"}]}],"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.29","versionEndExcluding":"5.10.248"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.29","versionEndExcluding":"5.15.198"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.29","versionEndExcluding":"6.1.160"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.29","versionEndExcluding":"6.6.120"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.29","versionEndExcluding":"6.12.62"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.29","versionEndExcluding":"6.16"}]}]}],"references":[{"url":"https://git.kernel.org/stable/c/1b28a7fae0128fa140a7dccd995182ff6cd1c67b"},{"url":"https://git.kernel.org/stable/c/4b2c17d0f9be8b58bb30468bc81a4b61c985b04e"},{"url":"https://git.kernel.org/stable/c/0da961fa46da1b37ef868d9b603bd202136f8f8e"},{"url":"https://git.kernel.org/stable/c/d0e0d1097118461463b76562c7ebaabaa5b90b13"},{"url":"https://git.kernel.org/stable/c/dc3636912d41770466543623cb76e7b88fdb42c7"},{"url":"https://git.kernel.org/stable/c/b441cf3f8c4b8576639d20c8eb4aa32917602ecd"}],"title":"xfrm: delete x->tunnel as we delete x","x_generator":{"engine":"bippy-1.2.0"}},"adp":[{"metrics":[{"other":{"type":"ssvc","content":{"timestamp":"2026-06-16T19:56:10.578142Z","id":"CVE-2025-40215","options":[{"Exploitation":"none"},{"Automatable":"no"},{"Technical Impact":"partial"}],"role":"CISA Coordinator","version":"2.0.3"}}}],"title":"CISA ADP Vulnrichment","providerMetadata":{"orgId":"134c704f-9b21-4f2e-91b3-4a467353bcc0","shortName":"CISA-ADP","dateUpdated":"2026-06-16T19:56:19.286Z"}}]}}