# CVE-2025-40331: sctp: Prevent TOCTOU out-of-bounds write

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

- **Severity:** HIGH 7.8
- **CVSS:** 7.8 (v3.1, CNA) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: High; Integrity impact: High; 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.23% (percentile 9, 2026-11-26)
- **Published:** 2025-12-09T04:09:48.196Z
- **Modified:** 2026-10-14T22:10:00.210Z

## Who should check

- Anyone running Linux \>= 8f840e47f190cbe61a96945c13e9551048d42cef, \< b106a68df0650b694b254427cd9250c04500edd3; \>= 8f840e47f190cbe61a96945c13e9551048d42cef, \< 3006959371007fc2eae4a078f823c680fa52de1a; \>= 8f840e47f190cbe61a96945c13e9551048d42cef, \< 72e3fea68eac8d088e44c3dd954e843478e9240e; \>= 8f840e47f190cbe61a96945c13e9551048d42cef, \< 584307275b2048991b2e8984962189b6cc0a9b85; \>= 8f840e47f190cbe61a96945c13e9551048d42cef, \< c9119f243d9c0da3c3b5f577a328de3e7ffd1b42; \>= 8f840e47f190cbe61a96945c13e9551048d42cef, \< 2fe08fcaacb7eb019fa9c81db39b2214de216677; \>= 8f840e47f190cbe61a96945c13e9551048d42cef, \< 89eac1e150dbd42963e13d23828cb8c4e0763196; \>= 8f840e47f190cbe61a96945c13e9551048d42cef, \< 95aef86ab231f047bb8085c70666059b58f53c09
- Anyone running Linux 4.7

## Description

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

sctp: Prevent TOCTOU out-of-bounds write

For the following path not holding the sock lock,

  sctp\_diag\_dump() -\> sctp\_for\_each\_endpoint() -\> sctp\_ep\_dump()

make sure not to exceed bounds in case the address list has grown
between buffer allocation (time-of-check) and write (time-of-use).

## Affected and fixed versions

- Linux: \>= 8f840e47f190cbe61a96945c13e9551048d42cef, \< b106a68df0650b694b254427cd9250c04500edd3; \>= 8f840e47f190cbe61a96945c13e9551048d42cef, \< 3006959371007fc2eae4a078f823c680fa52de1a; \>= 8f840e47f190cbe61a96945c13e9551048d42cef, \< 72e3fea68eac8d088e44c3dd954e843478e9240e; \>= 8f840e47f190cbe61a96945c13e9551048d42cef, \< 584307275b2048991b2e8984962189b6cc0a9b85; \>= 8f840e47f190cbe61a96945c13e9551048d42cef, \< c9119f243d9c0da3c3b5f577a328de3e7ffd1b42; \>= 8f840e47f190cbe61a96945c13e9551048d42cef, \< 2fe08fcaacb7eb019fa9c81db39b2214de216677; \>= 8f840e47f190cbe61a96945c13e9551048d42cef, \< 89eac1e150dbd42963e13d23828cb8c4e0763196; \>= 8f840e47f190cbe61a96945c13e9551048d42cef, \< 95aef86ab231f047bb8085c70666059b58f53c09 (cvelist)
- Linux: 4.7 (cvelist)

## Mitigation

- Upgrade Linux to 95aef86ab231f047bb8085c70666059b58f53c09 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2025-40331. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2025-40331.md
Affected: Linux >= 8f840e47f190cbe61a96945c13e9551048d42cef, < b106a68df0650b694b254427cd9250c04500edd3; >= 8f840e47f190cbe61a96945c13e9551048d42cef, < 3006959371007fc2eae4a078f823c680fa52de1a; >= 8f840e47f190cbe61a96945c13e9551048d42cef, < 72e3fea68eac8d088e44c3dd954e843478e9240e; >= 8f840e47f190cbe61a96945…
Fixed in: Linux 3006959371007fc2eae4a078f823c680fa52de1a, Linux 72e3fea68eac8d088e44c3dd954e843478e9240e, Linux 584307275b2048991b2e8984962189b6cc0a9b85, Linux 2fe08fcaacb7eb019fa9c81db39b2214de216677, Linux 89eac1e150dbd42963e13d23828cb8c4e0763196, Linux 95aef86ab231f047bb8085c70666059b58f53c09

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-2025-40331 being exploited?

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

### How serious is CVE-2025-40331?

High: CVSS 7.8 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed).

### Which versions are affected by CVE-2025-40331?

Linux \>= 8f840e47f190cbe61a96945c13e9551048d42cef, \< b106a68df0650b694b254427cd9250c04500edd3; \>= 8f840e47f190cbe61a96945c13e9551048d42cef, \< 3006959371007fc2eae4a078f823c680fa52de1a; \>= 8f840e47f190cbe61a96945c13e9551048d42cef, \< 72e3fea68eac8d088e44c3dd954e843478e9240e; \>= 8f840e47f190cbe61a96945c13e9551048d42cef, \< 584307275b2048991b2e8984962189b6cc0a9b85; \>= 8f840e47f190cbe61a96945c13e9551048d42cef, \< c9119f243d9c0da3c3b5f577a328de3e7ffd1b42; \>= 8f840e47f190cbe61a96945c13e9551048d42cef, \< 2fe08fcaacb7eb019fa9c81db39b2214de216677; \>= 8f840e47f190cbe61a96945c13e9551048d42cef, \< 89eac1e150dbd42963e13d23828cb8c4e0763196; \>= 8f840e47f190cbe61a96945c13e9551048d42cef, \< 95aef86ab231f047bb8085c70666059b58f53c09; Linux 4.7.

### Is there a fix for CVE-2025-40331?

Yes. Fixed in Linux 3006959371007fc2eae4a078f823c680fa52de1a, Linux 72e3fea68eac8d088e44c3dd954e843478e9240e, Linux 584307275b2048991b2e8984962189b6cc0a9b85, Linux 2fe08fcaacb7eb019fa9c81db39b2214de216677, Linux 89eac1e150dbd42963e13d23828cb8c4e0763196, Linux 95aef86ab231f047bb8085c70666059b58f53c09. Upgrade Linux to 95aef86ab231f047bb8085c70666059b58f53c09 or later.

### How do I check if I'm affected by CVE-2025-40331?

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

- other: <https://git.kernel.org/stable/c/b106a68df0650b694b254427cd9250c04500edd3>
- other: <https://git.kernel.org/stable/c/3006959371007fc2eae4a078f823c680fa52de1a>
- other: <https://git.kernel.org/stable/c/72e3fea68eac8d088e44c3dd954e843478e9240e>
- other: <https://git.kernel.org/stable/c/584307275b2048991b2e8984962189b6cc0a9b85>
- other: <https://git.kernel.org/stable/c/c9119f243d9c0da3c3b5f577a328de3e7ffd1b42>
- other: <https://git.kernel.org/stable/c/2fe08fcaacb7eb019fa9c81db39b2214de216677>
- other: <https://git.kernel.org/stable/c/89eac1e150dbd42963e13d23828cb8c4e0763196>
- other: <https://git.kernel.org/stable/c/95aef86ab231f047bb8085c70666059b58f53c09>

## 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-2025-40331>

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