udp: Deal with race between UDP socket address change and rehash
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/urando
CVE-2024-57974
Primary source · Revision 1
Imported from structured advisory data. Source references identify upstream records or fields; verify affected versions and your deployed configuration.
Security context
Source reference: cve:CVE-2024-57974
Linux
Source reference: /containers/cna/affected/0/product
- Affected versions
- Not stated in this record
- Fixed versions
- Not stated in this record
- Prerequisites
- Not stated in this record
Linux
Source reference: /containers/cna/affected/1/product
- Affected versions
- Not stated in this record
- Fixed versions
- Not stated in this record
- Prerequisites
- Not stated in this record
Structured affected-version data
Original package identities and version rules from this source.
[
{
"repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
"vendor": "Linux",
"product": "Linux",
"versions": [
{
"status": "affected",
"version": "30fff9231fad757c061285e347b33c5149c2c2e4",
"lessThan": "2855445a1870b8e568fb19edbd60b9c499e3dae0",
"versionType": "git"
},
{
"status": "affected",
"version": "30fff9231fad757c061285e347b33c5149c2c2e4",
"lessThan": "4f8344fce91c5766d368edb0ad80142eacd805c7",
"versionType": "git"
},
{
"status": "affected",
"version": "30fff9231fad757c061285e347b33c5149c2c2e4",
"lessThan": "d65d3bf309b2649d27b24efd0d8784da2d81f2a6",
"versionType": "git"
},
{
"status": "affected",
"version": "30fff9231fad757c061285e347b33c5149c2c2e4",
"lessThan": "a502ea6fa94b1f7be72a24bcf9e3f5f6b7e6e90c",
"versionType": "git"
}
],
"programFiles": [
"net/ipv4/udp.c",
"net/ipv6/udp.c"
],
"defaultStatus": "unaffected"
},
{
"repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
"vendor": "Linux",
"product": "Linux",
"versions": [
{
"status": "affected",
"version": "2.6.33"
},
{
"status": "unaffected",
"version": "0",
"lessThan": "2.6.33",
"versionType": "semver"
},
{
"status": "unaffected",
"version": "6.6.160",
"versionType": "semver",
"lessThanOrEqual": "6.6.*"
},
{
"status": "unaffected",
"version": "6.12.13",
"versionType": "semver",
"lessThanOrEqual": "6.12.*"
},
{
"status": "unaffected",
"version": "6.13.2",
"versionType": "semver",
"lessThanOrEqual": "6.13.*"
},
{
"status": "unaffected",
"version": "6.14",
"versionType": "original_commit_for_fix",
"lessThanOrEqual": "*"
}
],
"programFiles": [
"net/ipv4/udp.c",
"net/ipv6/udp.c"
],
"defaultStatus": "affected"
}
]- Related CVEs
- CVE-2024-57974
Source reference:
/cveMetadata/cveId
Publisher severity
No explicit severity was provided.
- Event
- #45931 · Revision 1
- Added to Heist Feed
- Publisher date