# CVE-2024-57974: udp: Deal with race between UDP socket address change and rehash

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

- **Severity:** MEDIUM 4.7
- **CVSS:** 4.7 (v3.1, NVD) `CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: High; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: None; Integrity impact: None; 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.19% (percentile 5, 2026-11-26)
- **CWE:** CWE-362
- **Published:** 2025-02-27T02:07:02.973Z
- **Modified:** 2026-11-05T21:17:38.603Z

## Who should check

- Anyone running Linux \>= 30fff9231fad757c061285e347b33c5149c2c2e4, \< 3946283de7bbb76b2995bd51ab0388d4fd556c77; \>= 30fff9231fad757c061285e347b33c5149c2c2e4, \< 2855445a1870b8e568fb19edbd60b9c499e3dae0; \>= 30fff9231fad757c061285e347b33c5149c2c2e4, \< 4f8344fce91c5766d368edb0ad80142eacd805c7; \>= 30fff9231fad757c061285e347b33c5149c2c2e4, \< d65d3bf309b2649d27b24efd0d8784da2d81f2a6; \>= 30fff9231fad757c061285e347b33c5149c2c2e4, \< a502ea6fa94b1f7be72a24bcf9e3f5f6b7e6e90c
- Anyone running Linux 2.6.33

## Description

In the Linux kernel, the following vulnerability has been resolved:

udp: Deal with race between UDP socket address change and rehash

If a UDP socket changes its local address while it's receiving
datagrams, as a result of connect(), there is a period during which
a lookup operation might fail to find it, after the address is changed
but before the secondary hash (port and address) and the four-tuple
hash (local and remote ports and addresses) are updated.

Secondary hash chains were introduced by commit 30fff9231fad ("udp:
bind() optimisation") and, as a result, a rehash operation became
needed to make a bound socket reachable again after a connect().

This operation was introduced by commit 719f835853a9 ("udp: add
rehash on connect()") which isn't however a complete fix: the
socket will be found once the rehashing completes, but not while
it's pending.

This is noticeable with a socat(1) server in UDP4-LISTEN mode, and a
client sending datagrams to it. After the server receives the first
datagram (cf. \_xioopen\_ipdgram\_listen()), it issues a connect() to
the address of the sender, in order to set up a directed flow.

Now, if the client, running on a different CPU thread, happens to
send a (subsequent) datagram while the server's socket changes its
address, but is not rehashed yet, this will result in a failed
lookup and a port unreachable error delivered to the client, as
apparent from the following reproducer:

  LEN=$(($(cat /proc/sys/net/core/wmem\_default) / 4))
  dd if=/dev/urandom bs=1 count=${LEN} of=tmp.in

  while :; do
  	taskset -c 1 socat UDP4-LISTEN:1337,null-eof OPEN:tmp.out,create,trunc &
  	sleep 0.1 \|\| sleep 1
  	taskset -c 2 socat OPEN:tmp.in UDP4:localhost:1337,shut-null
  	wait
  done

where the client will eventually get ECONNREFUSED on a write()
(typically the second or third one of a given iteration):

  2024/11/13 21:28:23 socat\[46901\] E write(6, 0x556db2e3c000, 8192): Connection refused

This issue was first observed as a seldom failure in Podman's tests
checking UDP functionality while using pasta(1) to connect the
container's network namespace, which leads us to a reproducer with
the lookup error resulting in an ICMP packet on a tap device:

  LOCAL\_ADDR="$(ip -j -4 addr show\|jq -rM '.\[\] \| .addr\_info\[0\] \| select(.scope == "global").local')"

  while :; do
  	./pasta --config-net -p pasta.pcap -u 1337 socat UDP4-LISTEN:1337,null-eof OPEN:tmp.out,create,trunc &
  	sleep 0.2 \|\| sleep 1
  	socat OPEN:tmp.in UDP4:${LOCAL\_ADDR}:1337,shut-null
  	wait
  	cmp tmp.in tmp.out
  done

Once this fails:

  tmp.in tmp.out differ: char 8193, line 29

we can finally have a look at what's going on:

  $ tshark -r pasta.pcap
      1   0.000000           :: ? ff02::16     ICMPv6 110 Multicast Listener Report Message v2
      2   0.168690 88.198.0.161 ? 88.198.0.164 UDP 8234 60260 ? 1337 Len=8192
      3   0.168767 88.198.0.161 ? 88.198.0.164 UDP 8234 60260 ? 1337 Len=8192
      4   0.168806 88.198.0.161 ? 88.198.0.164 UDP 8234 60260 ? 1337 Len=8192
      5   0.168827 c6:47:05:8d:dc:04 ? Broadcast    ARP 42 Who has 88.198.0.161? Tell 88.198.0.164
      6   0.168851 9a:55:9a:55:9a:55 ? c6:47:05:8d:dc:04 ARP 42 88.198.0.161 is at 9a:55:9a:55:9a:55
      7   0.168875 88.198.0.161 ? 88.198.0.164 UDP 8234 60260 ? 1337 Len=8192
      8   0.168896 88.198.0.164 ? 88.198.0.161 ICMP 590 Destination unreachable (Port unreachable)
      9   0.168926 88.198.0.161 ? 88.198.0.164 UDP 8234 60260 ? 1337 Len=8192
     10   0.168959 88.198.0.161 ? 88.198.0.164 UDP 8234 60260 ? 1337 Len=8192
     11   0.168989 88.198.0.161 ? 88.198.0.164 UDP 4138 60260 ? 1337 Len=4096
     12   0.169010 88.198.0.161 ? 88.198.0.164 UDP 42 60260 ? 1337 Len=0

On the third datagram received, the network namespace of the container
initiates an ARP lookup to deliver the ICMP message.

In another variant of this reproducer, starting the client with:

  strace -f pasta --config-net -u 1337 socat UDP4-LISTEN:1337,null-eof OPEN:tmp.out,create,tru
---truncated---

## Affected and fixed versions

- Linux: \>= 30fff9231fad757c061285e347b33c5149c2c2e4, \< 3946283de7bbb76b2995bd51ab0388d4fd556c77; \>= 30fff9231fad757c061285e347b33c5149c2c2e4, \< 2855445a1870b8e568fb19edbd60b9c499e3dae0; \>= 30fff9231fad757c061285e347b33c5149c2c2e4, \< 4f8344fce91c5766d368edb0ad80142eacd805c7; \>= 30fff9231fad757c061285e347b33c5149c2c2e4, \< d65d3bf309b2649d27b24efd0d8784da2d81f2a6; \>= 30fff9231fad757c061285e347b33c5149c2c2e4, \< a502ea6fa94b1f7be72a24bcf9e3f5f6b7e6e90c (cvelist)
- Linux: 2.6.33 (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-57974. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2024-57974.md
Affected: Linux >= 30fff9231fad757c061285e347b33c5149c2c2e4, < 3946283de7bbb76b2995bd51ab0388d4fd556c77; >= 30fff9231fad757c061285e347b33c5149c2c2e4, < 2855445a1870b8e568fb19edbd60b9c499e3dae0; >= 30fff9231fad757c061285e347b33c5149c2c2e4, < 4f8344fce91c5766d368edb0ad80142eacd805c7; >= 30fff9231fad757c061285e…
Fixed in: Linux 3946283de7bbb76b2995bd51ab0388d4fd556c77, Linux 2855445a1870b8e568fb19edbd60b9c499e3dae0, Linux 4f8344fce91c5766d368edb0ad80142eacd805c7

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-57974 being exploited?

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

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

Medium: CVSS 4.7 (v3.1, scored by NVD). Not remotely exploitable (local or adjacent access needed). The attack needs conditions outside the attacker's control, which makes it harder.

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

Linux \>= 30fff9231fad757c061285e347b33c5149c2c2e4, \< 3946283de7bbb76b2995bd51ab0388d4fd556c77; \>= 30fff9231fad757c061285e347b33c5149c2c2e4, \< 2855445a1870b8e568fb19edbd60b9c499e3dae0; \>= 30fff9231fad757c061285e347b33c5149c2c2e4, \< 4f8344fce91c5766d368edb0ad80142eacd805c7; \>= 30fff9231fad757c061285e347b33c5149c2c2e4, \< d65d3bf309b2649d27b24efd0d8784da2d81f2a6; \>= 30fff9231fad757c061285e347b33c5149c2c2e4, \< a502ea6fa94b1f7be72a24bcf9e3f5f6b7e6e90c; Linux 2.6.33.

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

Yes. Fixed in Linux 3946283de7bbb76b2995bd51ab0388d4fd556c77, Linux 2855445a1870b8e568fb19edbd60b9c499e3dae0, Linux 4f8344fce91c5766d368edb0ad80142eacd805c7. No fix listed yet: follow the vendor advisory.

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

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/4f8344fce91c5766d368edb0ad80142eacd805c7>
- patch: <https://git.kernel.org/stable/c/d65d3bf309b2649d27b24efd0d8784da2d81f2a6>
- patch: <https://git.kernel.org/stable/c/a502ea6fa94b1f7be72a24bcf9e3f5f6b7e6e90c>
- other: <https://git.kernel.org/stable/c/3946283de7bbb76b2995bd51ab0388d4fd556c77>
- other: <https://git.kernel.org/stable/c/2855445a1870b8e568fb19edbd60b9c499e3dae0>

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

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