CVE-2026-139215

nsproxy: Fix cred leak in the error path of prepare_nsset()

No CVSS score yet EPSS 0.21%

Published 30 Nov 2026 Updated 30 Nov 2026 CNA: Linux

Check your servers for CVE-2026-139215

The Vulnpocalypse collector sends the package list of each Linux server and of its container images once a day. Vulnpocalypse shows every server where CVE-2026-139215 affects the running kernel, with the command that installs the fix. The free plan covers one server and one domain and does not need a credit card.

Check my servers

Description

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

nsproxy: Fix cred leak in the error path of prepare_nsset()

A task that calls setns() with CLONE_NEWUSER together with CLONE_NEWNS and at least one more namespace flag leaks a struct cred (and the user_namespace, ucounts and group_info references it holds) whenever the call fails at the fs_struct copy. On a kernel with CONFIG_USER_NS the leak is one cred per failed setns(); under memory pressure, or driven by a fault-injecting attacker, it accumulates and pins user namespaces that can then never be freed.

prepare_nsset() sets nsset->flags only on the success path:

if (flags & CLONE_NEWUSER) nsset->cred = prepare_creds(); ... } else if (flags & CLONE_NEWNS) { nsset->fs = copy_fs_struct(me->fs); if (!nsset->fs) goto out; /* flags still 0 here */ } nsset->flags = flags; return 0; out: put_nsset(nsset);

put_nsset() decides what to release from nsset->flags:

if (flags & CLONE_NEWUSER) put_cred(nsset_cred(nsset));

On the copy_fs_struct() failure arm prepare_creds() has already allocated the cred, but nsset->flags is still the zero from the caller's "struct nsset nsset = {}", so put_nsset() does not see CLONE_NEWUSER and never drops it. The caller (__do_sys_setns) returns the error without touching nsset, so the cred is lost.

Set nsset->flags at the start of prepare_nsset(), before anything can fail, so every error exit through put_nsset() releases what was taken. commit_nsset(), which clears nsset->cred on success, is unaffected.

Reproduced on x86_64 under QEMU with failslab aimed at the fs_struct cache and kmemleak enabled: 500 calls of setns(pidfd, CLONE_NEWUSER | CLONE_NEWNS | CLONE_NEWUTS) each fail with -ENOMEM and leave 851 unreferenced cred objects allocated from prepare_creds() via setns() before the fix, and none after (the program is in the notes below).

Found by formal verification of kernel/nsproxy.c.

Exploitation

EPSS 0.21%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 12.0% of all scored CVEs. Scores of 1 Dec 2026.

Affected products

As the CNA lists them.

ProductVersions
Linux
affected from 303cc571d107b3641d6487061b748e70ffe15ce4, before 85ecdfd12f4a6a2b91479ffe9dd7bd51f21a6f4f
affected from 303cc571d107b3641d6487061b748e70ffe15ce4, before 43cbb8cdb829ef735824eff286a3ecd8e5c820e4
affected from 303cc571d107b3641d6487061b748e70ffe15ce4, before 6097ae45077b4066e478f898653430c719ec8102
affected from 303cc571d107b3641d6487061b748e70ffe15ce4, before 4de99588da937b13ed8fbb92369d19eee969700a
affected from 303cc571d107b3641d6487061b748e70ffe15ce4, before 39b61af703ab5beb810edd5ac1f854e6fe3411ba
affected from 303cc571d107b3641d6487061b748e70ffe15ce4, before 3ba6455f58f9bd307dc093e177fa302c19ba7da5
affected from 303cc571d107b3641d6487061b748e70ffe15ce4, before 09a5a04a2d36c33881e323ddf7d84cf252bf6682
affected from 303cc571d107b3641d6487061b748e70ffe15ce4, before e08601d3a7b2236f4915497dca353dcf117bab5c
Other versions: unaffected
Linux
affected 5.8
unaffected before 5.8
unaffected from 5.10.275 up to and including 5.10.*
unaffected from 5.15.226 up to and including 5.15.*
unaffected from 6.1.193 up to and including 6.1.*
unaffected from 6.6.163 up to and including 6.6.*
unaffected from 6.12.119 up to and including 6.12.*
unaffected from 6.18.65 up to and including 6.18.*
unaffected from 7.3.6 up to and including 7.3.*
unaffected 7.4-rc1 and later
Other versions: affected

Is my server affected?

This CVE is in the Linux kernel. Compare the running kernel with the fixed kernel version of your distribution, and reboot after a kernel update:

uname -r
# Debian, Ubuntu: does the changelog of the running kernel name the CVE?
zgrep -l CVE-2026-139215 /usr/share/doc/linux-image-$(uname -r)/changelog.Debian.gz
# RHEL, Rocky, Alma
rpm -q --changelog kernel | grep CVE-2026-139215

With Trivy, on the host and for a container image. When a package is affected, it prints the installed and the fixed version:

trivy rootfs --scanners vuln / | grep CVE-2026-139215
trivy image --scanners vuln IMAGE | grep CVE-2026-139215

Vulnpocalypse makes this comparison every day for the package lists of your servers and container images, including language packages (npm, PyPI, Go, Maven and others), and sends the command that installs the fix. Start free with one server and one domain or read how to install the collector.

References

Other references

Source: the record CVE-2026-139215 of the CVE List (CVE Program), CVE Terms of Use; EPSS of FIRST. The text of the record is shown as published. Data sources and licences.