data built 2026-10-19T13:16:53Z

Look up another CVE · open CVE-2025-40328 in the interactive tracker

CVE-2025-40328

smb: client: fix potential UAF in smb2_close_cached_fid()

8.8 EPSS 0.5% AV:N

Published 2025-12-09 (10 months ago) by the Linux kernel CNA. Subsystem fs/smb. Debian urgency: not yet assigned.

What to do, per Debian release

Debian's own status for CVE-2025-40328 in every release this site tracks, and what each one means in practice. Every status below is the one the Debian Security Team publishes for this CVE. source

ReleaseStatus VersionWhat this means
Debian 12bookwormvulnerable6.1.190-1No fix published anywhere yet, neither in Debian nor upstream for the series bookworm tracks. Watch the Debian tracker page for this CVE. Advisories for bookworm have historically landed a median of 23 days after publication.
Debian 13trixiefixed6.12.63-1Update the kernel and reboot. Fixed in 6.12.63-1. A running kernel keeps the old code until the machine restarts.
Debian 14forkyfixed6.17.8-1Update the kernel and reboot. Fixed in 6.17.8-1. A running kernel keeps the old code until the machine restarts.
Debian unstablesidfixed6.17.8-1Update the kernel and reboot. Fixed in 6.17.8-1. A running kernel keeps the old code until the machine restarts.

The vulnerability

What the bug is

find_or_create_cached_dir() could grab a new reference after kref_put() had seen the refcount drop to zero but before cfid_list_lock is acquired in smb2_close_cached_fid(), leading to use-after-free. Switch to kref_put_lock() so cfid_release() is called with cfid_list_lock held, closing that gap.

Where it lives

The fix touches these files. If the subsystem is one you do not use, the practical exposure is lower, though the package is still the vulnerable one.

fs/smb/client/cached_dir.c

What this is
COMMON INTERNET FILE SYSTEM CLIENT (CIFS and SMB3)MAINTAINERS section matched on fs/smb/client/ · linux-cifs@vger.kernel.org · Supported
Kernel module
cifs

Check it on the machine

grep -wE 'CONFIG_CIFS|CONFIG_SMBFS' /boot/config-$(uname -r)

Reads the booted kernel's own configuration, on the machine and nowhere else. =y is built in, =m is a module, and an is not set line means the code is not there.

lsmod | grep -w cifs

Prints a line if that module is loaded right now, and nothing if it is not. One that is not loaded can still be loaded later by anything that needs it.

Show whether Debian builds this, per release

Debian builds this as a loadable module. Every release below compiles it as a module on every flavour, so whether the code is in the running kernel depends on whether that module is loaded.

  • bookworm, trixie, forky, sidm
m
a loadable module on every flavour - check lsmod, can be blacklisted
Build switches
CONFIG_CIFS, CONFIG_SMBFS
Reads as
all on means the file is compiled; any one off means it is not.

From the configuration Debian publishes for every kernel flavour it builds. It covers only the architectures Debian ships a linux-config package for, and nothing about a kernel you built yourself. Debian's own status above stays authoritative about the source package.MAINTAINERS kbuild Makefiles Debian linux-config packages

Signals

Published
2025-12-09 (10 months ago)source
CVSS
8.8 high
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:Hsource recompute it
Attack vector
network (AV:N)source
EPSS
0.46%, higher than 38.5% of all CVEssource
CISA KEV
not listedthe KEV catalogue
Debian urgency
not yet assignedsource
Subsystem
fs/smb

Upstream fixes

The versions the CNA records as introducing and fixing this, and the commit for each. source

IntroducedFixed inCommit
6.16.6.117cb52d9c86d70
6.16.12.58065bd6241227
6.16.17.8bdb596ceb4b7
6.16.18734e99623c5b

Why the CNA scored it this way

Quoted from the kernel CNA's own scoring file, word for word. A highlighted metric carries the most severe value CVSS v3.1 defines for it, which is what pushes the score up. source

AV:NAttack vector, network
The freeing side of the race is driven directly by a remote peer — `smb2_is_valid_lease_break()` (fs/smb/client/smb2misc.c:692) processes unsolicited SMB2 lease-break packets from the server and calls `cached_dir_lease_break()`, which clears the lease ref and queues the final `kref_put()`; server-forced reconnects similarly drive `invalidate_all_cached_dirs()`. A malicious, compromised, or MITM'd SMB server therefore triggers the vulnerable refcount transition over the network.
AC:LAttack complexity, low
The attacker controls the timing and rate of lease breaks/reconnects and can replay them indefinitely against routine directory activity on the mount, so the narrow window between `refcount_dec_and_test()` and the lock acquisition can be hit reliably by repetition. Race conditions the attacker can retry at will are Low complexity.
PR:NPrivileges required, none
A malicious or MITM SMB server needs no credentials or privileges on the victim host; lease-break notifications are unsolicited server-to-client messages processed by the demultiplex thread. In the local variant the trigger is plain rmdir/stat/readdir on an accessible mount, requiring at most an unprivileged account.
UI:RUser interaction, required
Exploitation requires the victim to have the attacker-controlled SMB share mounted and to be performing directory lookups on it so that `find_or_create_cached_dir()` runs concurrently with the release path. The server cannot force that local access itself.
S:UScope, unchanged
The use-after-free is on a kernel slab object (`struct cached_fid`) and the impact stays within the kernel's own security authority — no VM, IOMMU, or sandbox boundary is crossed.
C:HConfidentiality impact, high
A freed `cached_fid` holding `dentry`, `tcon`, `cifs_fid` handles, a mutex and list/work heads can be reallocated and sprayed with attacker-chosen data; the racing thread then reads it and returns cached directory/file_all_info state, giving a path to disclosing kernel memory. Per guidance, use-after-free is scored High for confidentiality.
I:HIntegrity impact, high
The stale object is written through as well as read (`kref_get`, `last_access_time`, list manipulation, `dput(cfid->dentry)` on a reused pointer, and `SMB2_close()` on stale fid values), so heap grooming turns this into a write primitive over reallocated slab contents and potential control-flow hijack via the embedded `work_struct` function pointers.
A:HAvailability impact, high
Losing the race produces a `refcount_t: addition on 0` warning followed by dereference and double-free of the `cached_fid` — including `dput()` on a freed dentry and slab corruption — reliably causing an oops or kernel panic.