Linux: Incorrect Calculation of Buffer Size
CVE-2026-31478 is a critical-severity incorrect calculation of buffer size vulnerability in Linux, with a CVSS 3.1 base score of 9.8 out of 10. It can be exploited remotely over the network by an unauthenticated attacker, without any action from a user. The record lists versions 70b4c414889492c522b6e4331562360f49be2361, 9a7166f0ef8cbb7bb48dd05e2471d995566003f5, c3a89e3ec1ccf64fa6a34e391e1581ebbcba8683 as the first without the flaw, so updating Linux to one of those releases or later removes the exposure. There is no confirmed exploitation so far. EPSS estimates a 0.5% chance of exploitation within 30 days, which is low compared with other CVEs.
Critical severity: a successful attack would have severe impact.
What to do
- Update Linux to 70b4c414889492c522b6e4331562360f49be2361 or 9a7166f0ef8cbb7bb48dd05e2471d995566003f5 or c3a89e3ec1ccf64fa6a34e391e1581ebbcba8683 or 6aef1765d6807e0f027cd87f6ac973eb0879a46d, whichever matches your release line, or a later version.
- Update Linux Kernel to 5.15.203 or 6.1.168 or 6.6.131 or 6.12.80, whichever matches your release line, or a later version.
- Until you can update, restrict network access to the affected service so it is not reachable from untrusted networks.
Affected products and versions
| Vendor | Product | Affected versions | Fixed in |
|---|---|---|---|
| Linux | Linux | f2283680a80571ca82d710bc6ecd8f8beac67d63 up to, but not including, 70b4c414889492c522b6e4331562360f49be2361; 9f297df20d93411c0b4ddad7f88ba04a7cd36e77 up to, but not including, 9a7166f0ef8cbb7bb48dd05e2471d995566003f5; e2b76ab8b5c9327ab2dae6da05d0752eb2f4771d up to, but not including, c3a89e3ec1ccf64fa6a34e391e1581ebbcba8683; e2b76ab8b5c9327ab2dae6da05d0752eb2f4771d up to, but not including, 6aef1765d6807e0f027cd87f6ac973eb0879a46d; e2b76ab8b5c9327ab2dae6da05d0752eb2f4771d up to, but not including, 80824c7e527b70cf9039534e60aff592e8f209d1; e2b76ab8b5c9327ab2dae6da05d0752eb2f4771d up to, but not including, 4cb537ae4f37d7d0f617815ed4bed7173fb50861; e2b76ab8b5c9327ab2dae6da05d0752eb2f4771d up to, but not including, 0e55f63dd08f09651d39e1b709a91705a8a0ddcb; 5.15.145 up to, but not including, 5.15.203; and 2 more ranges | 70b4c414889492c522b6e4331562360f49be2361, 9a7166f0ef8cbb7bb48dd05e2471d995566003f5, c3a89e3ec1ccf64fa6a34e391e1581ebbcba8683, 6aef1765d6807e0f027cd87f6ac973eb0879a46d, 80824c7e527b70cf9039534e60aff592e8f209d1, 4cb537ae4f37d7d0f617815ed4bed7173fb50861 |
| Linux | Linux Kernel | 5.15.145 up to, but not including, 5.15.203; 6.1.71 up to, but not including, 6.1.168; 6.6.1 up to, but not including, 6.6.131; 6.7 up to, but not including, 6.12.80; 6.13 up to, but not including, 6.18.21; 6.19 up to, but not including, 6.19.11; 6.6; 7.0 | 5.15.203, 6.1.168, 6.6.131, 6.12.80, 6.18.21, 6.19.11 |
Version data comes from the organisation that assigned the CVE. Confirm against the vendor advisory before deciding you are unaffected.
How the severity score breaks down
- Attack vector
- NetworkCan be exploited remotely over a network, including the internet.
- Attack complexity
- LowNo special conditions are needed; the attack works reliably.
- Privileges required
- NoneNo account or login is needed.
- User interaction
- NoneNo action by a victim is required.
- Scope
- UnchangedImpact stays within the vulnerable component.
- Confidentiality
- HighAll data handled by the component can be read.
- Integrity
- HighData or code can be modified at will.
- Availability
- HighThe component can be taken down completely.
Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H. Scored by CNA.
Official description
In the Linux kernel, the following vulnerability has been resolved: ksmbd: replace hardcoded hdr2_len with offsetof() in smb2_calc_max_out_buf_len() After this commit (e2b76ab8b5c9 "ksmbd: add support for read compound"), response buffer management was changed to use dynamic iov array. In the new design, smb2_calc_max_out_buf_len() expects the second argument (hdr2_len) to be the offset of ->Buffer field in the response structure, not a hardcoded magic number. Fix the remaining call sites to use the correct offsetof() value.
Source: the CVE record as published by its numbering authority, via NVD and CVE.org.
The underlying weakness: Incorrect Calculation of Buffer Size
The product does not correctly calculate the size to be used when allocating a buffer.
How developers prevent this class of flaw
- When allocating a buffer for the purpose of transforming, converting, or encoding an input, allocate enough memory to handle the largest possible encoding. For example, in a routine that converts & characters to & for HTML entity encoding, the output buffer needs to be at least 5 times as large as the input buffer.
- Understand the programming language's underlying representation and how it interacts with numeric calculation (CWE-681). Pay close attention to byte size discrepancies, precision, signed/unsigned distinctions, truncation, conversion and casting between types, not-a-number calculations, and how the language handles numbers that are too large or too small for its underlying representation. Also be careful to account for 32-bit, 64-bit, and other potential differences that may affect the numeric representation.
- Perform input validation on any numeric input by ensuring that it is within the expected range. Enforce that the input meets both the minimum and maximum requirements for the expected range.
More Incorrect Calculation of Buffer Size vulnerabilities (CWE-131)
Timeline
- CVE record published.
- CISA published its SSVC assessment (exploitation: none, automatable: yes, technical impact: total).
- Record last changed materially (score, affected products, status or references).
References
Patches and release notes
- git.kernel.org/stable/c/0e55f63dd08f09651d39e1b709a91705a8a0ddcb
- git.kernel.org/stable/c/4cb537ae4f37d7d0f617815ed4bed7173fb50861
- git.kernel.org/stable/c/6aef1765d6807e0f027cd87f6ac973eb0879a46d
- git.kernel.org/stable/c/70b4c414889492c522b6e4331562360f49be2361
- git.kernel.org/stable/c/80824c7e527b70cf9039534e60aff592e8f209d1
- git.kernel.org/stable/c/9a7166f0ef8cbb7bb48dd05e2471d995566003f5
- git.kernel.org/stable/c/c3a89e3ec1ccf64fa6a34e391e1581ebbcba8683
Recent Incorrect Calculation of Buffer Size vulnerabilities
- 7.5 High severity
- 9.8 Critical severity
- 7.7 High severity
- 7.8 High severity
- 8.4 High severity
- 9.8 Critical severity
Spotted an error? Tell us.