CVE-2025-23142

Source
https://cve.org/CVERecord?id=CVE-2025-23142
Import Source
https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2025-23142.json
JSON Data
https://api.test.osv.dev/v1/vulns/CVE-2025-23142
Downstream
Related
Published
2025-05-01T12:55:32.614Z
Modified
2026-03-11T05:36:26.418297Z
Summary
sctp: detect and prevent references to a freed transport in sendmsg
Details

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

sctp: detect and prevent references to a freed transport in sendmsg

sctpsendmsg() re-uses associations and transports when possible by doing a lookup based on the socket endpoint and the message destination address, and then sctpsendmsgtoasoc() sets the selected transport in all the message chunks to be sent.

There's a possible race condition if another thread triggers the removal of that selected transport, for instance, by explicitly unbinding an address with setsockopt(SCTPSOCKOPTBINDXREM), after the chunks have been set up and before the message is sent. This can happen if the send buffer is full, during the period when the sender thread temporarily releases the socket lock in sctpwaitforsndbuf().

This causes the access to the transport data in sctpoutqselect_transport(), when the association outqueue is flushed, to result in a use-after-free read.

This change avoids this scenario by having sctptransportfree() signal the freeing of the transport, tagging it as "dead". In order to do this, the patch restores the "dead" bit in struct sctptransport, which was removed in commit 47faa1e4c50e ("sctp: remove the dead field of sctptransport").

Then, in the scenario where the sender thread has released the socket lock in sctpwaitfor_sndbuf(), the bit is checked again after re-acquiring the socket lock to detect the deletion. This is done while holding a reference to the transport to prevent it from being freed in the process.

If the transport was deleted while the socket lock was relinquished, sctpsendmsgto_asoc() will return -EAGAIN to let userspace retry the send.

The bug was found by a private syzbot instance (see the error report [1] and the C reproducer that triggers it [2]).

Database specific
{
    "cna_assigner": "Linux",
    "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/23xxx/CVE-2025-23142.json"
}
References

Affected packages

Git / git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git

Affected ranges

Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
df132eff463873e14e019a07f387b4d577d6d1f9
Fixed
547762250220325d350d0917a7231480e0f4142b
Fixed
3257386be6a7eb8a8bfc9cbfb746df4eb4fc70e8
Fixed
0f7df4899299ce4662e5f95badb9dbc57cc37fa5
Fixed
7a63f4fb0efb4e69efd990cbb740a848679ec4b0
Fixed
c6fefcb71d246baaf3bacdad1af7ff50ebcfe652
Fixed
9e7c37fadb3be1fc33073fcf10aa96d166caa697
Fixed
5bc83bdf5f5b8010d1ca5a4555537e62413ab4e2
Fixed
2e5068b7e0ae0a54f6cfd03a2f80977da657f1ee
Fixed
f1a69a940de58b16e8249dff26f74c8cc59b32be
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
0 Unknown introduced commit / All previous commits are affected
Last affected
26e51e5287eed4d96ea66a3da95429f42940f013
Last affected
8b97e045bd6d37f96f161e4d371ae174148e1587
Last affected
e044554e97e812eb257d073bcc130e0ea653858f
Last affected
8376fdc999be008f0e9918db52f1ed8c08f5a1c9
Last affected
cd947138e8c31e8cfcd489c12e9b97271beb6e79

Database specific

source
"https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2025-23142.json"