{"id":"CVE-2025-21945","state":"PUBLISHED","title":"ksmbd: fix use-after-free in smb2_lock","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nksmbd: fix use-after-free in smb2_lock\n\nIf smb_lock->zero_len has value, ->llist of smb_lock is not delete and\nflock is old one. It will cause use-after-free on error handling\nroutine.","publishedAt":"2025-04-01T15:41:08.471Z","updatedAt":"2026-08-05T11:55:30.419Z","severity":{"score":8.8,"label":"High","version":"3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","source":"Linux"},"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"0626e6641f6b467447c81dd7678a69c66f7746cf","status":"affected","lessThan":"410ce35a2ed6d0e114132bba29af49b69880c8c7","versionType":"git"},{"version":"0626e6641f6b467447c81dd7678a69c66f7746cf","status":"affected","lessThan":"8573571060ca466cbef2c6f03306b2cc7b883506","versionType":"git"},{"version":"0626e6641f6b467447c81dd7678a69c66f7746cf","status":"affected","lessThan":"a0609097fd10d618aed4864038393dd75131289e","versionType":"git"},{"version":"0626e6641f6b467447c81dd7678a69c66f7746cf","status":"affected","lessThan":"636e021646cf9b52ddfea7c809b018e91f2188cb","versionType":"git"},{"version":"0626e6641f6b467447c81dd7678a69c66f7746cf","status":"affected","lessThan":"84d2d1641b71dec326e8736a749b7ee76a9599fc","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/smb/server/smb2pdu.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.131","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.6.83","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.19","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.13.7","status":"unaffected","lessThanOrEqual":"6.13.*","versionType":"semver"},{"version":"6.14","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/smb2pdu.c"]}],"references":["https://git.kernel.org/stable/c/410ce35a2ed6d0e114132bba29af49b69880c8c7","https://git.kernel.org/stable/c/8573571060ca466cbef2c6f03306b2cc7b883506","https://git.kernel.org/stable/c/a0609097fd10d618aed4864038393dd75131289e","https://git.kernel.org/stable/c/636e021646cf9b52ddfea7c809b018e91f2188cb","https://git.kernel.org/stable/c/84d2d1641b71dec326e8736a749b7ee76a9599fc","https://lists.debian.org/debian-lts-announce/2025/05/msg00045.html"],"weaknesses":["CWE-416"],"ingestedAt":"2026-10-29T20:08:39.238Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2025/21xxx/CVE-2025-21945.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2025-21945","state":"PUBLISHED","datePublished":"2025-04-01T15:41:08.471Z","dateUpdated":"2026-08-05T11:55:30.419Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2024-12-29T08:45:45.790Z"},"containers":{"cna":{"title":"ksmbd: fix use-after-free in smb2_lock","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nksmbd: fix use-after-free in smb2_lock\n\nIf smb_lock->zero_len has value, ->llist of smb_lock is not delete and\nflock is old one. It will cause use-after-free on error handling\nroutine."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"0626e6641f6b467447c81dd7678a69c66f7746cf","status":"affected","lessThan":"410ce35a2ed6d0e114132bba29af49b69880c8c7","versionType":"git"},{"version":"0626e6641f6b467447c81dd7678a69c66f7746cf","status":"affected","lessThan":"8573571060ca466cbef2c6f03306b2cc7b883506","versionType":"git"},{"version":"0626e6641f6b467447c81dd7678a69c66f7746cf","status":"affected","lessThan":"a0609097fd10d618aed4864038393dd75131289e","versionType":"git"},{"version":"0626e6641f6b467447c81dd7678a69c66f7746cf","status":"affected","lessThan":"636e021646cf9b52ddfea7c809b018e91f2188cb","versionType":"git"},{"version":"0626e6641f6b467447c81dd7678a69c66f7746cf","status":"affected","lessThan":"84d2d1641b71dec326e8736a749b7ee76a9599fc","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/smb/server/smb2pdu.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.131","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.6.83","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.19","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.13.7","status":"unaffected","lessThanOrEqual":"6.13.*","versionType":"semver"},{"version":"6.14","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/smb2pdu.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/410ce35a2ed6d0e114132bba29af49b69880c8c7"},{"url":"https://git.kernel.org/stable/c/8573571060ca466cbef2c6f03306b2cc7b883506"},{"url":"https://git.kernel.org/stable/c/a0609097fd10d618aed4864038393dd75131289e"},{"url":"https://git.kernel.org/stable/c/636e021646cf9b52ddfea7c809b018e91f2188cb"},{"url":"https://git.kernel.org/stable/c/84d2d1641b71dec326e8736a749b7ee76a9599fc"}],"metrics":[{"cvssV3_1":{"version":"3.1","vectorString":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","baseScore":8.8,"baseSeverity":"HIGH"},"scenarios":[{"lang":"en","value":"AV:N - ksmbd is the in-kernel SMB server listening on TCP/445, and the entire bug is triggered by a single crafted SMB2 LOCK PDU whose lock elements carry Length==0 and attacker-chosen flags. No local access to the target is needed.\nAC:L - The zero_len path is taken deterministically whenever the client sets a lock element's Length to 0, and the stale `flock`/`flags` reuse and skipped `list_del` follow unconditionally; there is no race and the attacker can repeat the request indefinitely to groom the heap.\nPR:L - SMB2_LOCK is gated by smb2_check_user_session() and requires an open file handle from ksmbd_lookup_fd_slow(), so the attacker needs valid credentials for an exported share — an ordinary low-privileged SMB account, not administrative rights.\nUI:N - The attacker drives the whole sequence (session setup, tree connect, create, lock) from its own connection; no action by any local user or administrator is required.\nS:U - The corruption is confined to kernel heap objects managed by the SMB server and the VFS lock layer, within the same security authority; no VM, IOMMU, or sandbox boundary is crossed.\nC:H - The freed ksmbd_lock stays linked in lock_list and in the global per-connection lock_list, and the stale file_lock is re-read by vfs_lock_file() and by other connections' conflict scans, so reclaimed heap contents are dereferenced and can be leveraged to disclose kernel memory.\nI:H - The dangling entries produce a double-free plus list_del writes through attacker-groomable freed slab objects, giving the write primitives needed to corrupt adjacent kernel structures and hijack control flow.\nA:H - Use of freed ksmbd_lock/file_lock memory and the resulting double-free and corrupted list traversals reliably oops or panic the kernel, taking down the whole file server."}]}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-08-05T11:55:30.419Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.15","versionEndExcluding":"6.1.131"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.15","versionEndExcluding":"6.6.83"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.15","versionEndExcluding":"6.12.19"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.15","versionEndExcluding":"6.13.7"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.15","versionEndExcluding":"6.14"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}},"adp":[{"title":"CISA ADP Vulnrichment","metrics":[{"cvssV3_1":{"scope":"UNCHANGED","version":"3.1","baseScore":7.8,"attackVector":"LOCAL","baseSeverity":"HIGH","vectorString":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","integrityImpact":"HIGH","userInteraction":"NONE","attackComplexity":"LOW","availabilityImpact":"HIGH","privilegesRequired":"LOW","confidentialityImpact":"HIGH"}},{"other":{"type":"ssvc","content":{"id":"CVE-2025-21945","role":"CISA Coordinator","options":[{"Exploitation":"none"},{"Automatable":"no"},{"Technical Impact":"total"}],"version":"2.0.3","timestamp":"2025-04-16T13:14:55.516245Z"}}}],"problemTypes":[{"descriptions":[{"cweId":"CWE-416","lang":"en","type":"CWE","description":"CWE-416 Use After Free"}]}],"providerMetadata":{"shortName":"CISA-ADP","orgId":"134c704f-9b21-4f2e-91b3-4a467353bcc0","dateUpdated":"2025-04-16T13:19:52.605Z"}},{"title":"CVE Program Container","references":[{"url":"https://lists.debian.org/debian-lts-announce/2025/05/msg00045.html"}],"providerMetadata":{"shortName":"CVE","orgId":"af854a3a-2127-422b-91ae-364da2661108","dateUpdated":"2025-11-03T19:39:45.983Z"}}]}}}