data built 2026-10-19T13:16:53Z

Look up another CVE · open CVE-2024-57982 in the interactive tracker

CVE-2024-57982

xfrm: state: fix out-of-bounds read during lookup

7.8 EPSS 0.3% AV:L

Published 2025-02-27 (20 months ago) by the Linux kernel CNA. Subsystem net/xfrm. Debian urgency: not yet assigned.

What to do, per Debian release

Debian's own status for CVE-2024-57982 in every release this site tracks, and what each one means in practice. Every status below is the one the Debian Security Team publishes for this CVE. source

ReleaseStatus VersionWhat this means
Debian 12bookwormvulnerable6.1.190-1No fix published anywhere yet, neither in Debian nor upstream for the series bookworm tracks. Watch the Debian tracker page for this CVE. Advisories for bookworm have historically landed a median of 23 days after publication.
Debian 13trixiefixed6.12.13-1Update the kernel and reboot. Fixed in 6.12.13-1. A running kernel keeps the old code until the machine restarts.
Debian 14forkyfixed6.12.13-1Update the kernel and reboot. Fixed in 6.12.13-1. A running kernel keeps the old code until the machine restarts.
Debian unstablesidfixed6.12.13-1Update the kernel and reboot. Fixed in 6.12.13-1. A running kernel keeps the old code until the machine restarts.

The vulnerability

What the bug is

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.

Where it lives

The fix touches these files. If the subsystem is one you do not use, the practical exposure is lower, though the package is still the vulnerable one.

net/xfrm/xfrm_state.c

What this is
NETWORKING [IPSEC]MAINTAINERS section matched on net/xfrm/ · netdev@vger.kernel.org · Maintained

Check it on the machine

grep -w CONFIG_XFRM /boot/config-$(uname -r)

Reads the booted kernel's own configuration, on the machine and nowhere else. =y is built in, =m is a module, and an is not set line means the code is not there.

Show whether Debian builds this, per release

Debian builds this code. Every release below compiles the affected file into the kernels it ships.

  • bookworm, trixie, forky, sidy
y
built into the kernel image on every flavour - only a patch removes it
Build switch
CONFIG_XFRM

From the configuration Debian publishes for every kernel flavour it builds. It covers only the architectures Debian ships a linux-config package for, and nothing about a kernel you built yourself. Debian's own status above stays authoritative about the source package.MAINTAINERS kbuild Makefiles Debian linux-config packages

Signals

Published
2025-02-27 (20 months ago)source
CVSS
7.8 high
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:Hsource recompute it
Attack vector
local (AV:L)source
EPSS
0.26%, higher than 16.1% of all CVEssource
CISA KEV
not listedthe KEV catalogue
Debian urgency
not yet assignedsource
Subsystem
net/xfrm

Upstream fixes

The versions the CNA records as introducing and fixing this, and the commit for each. source

IntroducedFixed inCommit
4.96.6.120b86dc510308d
4.96.12.13a16871c7832e
4.96.13.2dd4c2a174994
4.96.14e952837f3ddb

Why the CNA scored it this way

Quoted from the kernel CNA's own scoring file, word for word. A highlighted metric carries the most severe value CVSS v3.1 defines for it, which is what pushes the score up. source

AV:LAttack vector, local
The race is reliably driven locally: XFRM netlink (`XFRM_MSG_NEWSA` to force `xfrm_hash_resize()`, `XFRM_MSG_GETSA` to drive concurrent lookups) is reachable from an unprivileged user's own network namespace, where the xfrm state hash tables are per-netns. Although the lookup is also hit by unauthenticated remote ESP/AH packets via `xfrm_input_state_lookup()`, a remote attacker cannot schedule the racing resize, so the local vector is the exploitable one.
AC:LAttack complexity, low
The attacker controls both sides of the race — inserting SAs to schedule `xfrm_hash_resize()` on one CPU while issuing lookups with attacker-chosen spi/daddr on another — and can repeat indefinitely by creating fresh network namespaces, each yielding a new sequence of doubling resizes. syzbot reproduced this from ordinary syscalls.
PR:LPrivileges required, low
`xfrm_user_rcv_msg()` requires `netlink_net_capable(CAP_NET_ADMIN)`, which resolves to `ns_capable(net->user_ns, CAP_NET_ADMIN)` and is therefore satisfied by any unprivileged user after `unshare -Urn`. No real root in the initial namespace is needed.
UI:NUser interaction, none
The attacker triggers both the hash resize and the concurrent state lookup entirely from their own threads; no victim action or cooperation is involved.
S:UScope, unchanged
The out-of-bounds access and any resulting corruption stay within the kernel's own security authority; no VM, IOMMU, or sandbox boundary is crossed.
C:HConfidentiality impact, high
The stale-table/new-mask mismatch reads up to a full table length past the allocation, and the OOB slot is dereferenced as an `hlist_node` and `container_of()`'d into a `struct xfrm_state`, so adjacent slab contents the attacker can groom become a fake-object pointer, yielding reads at attacker-influenced kernel addresses rather than a bounded few-byte leak.
I:HIntegrity impact, high
The bogus state pointer reaches `refcount_inc_not_zero(&x->refcnt)`, an increment write at an attacker-influenced address, and a fabricated `xfrm_state` returned to `xfrm_input()`/`xfrm_state_find()` is then used for IPsec processing — both usable to corrupt kernel state and pursue control-flow hijack.
A:HAvailability impact, high
Walking a garbage hlist pointer read past the end of the hash table dereferences a wild address, producing an oops or panic; with larger page-order tables the OOB read can also fault into unmapped memory.