{"id":"CVE-2025-37997","state":"PUBLISHED","title":"netfilter: ipset: fix region locking in hash types","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nnetfilter: ipset: fix region locking in hash types\n\nRegion locking introduced in v5.6-rc4 contained three macros to handle\nthe region locks: ahash_bucket_start(), ahash_bucket_end() which gave\nback the start and end hash bucket values belonging to a given region\nlock and ahash_region() which should give back the region lock belonging\nto a given hash bucket. The latter was incorrect which can lead to a\nrace condition between the garbage collector and adding new elements\nwhen a hash type of set is defined with timeouts.","publishedAt":"2025-05-29T13:15:55.580Z","updatedAt":"2026-10-15T21:52:05.816Z","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":"5dd9488ae41070b69d2f4acb580f77db5705f9ca","status":"affected","lessThan":"00cfc5fad1491796942a948808afb968a0a3f35b","versionType":"git"},{"version":"f66ee0410b1c3481ee75e5db9b34547b4d582465","status":"affected","lessThan":"226ce0ec38316d9e3739e73a64b6b8304646c658","versionType":"git"},{"version":"f66ee0410b1c3481ee75e5db9b34547b4d582465","status":"affected","lessThan":"82c1eb32693bc48251d92532975e19160987e5b9","versionType":"git"},{"version":"f66ee0410b1c3481ee75e5db9b34547b4d582465","status":"affected","lessThan":"aa77294b0f73bb8265987591460cd25b8722c3df","versionType":"git"},{"version":"f66ee0410b1c3481ee75e5db9b34547b4d582465","status":"affected","lessThan":"a3dfec485401943e315c394c29afe2db8f9481d6","versionType":"git"},{"version":"f66ee0410b1c3481ee75e5db9b34547b4d582465","status":"affected","lessThan":"e2ab67672b2288521a6146034a971f9a82ffc5c5","versionType":"git"},{"version":"f66ee0410b1c3481ee75e5db9b34547b4d582465","status":"affected","lessThan":"6e002ecc1c8cfdfc866b9104ab7888da54613e59","versionType":"git"},{"version":"f66ee0410b1c3481ee75e5db9b34547b4d582465","status":"affected","lessThan":"8478a729c0462273188263136880480729e9efca","versionType":"git"},{"version":"a469bab3386aebff33c59506f3a95e35b91118fd","status":"affected","versionType":"git"},{"version":"5.4.24","status":"affected","lessThan":"5.4.294","versionType":"semver"},{"version":"5.5.8","status":"affected","lessThan":"5.6","versionType":"semver"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["net/netfilter/ipset/ip_set_hash_gen.h"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"5.6","status":"affected"},{"version":"0","status":"unaffected","lessThan":"5.6","versionType":"semver"},{"version":"5.4.294","status":"unaffected","lessThanOrEqual":"5.4.*","versionType":"semver"},{"version":"5.10.238","status":"unaffected","lessThanOrEqual":"5.10.*","versionType":"semver"},{"version":"5.15.183","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"6.1.139","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.6.91","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.29","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.14.7","status":"unaffected","lessThanOrEqual":"6.14.*","versionType":"semver"},{"version":"6.15","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["net/netfilter/ipset/ip_set_hash_gen.h"]}],"references":["https://git.kernel.org/stable/c/00cfc5fad1491796942a948808afb968a0a3f35b","https://git.kernel.org/stable/c/226ce0ec38316d9e3739e73a64b6b8304646c658","https://git.kernel.org/stable/c/82c1eb32693bc48251d92532975e19160987e5b9","https://git.kernel.org/stable/c/aa77294b0f73bb8265987591460cd25b8722c3df","https://git.kernel.org/stable/c/a3dfec485401943e315c394c29afe2db8f9481d6","https://git.kernel.org/stable/c/e2ab67672b2288521a6146034a971f9a82ffc5c5","https://git.kernel.org/stable/c/6e002ecc1c8cfdfc866b9104ab7888da54613e59","https://git.kernel.org/stable/c/8478a729c0462273188263136880480729e9efca","https://lists.debian.org/debian-lts-announce/2025/10/msg00007.html","https://lists.debian.org/debian-lts-announce/2025/08/msg00010.html"],"weaknesses":[],"ingestedAt":"2026-10-29T20:09:03.054Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2025/37xxx/CVE-2025-37997.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2025-37997","state":"PUBLISHED","datePublished":"2025-05-29T13:15:55.580Z","dateUpdated":"2026-10-15T21:52:05.816Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2025-04-16T04:51:23.976Z"},"containers":{"cna":{"title":"netfilter: ipset: fix region locking in hash types","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nnetfilter: ipset: fix region locking in hash types\n\nRegion locking introduced in v5.6-rc4 contained three macros to handle\nthe region locks: ahash_bucket_start(), ahash_bucket_end() which gave\nback the start and end hash bucket values belonging to a given region\nlock and ahash_region() which should give back the region lock belonging\nto a given hash bucket. The latter was incorrect which can lead to a\nrace condition between the garbage collector and adding new elements\nwhen a hash type of set is defined with timeouts."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"5dd9488ae41070b69d2f4acb580f77db5705f9ca","status":"affected","lessThan":"00cfc5fad1491796942a948808afb968a0a3f35b","versionType":"git"},{"version":"f66ee0410b1c3481ee75e5db9b34547b4d582465","status":"affected","lessThan":"226ce0ec38316d9e3739e73a64b6b8304646c658","versionType":"git"},{"version":"f66ee0410b1c3481ee75e5db9b34547b4d582465","status":"affected","lessThan":"82c1eb32693bc48251d92532975e19160987e5b9","versionType":"git"},{"version":"f66ee0410b1c3481ee75e5db9b34547b4d582465","status":"affected","lessThan":"aa77294b0f73bb8265987591460cd25b8722c3df","versionType":"git"},{"version":"f66ee0410b1c3481ee75e5db9b34547b4d582465","status":"affected","lessThan":"a3dfec485401943e315c394c29afe2db8f9481d6","versionType":"git"},{"version":"f66ee0410b1c3481ee75e5db9b34547b4d582465","status":"affected","lessThan":"e2ab67672b2288521a6146034a971f9a82ffc5c5","versionType":"git"},{"version":"f66ee0410b1c3481ee75e5db9b34547b4d582465","status":"affected","lessThan":"6e002ecc1c8cfdfc866b9104ab7888da54613e59","versionType":"git"},{"version":"f66ee0410b1c3481ee75e5db9b34547b4d582465","status":"affected","lessThan":"8478a729c0462273188263136880480729e9efca","versionType":"git"},{"version":"a469bab3386aebff33c59506f3a95e35b91118fd","status":"affected","versionType":"git"},{"version":"5.4.24","status":"affected","lessThan":"5.4.294","versionType":"semver"},{"version":"5.5.8","status":"affected","lessThan":"5.6","versionType":"semver"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["net/netfilter/ipset/ip_set_hash_gen.h"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"5.6","status":"affected"},{"version":"0","status":"unaffected","lessThan":"5.6","versionType":"semver"},{"version":"5.4.294","status":"unaffected","lessThanOrEqual":"5.4.*","versionType":"semver"},{"version":"5.10.238","status":"unaffected","lessThanOrEqual":"5.10.*","versionType":"semver"},{"version":"5.15.183","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"6.1.139","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.6.91","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.29","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.14.7","status":"unaffected","lessThanOrEqual":"6.14.*","versionType":"semver"},{"version":"6.15","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["net/netfilter/ipset/ip_set_hash_gen.h"]}],"references":[{"url":"https://git.kernel.org/stable/c/00cfc5fad1491796942a948808afb968a0a3f35b"},{"url":"https://git.kernel.org/stable/c/226ce0ec38316d9e3739e73a64b6b8304646c658"},{"url":"https://git.kernel.org/stable/c/82c1eb32693bc48251d92532975e19160987e5b9"},{"url":"https://git.kernel.org/stable/c/aa77294b0f73bb8265987591460cd25b8722c3df"},{"url":"https://git.kernel.org/stable/c/a3dfec485401943e315c394c29afe2db8f9481d6"},{"url":"https://git.kernel.org/stable/c/e2ab67672b2288521a6146034a971f9a82ffc5c5"},{"url":"https://git.kernel.org/stable/c/6e002ecc1c8cfdfc866b9104ab7888da54613e59"},{"url":"https://git.kernel.org/stable/c/8478a729c0462273188263136880480729e9efca"}],"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 add/del and GC paths are driven through the ipset nfnetlink/sockopt control plane, which requires a local socket (netfilter control plane = Local per kernel scoring convention). Remote packets can drive `mtype_add()` via the `xt_set` SET target, but only when the administrator has configured such a rule, so the base score uses the self-contained local path.\nAC:L - The attacker provisions both sides of the race: they choose `hashsize >= 2048` (which is what breaks the modulo-vs-division region mapping) and a short `timeout` that pins the GC period to the `HZ/10` floor, then churn add/del indefinitely with roughly half of all operations taking the wrong region lock. No condition depends on attacker-uncontrollable state, and failed attempts are freely retriable.\nPR:L - Access is gated on `netlink_net_capable(skb, CAP_NET_ADMIN)` and `ns_capable(net->user_ns, CAP_NET_ADMIN)`, both evaluated against the network namespace's user namespace, so an unprivileged user obtains it with `unshare -Urn`; ipset state is fully per-netns, so the whole attack works inside the sandbox.\nUI:N - The attacker creates the set, generates the element churn, and the garbage collector fires automatically from a delayed work item. No victim action is involved at any point.\nS:U - The corruption is confined to the kernel heap and is exploited for privilege escalation within the same kernel security authority; no VM, IOMMU, or hypervisor boundary is crossed.\nC:H - The unserialized GC/add race yields use-after-free of hbucket objects and of extension data freed by `ip_set_ext_destroy()`, and stale resurrected buckets let freed slab contents be read back to userspace via `ipset list`, giving an arbitrary-read primitive.\nI:H - GC's shrink path can copy more used entries than `tmp->size` accounts for when a concurrent `mtype_add()` bumps `n->pos` under a different lock, producing a heap out-of-bounds write of attacker-controlled element bytes; the double `kfree_rcu()` on the same hbucket additionally corrupts the SLUB freelist, both of which are standard arbitrary-write/control-flow-hijack primitives.\nA:H - Enqueuing the same `rcu_head` twice corrupts the RCU callback list (cycle → hang in `rcu_do_batch`), and the double free plus out-of-bounds writes reliably produce slab corruption, oops, and panic."}]}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-08-05T11:58:49.210Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.4.24","versionEndExcluding":"5.4.294"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.6","versionEndExcluding":"5.10.238"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.6","versionEndExcluding":"5.15.183"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.6","versionEndExcluding":"6.1.139"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.6","versionEndExcluding":"6.6.91"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.6","versionEndExcluding":"6.12.29"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.6","versionEndExcluding":"6.14.7"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.6","versionEndExcluding":"6.15"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.5.8"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}},"adp":[{"title":"CVE Program Container","references":[{"url":"https://lists.debian.org/debian-lts-announce/2025/10/msg00007.html"},{"url":"https://lists.debian.org/debian-lts-announce/2025/08/msg00010.html"}],"providerMetadata":{"shortName":"CVE","orgId":"af854a3a-2127-422b-91ae-364da2661108","dateUpdated":"2025-11-03T19:58:10.817Z"}},{"title":"CISA ADP Vulnrichment","metrics":[{"other":{"type":"ssvc","content":{"id":"CVE-2025-37997","role":"CISA Coordinator","options":[{"Exploitation":"none"},{"Automatable":"no"},{"Technical Impact":"total"}],"version":"2.0.3","timestamp":"2026-10-15T21:46:37.316861Z"}}}],"providerMetadata":{"shortName":"CISA-ADP","orgId":"134c704f-9b21-4f2e-91b3-4a467353bcc0","dateUpdated":"2026-10-15T21:52:05.816Z"}}]}}}