CVE-2026-64397 ksmbd: serialize QUERY_DIRECTORY requests per file

Critical 9.8 Published Updated

Concurrent SMB directory queries can cause a stack use-after-free in the Linux kernel, potentially allowing local attackers to execute code or escalate privileges.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2026-64397?

CVE-2026-64397 is a critical use after free vulnerability in Linux kernel, published on 25 Jul 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

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

ksmbd: serialize QUERY_DIRECTORY requests per file

smb2_query_dir() stores a pointer to its stack-allocated private data in the ksmbd_file readdir_data. Concurrent QUERY_DIRECTORY requests using the same file handle can overwrite this pointer while an iterate_dir() callback is still using it, resulting in a stack use-after-free.

Add a per-file mutex and hold it while accessing the shared directory enumeration state. The lock covers scan restart, dot entry state, readdir_data setup and iteration, and response construction. This prevents another request from replacing readdir_data.private before the current request has finished using it and also serializes the shared file position.

Weakness: CWE-416

Which versions are affected by CVE-2026-64397?

It affects 1 product.

Products include Linux kernel.

How do I fix CVE-2026-64397?

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-2026-64397 being exploited?

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

All Linux kernel vulnerabilities

Sources

Also known as BELL-CVE-2026-64397, DEBIAN-CVE-2026-64397, GHSA-76f2-j4c3-m5v4, ROOT-OS-DEBIAN-12-CVE-2026-64397, ROOT-OS-UBUNTU-2204-CVE-2026-64397, UBUNTU-CVE-2026-64397.

Is CVE-2026-64397 in your software?

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

Check your SBOMs for free