{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2025-40331","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","state":"PUBLISHED","assignerShortName":"Linux","dateReserved":"2025-04-16T07:20:57.186Z","datePublished":"2025-12-09T04:09:48.196Z","dateUpdated":"2026-08-05T12:09:40.498Z"},"containers":{"cna":{"providerMetadata":{"orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","shortName":"Linux","dateUpdated":"2026-08-05T12:09:40.498Z"},"descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nsctp: Prevent TOCTOU out-of-bounds write\n\nFor the following path not holding the sock lock,\n\n  sctp_diag_dump() -> sctp_for_each_endpoint() -> sctp_ep_dump()\n\nmake sure not to exceed bounds in case the address list has grown\nbetween buffer allocation (time-of-check) and write (time-of-use)."}],"metrics":[{"cvssV3_1":{"version":"3.1","vectorString":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","baseScore":7.8,"baseSeverity":"HIGH"},"scenarios":[{"lang":"en","value":"AV:L - Triggering requires local syscalls — a `NETLINK_SOCK_DIAG` dump request plus a concurrent `setsockopt(SCTP_SOCKOPT_BINDX_ADD)` on the attacker's own socket. A remote SCTP peer cannot drive the diag dump, so despite being in net/sctp this is the local netlink/diag surface.\nAC:L - The attacker owns both sides of the race — one thread hammers the diag dump, another calls sctp_bindx on its own endpoint — and the vulnerable window spans the entire unbounded write loop, which the attacker lengthens by pre-binding many addresses. Failed attempts are harmless and can be retried indefinitely.\nPR:L - No capability check exists anywhere on the sock_diag/inet_diag dump path (the `net_admin` flag only selects optional attributes), and sctp_do_bind only needs CAP_NET_BIND_SERVICE for ports below 1024, which the attacker avoids. Any unprivileged local user with an SCTP socket can do this, without namespaces.\nUI:N - The attacker creates the SCTP endpoint, issues the diag dump, and grows the address list entirely on its own. No victim action of any kind is involved.\nS:U - The corruption is confined to kernel heap memory managed by the same kernel security authority. No VM, IOMMU, or sandbox boundary is crossed.\nC:H - The same TOCTOU in the shrink direction leaves the tail of the reserved INET_DIAG_LOCALS attribute uninitialized and copies that kernel heap data straight to userspace, and the heap overflow itself corrupts skb_shared_info (frag_list/destructor_arg), which is readily leveraged into arbitrary kernel memory disclosure.\nI:H - This is a heap out-of-bounds write with attacker-chosen length — a single bindx call can append ~8000 addresses, yielding up to ~1 MB written past the reserved region — and partially attacker-controlled content, smashing skb_shared_info and adjacent slab objects, which is a strong path to control-flow hijack and privilege escalation.\nA:H - Overwriting skb_shared_info and neighbouring allocations with sockaddr data reliably produces oopses and kernel panics on subsequent skb handling. Any unprivileged user can repeat the attack at will."}]}],"affected":[{"product":"Linux","vendor":"Linux","defaultStatus":"unaffected","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["net/sctp/diag.c"],"versions":[{"version":"8f840e47f190cbe61a96945c13e9551048d42cef","lessThan":"b106a68df0650b694b254427cd9250c04500edd3","status":"affected","versionType":"git"},{"version":"8f840e47f190cbe61a96945c13e9551048d42cef","lessThan":"3006959371007fc2eae4a078f823c680fa52de1a","status":"affected","versionType":"git"},{"version":"8f840e47f190cbe61a96945c13e9551048d42cef","lessThan":"72e3fea68eac8d088e44c3dd954e843478e9240e","status":"affected","versionType":"git"},{"version":"8f840e47f190cbe61a96945c13e9551048d42cef","lessThan":"584307275b2048991b2e8984962189b6cc0a9b85","status":"affected","versionType":"git"},{"version":"8f840e47f190cbe61a96945c13e9551048d42cef","lessThan":"c9119f243d9c0da3c3b5f577a328de3e7ffd1b42","status":"affected","versionType":"git"},{"version":"8f840e47f190cbe61a96945c13e9551048d42cef","lessThan":"2fe08fcaacb7eb019fa9c81db39b2214de216677","status":"affected","versionType":"git"},{"version":"8f840e47f190cbe61a96945c13e9551048d42cef","lessThan":"89eac1e150dbd42963e13d23828cb8c4e0763196","status":"affected","versionType":"git"},{"version":"8f840e47f190cbe61a96945c13e9551048d42cef","lessThan":"95aef86ab231f047bb8085c70666059b58f53c09","status":"affected","versionType":"git"}]},{"product":"Linux","vendor":"Linux","defaultStatus":"affected","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["net/sctp/diag.c"],"versions":[{"version":"4.7","status":"affected"},{"version":"0","lessThan":"4.7","status":"unaffected","versionType":"semver"},{"version":"5.4.302","lessThanOrEqual":"5.4.*","status":"unaffected","versionType":"semver"},{"version":"5.10.247","lessThanOrEqual":"5.10.*","status":"unaffected","versionType":"semver"},{"version":"5.15.197","lessThanOrEqual":"5.15.*","status":"unaffected","versionType":"semver"},{"version":"6.1.159","lessThanOrEqual":"6.1.*","status":"unaffected","versionType":"semver"},{"version":"6.6.117","lessThanOrEqual":"6.6.*","status":"unaffected","versionType":"semver"},{"version":"6.12.58","lessThanOrEqual":"6.12.*","status":"unaffected","versionType":"semver"},{"version":"6.17.8","lessThanOrEqual":"6.17.*","status":"unaffected","versionType":"semver"},{"version":"6.18","lessThanOrEqual":"*","status":"unaffected","versionType":"original_commit_for_fix"}]}],"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.7","versionEndExcluding":"5.4.302"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.7","versionEndExcluding":"5.10.247"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.7","versionEndExcluding":"5.15.197"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.7","versionEndExcluding":"6.1.159"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.7","versionEndExcluding":"6.6.117"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.7","versionEndExcluding":"6.12.58"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.7","versionEndExcluding":"6.17.8"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.7","versionEndExcluding":"6.18"}]}]}],"references":[{"url":"https://git.kernel.org/stable/c/b106a68df0650b694b254427cd9250c04500edd3"},{"url":"https://git.kernel.org/stable/c/3006959371007fc2eae4a078f823c680fa52de1a"},{"url":"https://git.kernel.org/stable/c/72e3fea68eac8d088e44c3dd954e843478e9240e"},{"url":"https://git.kernel.org/stable/c/584307275b2048991b2e8984962189b6cc0a9b85"},{"url":"https://git.kernel.org/stable/c/c9119f243d9c0da3c3b5f577a328de3e7ffd1b42"},{"url":"https://git.kernel.org/stable/c/2fe08fcaacb7eb019fa9c81db39b2214de216677"},{"url":"https://git.kernel.org/stable/c/89eac1e150dbd42963e13d23828cb8c4e0763196"},{"url":"https://git.kernel.org/stable/c/95aef86ab231f047bb8085c70666059b58f53c09"}],"title":"sctp: Prevent TOCTOU out-of-bounds write","x_generator":{"engine":"bippy-1.2.0"}},"adp":[{"metrics":[{"other":{"type":"ssvc","content":{"timestamp":"2026-06-16T19:58:03.978750Z","id":"CVE-2025-40331","options":[{"Exploitation":"none"},{"Automatable":"no"},{"Technical Impact":"partial"}],"role":"CISA Coordinator","version":"2.0.3"}}}],"title":"CISA ADP Vulnrichment","providerMetadata":{"orgId":"134c704f-9b21-4f2e-91b3-4a467353bcc0","shortName":"CISA-ADP","dateUpdated":"2026-06-16T19:58:14.829Z"}}]}}