CVE-2025-22040 ksmbd: fix session use-after-free in multichannel connection

High 8.8 Published Updated

A race condition in the Linux kernel ksmbd module allows a use-after-free, potentially enabling local attackers to execute code or escalate privileges.

Exploited in the wild
Not known
Login needed
Any signed-in user
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2025-22040?

CVE-2025-22040 is a high-severity use after free vulnerability in Debian Debian Linux, published on 16 Apr 2025. Any signed-in user can exploit it over the network, with no action from the victim.

Official description

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

ksmbd: fix session use-after-free in multichannel connection

There is a race condition between session setup and ksmbd_sessions_deregister. The session can be freed before the connection is added to channel list of session. This patch check reference count of session before freeing it.

Weakness: CWE-416

Which versions are affected by CVE-2025-22040?

It affects 2 products.

Products include Debian Debian Linux, Linux kernel.

How do I fix CVE-2025-22040?

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-22040 being exploited?

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

All Debian Debian Linux vulnerabilities

Sources

Also known as BELL-CVE-2025-22040, DEBIAN-CVE-2025-22040, GHSA-q9qg-fj9x-mqhg, ROOT-OS-UBUNTU-2204-CVE-2025-22040, ROOT-OS-UBUNTU-2404-CVE-2025-22040, UBUNTU-CVE-2025-22040.

Is CVE-2025-22040 in your software?

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

Check your SBOMs for free