{"id":"CVE-2025-40084","state":"PUBLISHED","title":"ksmbd: transport_ipc: validate payload size before reading handle","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nksmbd: transport_ipc: validate payload size before reading handle\n\nhandle_response() dereferences the payload as a 4-byte handle without\nverifying that the declared payload size is at least 4 bytes. A malformed\nor truncated message from ksmbd.mountd can lead to a 4-byte read past the\ndeclared payload size. Validate the size before dereferencing.\n\nThis is a minimal fix to guard the initial handle read.","publishedAt":"2025-10-29T13:37:03.185Z","updatedAt":"2026-08-05T12:07:38.947Z","severity":{"score":7.1,"label":"High","version":"3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:H","source":"Linux"},"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"0626e6641f6b467447c81dd7678a69c66f7746cf","status":"affected","lessThan":"a02e432d5130da4c723aabe1205bac805889fdb2","versionType":"git"},{"version":"0626e6641f6b467447c81dd7678a69c66f7746cf","status":"affected","lessThan":"2dc125f5da134c0915a840b62565c60a595673dd","versionType":"git"},{"version":"0626e6641f6b467447c81dd7678a69c66f7746cf","status":"affected","lessThan":"898d527ed94c19980a4d848f10057f1fed578ffb","versionType":"git"},{"version":"0626e6641f6b467447c81dd7678a69c66f7746cf","status":"affected","lessThan":"867ffd9d67285612da3f0498ca618297f8e41f01","versionType":"git"},{"version":"0626e6641f6b467447c81dd7678a69c66f7746cf","status":"affected","lessThan":"6f40e50ceb99fc8ef37e5c56e2ec1d162733fef0","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/smb/server/transport_ipc.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"5.15","status":"affected"},{"version":"0","status":"unaffected","lessThan":"5.15","versionType":"semver"},{"version":"6.1.158","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.6.115","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.56","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.17.6","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/server/transport_ipc.c"]}],"references":["https://git.kernel.org/stable/c/a02e432d5130da4c723aabe1205bac805889fdb2","https://git.kernel.org/stable/c/2dc125f5da134c0915a840b62565c60a595673dd","https://git.kernel.org/stable/c/898d527ed94c19980a4d848f10057f1fed578ffb","https://git.kernel.org/stable/c/867ffd9d67285612da3f0498ca618297f8e41f01","https://git.kernel.org/stable/c/6f40e50ceb99fc8ef37e5c56e2ec1d162733fef0"],"weaknesses":[],"ingestedAt":"2026-10-29T20:09:09.358Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2025/40xxx/CVE-2025-40084.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2025-40084","state":"PUBLISHED","datePublished":"2025-10-29T13:37:03.185Z","dateUpdated":"2026-08-05T12:07:38.947Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2025-04-16T07:20:57.161Z"},"containers":{"cna":{"title":"ksmbd: transport_ipc: validate payload size before reading handle","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nksmbd: transport_ipc: validate payload size before reading handle\n\nhandle_response() dereferences the payload as a 4-byte handle without\nverifying that the declared payload size is at least 4 bytes. A malformed\nor truncated message from ksmbd.mountd can lead to a 4-byte read past the\ndeclared payload size. Validate the size before dereferencing.\n\nThis is a minimal fix to guard the initial handle read."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"0626e6641f6b467447c81dd7678a69c66f7746cf","status":"affected","lessThan":"a02e432d5130da4c723aabe1205bac805889fdb2","versionType":"git"},{"version":"0626e6641f6b467447c81dd7678a69c66f7746cf","status":"affected","lessThan":"2dc125f5da134c0915a840b62565c60a595673dd","versionType":"git"},{"version":"0626e6641f6b467447c81dd7678a69c66f7746cf","status":"affected","lessThan":"898d527ed94c19980a4d848f10057f1fed578ffb","versionType":"git"},{"version":"0626e6641f6b467447c81dd7678a69c66f7746cf","status":"affected","lessThan":"867ffd9d67285612da3f0498ca618297f8e41f01","versionType":"git"},{"version":"0626e6641f6b467447c81dd7678a69c66f7746cf","status":"affected","lessThan":"6f40e50ceb99fc8ef37e5c56e2ec1d162733fef0","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/smb/server/transport_ipc.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"5.15","status":"affected"},{"version":"0","status":"unaffected","lessThan":"5.15","versionType":"semver"},{"version":"6.1.158","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.6.115","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.56","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.17.6","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/server/transport_ipc.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/a02e432d5130da4c723aabe1205bac805889fdb2"},{"url":"https://git.kernel.org/stable/c/2dc125f5da134c0915a840b62565c60a595673dd"},{"url":"https://git.kernel.org/stable/c/898d527ed94c19980a4d848f10057f1fed578ffb"},{"url":"https://git.kernel.org/stable/c/867ffd9d67285612da3f0498ca618297f8e41f01"},{"url":"https://git.kernel.org/stable/c/6f40e50ceb99fc8ef37e5c56e2ec1d162733fef0"}],"metrics":[{"cvssV3_1":{"version":"3.1","vectorString":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:H","baseScore":7.1,"baseSeverity":"HIGH"},"scenarios":[{"lang":"en","value":"AV:L - The vulnerable code is reached only via a generic netlink message to the `SMBD_GENL` family (`handle_generic_event` → `handle_response`), which requires a local socket on the machine; a remote SMB client on TCP/445 cannot inject IPC responses.\nAC:L - The attacker fully controls the crafted netlink message — a zero-length `KSMBD_EVENT_RPC_RESPONSE`/`SPNEGO_AUTHEN_RESPONSE` attribute followed by a chosen nlattr header supplies both the undersized `sz` and the out-of-bounds \"handle\" value, and IDA-allocated handles are small and brute-forceable.\nPR:L - The `netlink_capable(CAP_NET_ADMIN)` gate exists only when `CONFIG_SMB_SERVER_CHECK_CAP_NET_ADMIN` is set, and builds that disable it let any unprivileged local user open a `NETLINK_GENERIC` socket and send the message; there is also no check binding the sender to the registered `ksmbd_tools_pid`.\nUI:N - The attacker sends the malformed netlink message directly; no victim action is needed beyond ksmbd already running, which is the normal state on an SMB server.\nS:U - The out-of-bounds read and the resulting fault stay within the kernel's own security authority, with no crossing of a VM, IOMMU, or sandbox boundary.\nC:H - The unchecked deref reads 4 bytes past the declared payload, and the undersized response it admits causes `ipc_validate_msg()` and the SPNEGO/RPC consumers to read fields beyond a tiny slab allocation, whose contents can be reflected back toward the SMB client.\nI:N - The `memcpy(entry->response, payload, sz)` is bounded by the same `sz` used for the allocation, so the bug yields no out-of-bounds write or other data-modification primitive.\nA:H - A zero-length payload makes `kvzalloc(0)` return `ZERO_SIZE_PTR`, which passes the non-NULL check and is then dereferenced in `ipc_validate_msg()`, producing a kernel oops that is repeatable at will."}]}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-08-05T12:07:38.947Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.15","versionEndExcluding":"6.1.158"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.15","versionEndExcluding":"6.6.115"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.15","versionEndExcluding":"6.12.56"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.15","versionEndExcluding":"6.17.6"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.15","versionEndExcluding":"6.18"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}