CVE-2026-31718: ksmbd: fix use-after-free in __ksmbd_close_fd() via durable scavenger
In the Linux kernel, the following vulnerability has been resolved:
ksmbd: fix use-after-free in __ksmbd_close_fd() via durable scavenger
When a durable file handle survives session disconnect (TCP close without
SMB2_LOGOFF), session_fd_check() sets fp->conn = NULL to preserve the
handle for later reconnection. However, it did not clean up the byte-range
locks on fp->lock_list.
Later, when the durable scavenger thread times out and calls
__ksmbd_close_fd(NULL, fp), the lock cleanup loop did:
spin_lock(&fp->conn->llist_lock);
This caused a slab use-after-free because fp->conn was NULL and the
original connection object had already been freed by
ksmbd_tcp_disconnect().
The root cause is asymmetric cleanup: lock entries (smb_lock->clist) were
left dangling on the freed conn->lock_list while fp->conn was nulled out.
To fix this issue properly, we need to handle the lifetime of
smb_lock->clist across three paths:
- Safely skip clist deletion when list is empty and fp->conn is NULL.
- Remove the lock from the old connection's lock_list in
session_fd_check()
- Re-add the lock to the new connection's lock_list in
ksmbd_reopen_durable_fd().
Security readout for executives and security teams
Plain-English summary
A flaw in Linux’s in-kernel SMB server, ksmbd, can access invalid memory after a durable file handle survives an abrupt connection loss. The supplied CVSS rating is 9.8 because network access without authentication may expose confidentiality, integrity, and availability. The sources do not demonstrate those impacts or successful code execution.
Executive priority
Prioritize immediate inventory and expedited patching of reachable ksmbd servers. The critical rating and unauthenticated network vector justify urgency, although active exploitation is not established. Systems not running ksmbd are unlikely to expose this code path; confirm service usage before escalating broad Linux fleet remediation.
Technical view
An SMB connection can be freed while durable-handle byte-range locks still reference its lock list. When the scavenger later closes the timed-out handle, cleanup dereferences the cleared or freed connection, causing a use-after-free. The upstream fix makes lock-list cleanup safe and transfers lock entries correctly during durable-handle preservation and reconnection.
Likely exposure
Exposure concerns Linux systems running the ksmbd SMB server, particularly when reachable clients can create durable handles and disconnect without SMB2_LOGOFF. The bundle lists several affected kernel identifiers, but does not provide reliable distribution-specific boundaries. Backported fixes mean kernel version strings alone may not establish vulnerability.
Exploitation context
The supplied record assigns network reachability, low complexity, no privileges, and no user interaction. However, it is not in KEV, and none of the supplied sources reports active exploitation or a public working exploit. Treat the CVSS impact as assessed potential, not evidence that every impact has been demonstrated.
Researcher notes
The failure requires durable-handle preservation, retained byte-range locks, connection teardown, and later scavenger cleanup. Review all three corrected lifetime paths: safe deletion with no connection, removal from the old connection during session cleanup, and reattachment after durable reconnection. Supplied data is insufficient to determine exploit reliability or exact distribution package ranges.
Mitigation direction
Follow Linux distributor guidance and install a stable kernel containing the applicable upstream fix.
Until patched, disable ksmbd where it is unnecessary or restrict SMB access to trusted networks.
Treat network restrictions as compensating controls, not confirmed prevention of exploitation.
Prioritize internet-reachable or broadly accessible ksmbd servers for remediation.
Validation and detection
Identify systems where ksmbd is active and record their running kernel builds.
Compare each build with distributor advisories and the applicable upstream stable fix commit.
Confirm SMB exposure is limited to intended networks while remediation remains pending.
After updating, verify the installed kernel contains the applicable fix or documented backport.
Monitor kernel logs and crash telemetry for ksmbd memory faults after abrupt SMB disconnections.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cve · low confidence lookup
CVE-2026-31718 mapping review
Open the CVE-to-ATT&CK bridge for reviewed, inferred, or future official mappings tied to this CVE.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
1CVSS vectors
3Timeline events
0ADP providers
6Source links
CVSS vector scores
1 official score
We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.