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

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** HIGH 7.8
- **CVSS:** 7.8 (v3.1, CNA) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: High; Integrity impact: High; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.32% (percentile 17, 2026-11-26)
- **CWE:** CWE-125
- **Published:** 2025-02-27T02:07:08.169Z
- **Modified:** 2026-10-30T13:17:49.700Z

## Who should check

- Anyone running Linux \>= c2f672fc94642bae96821a393f342edcfa9794a6, \< 80610185e9dd2ef7c0a4818a47390a8655b3dc27; \>= c2f672fc94642bae96821a393f342edcfa9794a6, \< b86dc510308d7a8955f3f47a4fea4bef887653e4; \>= c2f672fc94642bae96821a393f342edcfa9794a6, \< a16871c7832ea6435abb6e0b58289ae7dcb7e4fc; \>= c2f672fc94642bae96821a393f342edcfa9794a6, \< dd4c2a174994238d55ab54da2545543d36f4e0d0; \>= c2f672fc94642bae96821a393f342edcfa9794a6, \< e952837f3ddb0ff726d5b582aa1aad9aa38d024d
- Anyone running Linux 4.9

## 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.

## Affected and fixed versions

- Linux: \>= c2f672fc94642bae96821a393f342edcfa9794a6, \< 80610185e9dd2ef7c0a4818a47390a8655b3dc27; \>= c2f672fc94642bae96821a393f342edcfa9794a6, \< b86dc510308d7a8955f3f47a4fea4bef887653e4; \>= c2f672fc94642bae96821a393f342edcfa9794a6, \< a16871c7832ea6435abb6e0b58289ae7dcb7e4fc; \>= c2f672fc94642bae96821a393f342edcfa9794a6, \< dd4c2a174994238d55ab54da2545543d36f4e0d0; \>= c2f672fc94642bae96821a393f342edcfa9794a6, \< e952837f3ddb0ff726d5b582aa1aad9aa38d024d (cvelist)
- Linux: 4.9 (cvelist)

## Mitigation

- No fix listed yet: follow the vendor advisory.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2024-57982. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2024-57982.md
Affected: Linux >= c2f672fc94642bae96821a393f342edcfa9794a6, < 80610185e9dd2ef7c0a4818a47390a8655b3dc27; >= c2f672fc94642bae96821a393f342edcfa9794a6, < b86dc510308d7a8955f3f47a4fea4bef887653e4; >= c2f672fc94642bae96821a393f342edcfa9794a6, < a16871c7832ea6435abb6e0b58289ae7dcb7e4fc; >= c2f672fc94642bae96821a3…
Fixed in: Linux 80610185e9dd2ef7c0a4818a47390a8655b3dc27

Steps:
1. Search this machine and project for Linux: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2024-57982 being exploited?

There is no confirmed exploitation: CVE-2024-57982 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.32% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2024-57982?

High: CVSS 7.8 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed).

### Which versions are affected by CVE-2024-57982?

Linux \>= c2f672fc94642bae96821a393f342edcfa9794a6, \< 80610185e9dd2ef7c0a4818a47390a8655b3dc27; \>= c2f672fc94642bae96821a393f342edcfa9794a6, \< b86dc510308d7a8955f3f47a4fea4bef887653e4; \>= c2f672fc94642bae96821a393f342edcfa9794a6, \< a16871c7832ea6435abb6e0b58289ae7dcb7e4fc; \>= c2f672fc94642bae96821a393f342edcfa9794a6, \< dd4c2a174994238d55ab54da2545543d36f4e0d0; \>= c2f672fc94642bae96821a393f342edcfa9794a6, \< e952837f3ddb0ff726d5b582aa1aad9aa38d024d; Linux 4.9.

### Is there a fix for CVE-2024-57982?

Yes. Fixed in Linux 80610185e9dd2ef7c0a4818a47390a8655b3dc27. No fix listed yet: follow the vendor advisory.

### How do I check if I'm affected by CVE-2024-57982?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

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

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2024-57982>

HTML: <https://flawdb.com/CVE-2024-57982> · JSON: <https://flawdb.com/api/v1/entries/CVE-2024-57982>
