{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2024-58087","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","state":"PUBLISHED","assignerShortName":"Linux","dateReserved":"2025-03-06T15:52:09.185Z","datePublished":"2025-03-12T07:28:09.114Z","dateUpdated":"2026-08-05T11:47:38.424Z"},"containers":{"cna":{"providerMetadata":{"orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","shortName":"Linux","dateUpdated":"2026-08-05T11:47:38.424Z"},"descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nksmbd: fix racy issue from session lookup and expire\n\nIncrement the session reference count within the lock for lookup to avoid\nracy issue with session expire."}],"metrics":[{"cvssV3_1":{"version":"3.1","vectorString":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","baseScore":9.8,"baseSeverity":"CRITICAL"},"scenarios":[{"lang":"en","value":"AV:N - ksmbd is the in-kernel SMB server processing requests received on TCP port 445; every affected path (`smb2_sess_setup`, `smb2_check_user_session`, `smb3_decrypt_req`, `__handle_ksmbd_work`) is driven directly by attacker-supplied SMB2 PDUs from a remote peer.\nAC:L - The attacker controls both sides of the race — it pipelines up to 8192 concurrent requests per connection (each handled by a separate ksmbd-io kworker), drives sessions into EXPIRED/IN_PROGRESS state so `ksmbd_expire_session()` frees them with no timeout, and the `__handle_ksmbd_work` window spans an entire AES-GCM response encryption. A lost race yields only a benign SMB error, so it can be retried indefinitely.\nPR:N - Two of the three unreferenced lookups live inside `smb2_sess_setup()` — the authentication handshake itself — and operate on attacker-supplied, sequentially-allocated (trivially enumerable) session IDs before any credential is verified, including `ksmbd_session_lookup_slowpath()` against the global session table. Additionally, `ntlm_authenticate()` skips password verification entirely for guest/anonymous users, so under the common \"map to guest\" configuration an unauthenticated peer obtains a VALID session and reaches all remaining paths.\nUI:N - Exploitation requires only that the attacker send SMB2 requests to the listening ksmbd service; no action by any local user or administrator is involved.\nS:U - The use-after-free corrupts kernel heap memory within the kernel's own security authority; no VM, IOMMU, or sandbox boundary is crossed.\nC:H - The freed `struct ksmbd_session` is read after free, including `smb3encryptionkey`/`smb3decryptionkey`/`smb3signingkey` — `encrypt_resp()` encrypts responses using whatever now occupies that slab, leaking freed kernel memory to the wire; controlling the reallocated `sess->user` and `file_table` pointers escalates this to arbitrary kernel read.\nI:H - The bug yields multiple write primitives on freed memory — `atomic_inc/dec` on `sess->refcnt`, `sess->state = SMB2_SESSION_EXPIRED`, `sess->user = NULL`, and `kfree(sess->Preauth_HashValue)` plus xarray-walking frees in `ksmbd_session_destroy()` — giving arbitrary-free and controlled-pointer corruption suitable for control-flow hijack, and `sess->user` directly governs SMB access-control decisions.\nA:H - Any lost race dereferences freed slab memory, reliably producing a kernel oops or panic in the ksmbd worker, and the attacker can trigger it repeatedly from the network to take down the file server."}]}],"affected":[{"product":"Linux","vendor":"Linux","defaultStatus":"unaffected","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/smb/server/auth.c","fs/smb/server/mgmt/user_session.c","fs/smb/server/server.c","fs/smb/server/smb2pdu.c"],"versions":[{"version":"0626e6641f6b467447c81dd7678a69c66f7746cf","lessThan":"2107ab40629aeabbec369cf34b8cf0f288c3eb1b","status":"affected","versionType":"git"},{"version":"0626e6641f6b467447c81dd7678a69c66f7746cf","lessThan":"37a0e2b362b3150317fb6e2139de67b1e29ae5ff","status":"affected","versionType":"git"},{"version":"0626e6641f6b467447c81dd7678a69c66f7746cf","lessThan":"450a844c045ff0895d41b05a1cbe8febd1acfcfd","status":"affected","versionType":"git"},{"version":"0626e6641f6b467447c81dd7678a69c66f7746cf","lessThan":"a39e31e22a535d47b14656a7d6a893c7f6cf758c","status":"affected","versionType":"git"},{"version":"0626e6641f6b467447c81dd7678a69c66f7746cf","lessThan":"b95629435b84b9ecc0c765995204a4d8a913ed52","status":"affected","versionType":"git"}]},{"product":"Linux","vendor":"Linux","defaultStatus":"affected","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/smb/server/auth.c","fs/smb/server/mgmt/user_session.c","fs/smb/server/server.c","fs/smb/server/smb2pdu.c"],"versions":[{"version":"5.15","status":"affected"},{"version":"0","lessThan":"5.15","status":"unaffected","versionType":"semver"},{"version":"5.15.176","lessThanOrEqual":"5.15.*","status":"unaffected","versionType":"semver"},{"version":"6.1.121","lessThanOrEqual":"6.1.*","status":"unaffected","versionType":"semver"},{"version":"6.6.67","lessThanOrEqual":"6.6.*","status":"unaffected","versionType":"semver"},{"version":"6.12.6","lessThanOrEqual":"6.12.*","status":"unaffected","versionType":"semver"},{"version":"6.13","lessThanOrEqual":"*","status":"unaffected","versionType":"original_commit_for_fix"}]}],"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.15","versionEndExcluding":"5.15.176"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.15","versionEndExcluding":"6.1.121"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.15","versionEndExcluding":"6.6.67"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.15","versionEndExcluding":"6.12.6"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.15","versionEndExcluding":"6.13"}]}]}],"references":[{"url":"https://git.kernel.org/stable/c/2107ab40629aeabbec369cf34b8cf0f288c3eb1b"},{"url":"https://git.kernel.org/stable/c/37a0e2b362b3150317fb6e2139de67b1e29ae5ff"},{"url":"https://git.kernel.org/stable/c/450a844c045ff0895d41b05a1cbe8febd1acfcfd"},{"url":"https://git.kernel.org/stable/c/a39e31e22a535d47b14656a7d6a893c7f6cf758c"},{"url":"https://git.kernel.org/stable/c/b95629435b84b9ecc0c765995204a4d8a913ed52"},{"url":"https://www.zerodayinitiative.com/advisories/ZDI-25-100/"}],"title":"ksmbd: fix racy issue from session lookup and expire","x_generator":{"engine":"bippy-1.2.0"}},"adp":[{"metrics":[{"cvssV3_1":{"scope":"UNCHANGED","version":"3.1","baseScore":8.1,"attackVector":"NETWORK","baseSeverity":"HIGH","vectorString":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H","integrityImpact":"HIGH","userInteraction":"NONE","attackComplexity":"HIGH","availabilityImpact":"HIGH","privilegesRequired":"NONE","confidentialityImpact":"HIGH"}},{"other":{"type":"ssvc","content":{"id":"CVE-2024-58087","role":"CISA Coordinator","options":[{"Exploitation":"none"},{"Automatable":"no"},{"Technical Impact":"total"}],"version":"2.0.3","timestamp":"2025-10-01T19:26:55.319254Z"}}}],"problemTypes":[{"descriptions":[{"lang":"en","type":"CWE","cweId":"CWE-667","description":"CWE-667 Improper Locking"}]}],"title":"CISA ADP Vulnrichment","providerMetadata":{"orgId":"134c704f-9b21-4f2e-91b3-4a467353bcc0","shortName":"CISA-ADP","dateUpdated":"2025-10-01T19:36:35.134Z"}}]}}