CVE-2026-31613: smb: client: fix OOB reads parsing symlink error response
In the Linux kernel, the following vulnerability has been resolved:
smb: client: fix OOB reads parsing symlink error response
When a CREATE returns STATUSSTOPPEDONSYMLINK, smb2checkmessage() returns success without any length validation, leaving the symlink parsers as the only defense against an untrusted server.
symlinkdata() walks SMB 3.1.1 error contexts with the loop test "p < end", but reads p->ErrorId at offset 4 and p->ErrorDataLength at offset 0. When the server-controlled ErrorDataLength advances p to within 1-7 bytes of end, the next iteration will read past it. When the matching context is found, sym->SymLinkErrorTag is read at offset 4 from p->ErrorContextData with no check that the symlink header itself fits.
smb2parsesymlinkresponse() then bounds-checks the substitute name using SMB2SYMLINKSTRUCTSIZE as the offset of PathBuffer from iovbase. That value is computed as sizeof(smb2errrsp) + sizeof(smb2symlinkerrrsp), which is correct only when ErrorContextCount == 0.
With at least one error context the symlink data sits 8 bytes deeper, and each skipped non-matching context shifts it further by 8 + ALIGN(ErrorDataLength, 8). The check is too short, allowing the substitute name read to run past iovlen. The out-of-bound heap bytes are UTF-16-decoded into the symlink target and returned to userspace via readlink(2).
Fix this all up by making the loops test require the full context header to fit, rejecting sym if its header runs past end, and bound the substitute name against the actual position of sym->PathBuffer rather than a fixed offset.
Because suboffs and sublen are 16bits, the pointer math will not overflow here with the new greater-than.
Affected Software
Event History
Frequently Asked Questions
What is the severity of CVE-2026-31613?
CVE-2026-31613 is classified as a high severity vulnerability due to the potential for out-of-bounds reads.
How do I fix CVE-2026-31613?
To fix CVE-2026-31613, update the Linux kernel to a version that is not affected, ideally to the latest stable release.
What impact does CVE-2026-31613 have on system security?
CVE-2026-31613 can lead to information disclosure or arbitrary code execution due to improper error handling in the SMB client.
Which versions of the Linux kernel are affected by CVE-2026-31613?
CVE-2026-31613 affects Linux kernel versions between 6.1 and 6.18.24, as well as 6.19 and 7.0.1.
Is there a workaround for CVE-2026-31613?
There is no official workaround for CVE-2026-31613 other than updating to a patched version of the Linux kernel.