CVE-2025-40328 smb: client: fix potential UAF in smb2_close_cached_fid()

High 8.8 Published Updated

A use-after-free vulnerability in the Linux kernel SMB client allows attackers to potentially execute code or escalate privileges via race conditions.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
A user has to click or open something
Fix
Available

What is CVE-2025-40328?

CVE-2025-40328 is a high-severity use after free vulnerability in Linux, published on 9 Dec 2025. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

Official description

In the Linux kernel, the following vulnerability has been resolved:

smb: client: fix potential UAF in smb2_close_cached_fid()

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.

Which versions are affected by CVE-2025-40328?

How do I fix CVE-2025-40328?

Apply the vendor's patch.

Upgrade to the fixed version. These bugs are found with fuzzing and sanitisers and avoided by memory-safe languages. More about Use after free.

Is CVE-2025-40328 being exploited?

There is no known exploitation of CVE-2025-40328 in the wild and no public exploit code.

Sources

Also known as BELL-CVE-2025-40328, DEBIAN-CVE-2025-40328, GHSA-f255-x52r-mjq5, ROOT-OS-DEBIAN-12-CVE-2025-40328, ROOT-OS-DEBIAN-13-CVE-2025-40328, ROOT-OS-UBUNTU-2404-CVE-2025-40328 and 1 more.

Is CVE-2025-40328 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free