CVE-2025-21893 keys: Fix UAF in key_put()

High 7.8 Published Updated

A use-after-free vulnerability in the Linux kernel key management subsystem allows attackers to potentially execute arbitrary code or escalate privileges.

Exploited in the wild
Not known
Login needed
Any signed-in user
Attackable
Local or same network only
Victim action needed
Not needed
Fix
Available

What is CVE-2025-21893?

CVE-2025-21893 is a high-severity use after free vulnerability in Linux kernel, published on 31 Mar 2025. It can only be exploited from the same machine or local network, with no action from the victim.

Official description

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

keys: Fix UAF in key_put()

Once a key's reference count has been reduced to 0, the garbage collector thread may destroy it at any time and so key_put() is not allowed to touch the key after that point. The most key_put() is normally allowed to do is to touch key_gc_work as that's a static global variable.

However, in an effort to speed up the reclamation of quota, this is now done in key_put() once the key's usage is reduced to 0 - but now the code is looking at the key after the deadline, which is forbidden.

Fix this by using a flag to indicate that a key can be gc'd now rather than looking at the key's refcount in the garbage collector.

Weakness: CWE-416

Which versions are affected by CVE-2025-21893?

It affects 1 product.

Products include Linux kernel.

How do I fix CVE-2025-21893?

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

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

All Linux kernel vulnerabilities

Sources

Also known as BELL-CVE-2025-21893, DEBIAN-CVE-2025-21893, GHSA-prxc-p2g7-m92v, UBUNTU-CVE-2025-21893.

Is CVE-2025-21893 in your software?

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

Check your SBOMs for free