{"id":"CVE-2025-40099","state":"PUBLISHED","title":"cifs: parse_dfs_referrals: prevent oob on malformed input","description":"In the Linux kernel, the following vulnerability has been resolved:\n\ncifs: parse_dfs_referrals: prevent oob on malformed input\n\nMalicious SMB server can send invalid reply to FSCTL_DFS_GET_REFERRALS\n\n- reply smaller than sizeof(struct get_dfs_referral_rsp)\n- reply with number of referrals smaller than NumberOfReferrals in the\nheader\n\nProcessing of such replies will cause oob.\n\nReturn -EINVAL error on such replies to prevent oob-s.","publishedAt":"2025-10-30T09:48:05.859Z","updatedAt":"2026-10-15T22:02:37.745Z","severity":{"score":9.4,"label":"Critical","version":"3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:H","source":"Linux"},"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"4ecce920e13ace16a5ba45efe8909946c28fb2ad","status":"affected","lessThan":"cfacc7441f760e4a73cc71b6ff1635261d534657","versionType":"git"},{"version":"4ecce920e13ace16a5ba45efe8909946c28fb2ad","status":"affected","lessThan":"15c73964da9df994302f579ed14ee5fdbce7a332","versionType":"git"},{"version":"4ecce920e13ace16a5ba45efe8909946c28fb2ad","status":"affected","lessThan":"8bc4a8d39bac23d8b044fd3e2dbfd965f1d9b058","versionType":"git"},{"version":"4ecce920e13ace16a5ba45efe8909946c28fb2ad","status":"affected","lessThan":"bb0f2e66e1ac043a5b238f5bcab4f26f3c317039","versionType":"git"},{"version":"4ecce920e13ace16a5ba45efe8909946c28fb2ad","status":"affected","lessThan":"6447b0e355562a1ff748c4a2ffb89aae7e84d2c9","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/smb/client/misc.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"4.11","status":"affected"},{"version":"0","status":"unaffected","lessThan":"4.11","versionType":"semver"},{"version":"6.1.158","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.6.114","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.55","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.17.5","status":"unaffected","lessThanOrEqual":"6.17.*","versionType":"semver"},{"version":"6.18","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/smb/client/misc.c"]}],"references":["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"],"weaknesses":[],"ingestedAt":"2026-10-29T20:09:09.358Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2025/40xxx/CVE-2025-40099.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2025-40099","state":"PUBLISHED","datePublished":"2025-10-30T09:48:05.859Z","dateUpdated":"2026-10-15T22:02:37.745Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2025-04-16T07:20:57.164Z"},"containers":{"cna":{"title":"cifs: parse_dfs_referrals: prevent oob on malformed input","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\ncifs: parse_dfs_referrals: prevent oob on malformed input\n\nMalicious SMB server can send invalid reply to FSCTL_DFS_GET_REFERRALS\n\n- reply smaller than sizeof(struct get_dfs_referral_rsp)\n- reply with number of referrals smaller than NumberOfReferrals in the\nheader\n\nProcessing of such replies will cause oob.\n\nReturn -EINVAL error on such replies to prevent oob-s."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"4ecce920e13ace16a5ba45efe8909946c28fb2ad","status":"affected","lessThan":"cfacc7441f760e4a73cc71b6ff1635261d534657","versionType":"git"},{"version":"4ecce920e13ace16a5ba45efe8909946c28fb2ad","status":"affected","lessThan":"15c73964da9df994302f579ed14ee5fdbce7a332","versionType":"git"},{"version":"4ecce920e13ace16a5ba45efe8909946c28fb2ad","status":"affected","lessThan":"8bc4a8d39bac23d8b044fd3e2dbfd965f1d9b058","versionType":"git"},{"version":"4ecce920e13ace16a5ba45efe8909946c28fb2ad","status":"affected","lessThan":"bb0f2e66e1ac043a5b238f5bcab4f26f3c317039","versionType":"git"},{"version":"4ecce920e13ace16a5ba45efe8909946c28fb2ad","status":"affected","lessThan":"6447b0e355562a1ff748c4a2ffb89aae7e84d2c9","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/smb/client/misc.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"4.11","status":"affected"},{"version":"0","status":"unaffected","lessThan":"4.11","versionType":"semver"},{"version":"6.1.158","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.6.114","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.55","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.17.5","status":"unaffected","lessThanOrEqual":"6.17.*","versionType":"semver"},{"version":"6.18","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/smb/client/misc.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/cfacc7441f760e4a73cc71b6ff1635261d534657"},{"url":"https://git.kernel.org/stable/c/15c73964da9df994302f579ed14ee5fdbce7a332"},{"url":"https://git.kernel.org/stable/c/8bc4a8d39bac23d8b044fd3e2dbfd965f1d9b058"},{"url":"https://git.kernel.org/stable/c/bb0f2e66e1ac043a5b238f5bcab4f26f3c317039"},{"url":"https://git.kernel.org/stable/c/6447b0e355562a1ff748c4a2ffb89aae7e84d2c9"}],"metrics":[{"cvssV3_1":{"version":"3.1","vectorString":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:H","baseScore":9.4,"baseSeverity":"CRITICAL"},"scenarios":[{"lang":"en","value":"AV:N - The vulnerable parser operates directly on a FSCTL_DFS_GET_REFERRALS reply received from a remote SMB server over TCP/445, with both the buffer length (`OutputCount`) and the referral count attacker-controlled. A malicious, compromised, or MITM'd server reaches this code purely over the network.\nAC:L - The server sends one well-formed V3 referral (so the in-bounds VersionNumber check passes) together with NumberOfReferrals=0xFFFF, and the loop deterministically walks ~2.2 MB past the allocation. No race, no heap grooming, no memory-layout dependency.\nPR:N - The attacker is the remote SMB peer and needs no credentials or account on the victim client; the client initiates the connection and parses the reply. A network MITM on an unsigned/unencrypted SMB session can inject the malformed referral response with no privileges at all.\nUI:N - On an existing DFS mount the `dfs_cache_refresh` delayed work re-issues referral requests on a timer and re-queues itself indefinitely, so a compromised or MITM'd server triggers the parse with zero user action; reconnect/failover paths do the same.\nS:U - The out-of-bounds access is confined to the kernel's own heap within the same security authority; no hypervisor, IOMMU, or sandbox boundary is crossed.\nC:H - Unbounded out-of-bounds read of up to ~2.2 MB of adjacent kernel heap, far beyond a \"few bytes\"; the harvested ServerType/ReferralEntryFlags/TimeToLive values are stored into DFS cache entries and exposed to any local user through world-readable (0644) /proc/fs/cifs/dfscache.\nI:L - There is no out-of-bounds write, but uncontrolled out-of-bounds heap contents are written into `dfs_info3_param` fields and propagated into the client's cached DFS referral state (ttl, srvtype, ref_flags), a limited corruption of kernel-side data that the fix explicitly prevents.\nA:H - The linear ~2.2 MB walk past a small kmalloc object can strike an unmapped page and oops the kernel — reliably so on small-memory embedded/IoT clients, hardened allocators, and KASAN builds — and each malicious reply additionally forces a ~3 MB kcalloc, repeatable on every automatic refresh."}]}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-08-05T12:07:48.660Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.11","versionEndExcluding":"6.1.158"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.11","versionEndExcluding":"6.6.114"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.11","versionEndExcluding":"6.12.55"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.11","versionEndExcluding":"6.17.5"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.11","versionEndExcluding":"6.18"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}},"adp":[{"title":"CISA ADP Vulnrichment","metrics":[{"other":{"type":"ssvc","content":{"id":"CVE-2025-40099","role":"CISA Coordinator","options":[{"Exploitation":"none"},{"Automatable":"yes"},{"Technical Impact":"partial"}],"version":"2.0.3","timestamp":"2026-10-15T21:56:50.620033Z"}}}],"providerMetadata":{"shortName":"CISA-ADP","orgId":"134c704f-9b21-4f2e-91b3-4a467353bcc0","dateUpdated":"2026-10-15T22:02:37.745Z"}}]}}}