{"id":"CVE-2026-31516","state":"PUBLISHED","title":"xfrm: prevent policy_hthresh.work from racing with netns teardown","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nxfrm: prevent policy_hthresh.work from racing with netns teardown\n\nA XFRM_MSG_NEWSPDINFO request can queue the per-net work item\npolicy_hthresh.work onto the system workqueue.\n\nThe queued callback, xfrm_hash_rebuild(), retrieves the enclosing\nstruct net via container_of(). If the net namespace is torn down\nbefore that work runs, the associated struct net may already have\nbeen freed, and xfrm_hash_rebuild() may then dereference stale memory.\n\nxfrm_policy_fini() already flushes policy_hash_work during teardown,\nbut it does not synchronize policy_hthresh.work.\n\nSynchronize policy_hthresh.work in xfrm_policy_fini() as well, so the\nqueued work cannot outlive the net namespace teardown and access a\nfreed struct net.","publishedAt":"2026-04-22T13:54:32.851Z","updatedAt":"2026-10-19T18:45:54.791Z","severity":{"score":7.8,"label":"High","version":"3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/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":"880a6fab8f6ba5b5abe59ea68533202ddea1012c","status":"affected","lessThan":"56ea2257b83ee29a543f158159e3d1abc1e3e4fe","versionType":"git"},{"version":"880a6fab8f6ba5b5abe59ea68533202ddea1012c","status":"affected","lessThan":"8854e9367465d784046362698731c1111e3b39b8","versionType":"git"},{"version":"880a6fab8f6ba5b5abe59ea68533202ddea1012c","status":"affected","lessThan":"4e2e77843fef473ef47e322d52436d8308582a96","versionType":"git"},{"version":"880a6fab8f6ba5b5abe59ea68533202ddea1012c","status":"affected","lessThan":"29fe3a61bcdce398ee3955101c39f89c01a8a77e","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["net/xfrm/xfrm_policy.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"3.18","status":"affected"},{"version":"0","status":"unaffected","lessThan":"3.18","versionType":"semver"},{"version":"6.12.80","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.21","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"6.19.11","status":"unaffected","lessThanOrEqual":"6.19.*","versionType":"semver"},{"version":"7.0","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["net/xfrm/xfrm_policy.c"]}],"references":["https://git.kernel.org/stable/c/56ea2257b83ee29a543f158159e3d1abc1e3e4fe","https://git.kernel.org/stable/c/8854e9367465d784046362698731c1111e3b39b8","https://git.kernel.org/stable/c/4e2e77843fef473ef47e322d52436d8308582a96","https://git.kernel.org/stable/c/29fe3a61bcdce398ee3955101c39f89c01a8a77e"],"weaknesses":["CWE-416"],"ingestedAt":"2026-10-29T20:11:40.391Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2026/31xxx/CVE-2026-31516.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2026-31516","state":"PUBLISHED","datePublished":"2026-04-22T13:54:32.851Z","dateUpdated":"2026-10-19T18:45:54.791Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2026-03-09T15:48:24.107Z"},"containers":{"cna":{"title":"xfrm: prevent policy_hthresh.work from racing with netns teardown","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nxfrm: prevent policy_hthresh.work from racing with netns teardown\n\nA XFRM_MSG_NEWSPDINFO request can queue the per-net work item\npolicy_hthresh.work onto the system workqueue.\n\nThe queued callback, xfrm_hash_rebuild(), retrieves the enclosing\nstruct net via container_of(). If the net namespace is torn down\nbefore that work runs, the associated struct net may already have\nbeen freed, and xfrm_hash_rebuild() may then dereference stale memory.\n\nxfrm_policy_fini() already flushes policy_hash_work during teardown,\nbut it does not synchronize policy_hthresh.work.\n\nSynchronize policy_hthresh.work in xfrm_policy_fini() as well, so the\nqueued work cannot outlive the net namespace teardown and access a\nfreed struct net."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"880a6fab8f6ba5b5abe59ea68533202ddea1012c","status":"affected","lessThan":"56ea2257b83ee29a543f158159e3d1abc1e3e4fe","versionType":"git"},{"version":"880a6fab8f6ba5b5abe59ea68533202ddea1012c","status":"affected","lessThan":"8854e9367465d784046362698731c1111e3b39b8","versionType":"git"},{"version":"880a6fab8f6ba5b5abe59ea68533202ddea1012c","status":"affected","lessThan":"4e2e77843fef473ef47e322d52436d8308582a96","versionType":"git"},{"version":"880a6fab8f6ba5b5abe59ea68533202ddea1012c","status":"affected","lessThan":"29fe3a61bcdce398ee3955101c39f89c01a8a77e","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["net/xfrm/xfrm_policy.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"3.18","status":"affected"},{"version":"0","status":"unaffected","lessThan":"3.18","versionType":"semver"},{"version":"6.12.80","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.21","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"6.19.11","status":"unaffected","lessThanOrEqual":"6.19.*","versionType":"semver"},{"version":"7.0","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["net/xfrm/xfrm_policy.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/56ea2257b83ee29a543f158159e3d1abc1e3e4fe"},{"url":"https://git.kernel.org/stable/c/8854e9367465d784046362698731c1111e3b39b8"},{"url":"https://git.kernel.org/stable/c/4e2e77843fef473ef47e322d52436d8308582a96"},{"url":"https://git.kernel.org/stable/c/29fe3a61bcdce398ee3955101c39f89c01a8a77e"}],"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 - The vulnerable path is reached by a local NETLINK_XFRM request, specifically XFRM_MSG_NEWSPDINFO, not by remote packet processing.\nAC:L - The attacker can create the net namespace, send the request that queues policy_hthresh.work, and tear the namespace down; this is an attacker-controlled race and can be retried.\nPR:L - XFRM netlink operations require CAP_NET_ADMIN over the target network namespace. This is reachable with low privileges via user and network namespaces rather than requiring real init-namespace root.\nUI:N - No victim action is required after the attacker has local execution; the attacker directly drives the netlink request and namespace teardown.\nS:U - The impact is within the kernel security authority and does not cross a separate boundary such as guest-to-host or IOMMU isolation.\nC:H - The bug is a use-after-free of struct net reached by queued work dereferencing stale namespace memory. Under the required conservative kernel scoring guidance, UAF memory corruption is treated as capable of high confidentiality impact.\nI:H - The stale work callback writes through fields in the freed struct net and manipulates policy lists and hash state. As a kernel UAF, this is defensibly scored as high integrity impact due to potential memory corruption and control-flow exploitation.\nA:H - The stale struct net dereference can crash or corrupt the kernel during workqueue execution. Kernel crashes and UAF-triggered failures are high availability impact."}]}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-08-05T12:23:13.439Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"3.18","versionEndExcluding":"6.12.80"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"3.18","versionEndExcluding":"6.18.21"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"3.18","versionEndExcluding":"6.19.11"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"3.18","versionEndExcluding":"7.0"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}},"adp":[{"title":"CISA ADP Vulnrichment","metrics":[{"other":{"type":"ssvc","content":{"id":"CVE-2026-31516","role":"CISA Coordinator","options":[{"Exploitation":"none"},{"Automatable":"no"},{"Technical Impact":"total"}],"version":"2.0.3","timestamp":"2026-10-16T15:10:33.949707Z"}}}],"problemTypes":[{"descriptions":[{"cweId":"CWE-416","lang":"en","type":"CWE","description":"CWE-416 Use After Free"}]}],"providerMetadata":{"shortName":"CISA-ADP","orgId":"134c704f-9b21-4f2e-91b3-4a467353bcc0","dateUpdated":"2026-10-19T18:45:54.791Z"}}]}}}