CVE-2025-40099: cifs: parse_dfs_referrals: prevent oob on malformed input
From: Greg Kroah-Hartman <[email protected]>
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
cifs: parse_dfs_referrals: prevent oob on malformed input
Malicious SMB server can send invalid reply to FSCTL_DFS_GET_REFERRALS
- reply smaller than sizeof(struct get_dfs_referral_rsp)
- reply with number of referrals smaller than NumberOfReferrals in the header
Processing of such replies will cause oob.
Return -EINVAL error on such replies to prevent oob-s.
The Linux kernel CVE team has assigned CVE-2025-40099 to this issue.
Affected and fixed versions
===========================
Fixed in 6.1.158 with commit cfacc7441f760e4a73cc71b6ff1635261d534657 Fixed in 6.6.114 with commit 15c73964da9df994302f579ed14ee5fdbce7a332 Fixed in 6.12.55 with commit 8bc4a8d39bac23d8b044fd3e2dbfd965f1d9b058 Fixed in 6.17.5 with commit bb0f2e66e1ac043a5b238f5bcab4f26f3c317039 Fixed in 6.18-rc2 with commit 6447b0e355562a1ff748c4a2ffb89aae7e84d2c9
Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.
Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at
https://cve.org/CVERecord/?id=CVE-2025-40099
will be updated if fixes are backported, please check that for the most up to date information about this issue.
Affected files
==============
The file(s) affected by this issue are:
fs/smb/client/misc.c
Mitigation
==========
The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:
https://git.kernel.org/stable/c/cfacc7441f760e4a73cc71b6ff1635261d534657 https://git.kernel.org/stable/c/15c73964da9df994302f579ed14ee5fdbce7a332 https://git.kernel.org/stable/c/8bc4a8d39bac23d8b044fd3e2dbfd965f1d9b058 https://git.kernel.org/stable/c/bb0f2e66e1ac043a5b238f5bcab4f26f3c317039 https://git.kernel.org/stable/c/6447b0e355562a1ff748c4a2ffb89aae7e84d2c9