Credential leak in Linux kernel setns() error path
Key facts
- Attack vector
- —
- Privileges required
- —
- User interaction
- —
- Attack complexity
- —
- Impact type
- —
- Confidentiality · integrity · availability
- —
- Fix status
- Fixed
No CVSS vector from any source. Fix status from CNA.
Summary
The Linux kernel from 5.8 leaks a credential structure in the error path of prepare_nsset() during setns() calls. A task that calls setns() with CLONE_NEWUSER, CLONE_NEWNS and at least one other namespace flag leaks the cred and the user namespace references it holds when the fs_struct copy fails. Under memory pressure or fault injection, repeated failing calls accumulate leaked objects that can pin user namespaces so they are never freed.
Written with Claude Haiku 5.5 from the sources below · 2026-11-30
Description from the CNA
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.
Why it matters now
SSVC decision points
Not available: CISA has not published SSVC decision points for this record.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| Linux | Linux | 5.8 and later | 5.10.275, 5.15.226, 6.1.193, 6.6.163, 6.12.119, 6.18.65, 7.3.6, 7.4-rc1 | Patch available | CNA |
- Linux VendorLinux Affected 5.8 and later Fixed in 5.10.275, 5.15.226, 6.1.193, 6.6.163, 6.12.119, 6.18.65, 7.3.6, 7.4-rc1 Patch available CNA
Remediation
Upgrade the Linux kernel to a fixed version: 5.10.275, 5.15.226, 6.1.193, 6.6.163, 6.12.119, 6.18.65, 7.3.6 or 7.4-rc1, depending on the branch in use. The sources list no advisory identifier for this fix.
Written with Claude Haiku 5.5 from the sources below · 2026-11-30
- Fix · CNA Linux (Linux) Fixed in 5.10.275, 5.15.226, 6.1.193, 6.6.163, 6.12.119, 6.18.65, 7.3.6, 7.4-rc1
Timeline
- 2026-11-30 Threatist record created from CVE-2026-139215
- 2026-11-30 Alias added: GHSA-2h96-524f-7rrv
References
Other 8
- https://git.kernel.org/stable/c/85ecdfd12f4a6a2b91479ffe9dd7bd51f21a6f4f
- https://git.kernel.org/stable/c/43cbb8cdb829ef735824eff286a3ecd8e5c820e4
- https://git.kernel.org/stable/c/6097ae45077b4066e478f898653430c719ec8102
- https://git.kernel.org/stable/c/4de99588da937b13ed8fbb92369d19eee969700a
- https://git.kernel.org/stable/c/39b61af703ab5beb810edd5ac1f854e6fe3411ba
- https://git.kernel.org/stable/c/3ba6455f58f9bd307dc093e177fa302c19ba7da5
- https://git.kernel.org/stable/c/09a5a04a2d36c33881e323ddf7d84cf252bf6682
- https://git.kernel.org/stable/c/e08601d3a7b2236f4915497dca353dcf117bab5c
More Linux vulnerabilities
- TI-2025-26358 Zero-length TLS records mishandled on rx_list in Linux kernel KEVCVSS 3.1CRITICAL 9.8
- TI-2026-38352 Out-of-bounds write in Linux kernel ebtables SNAT ARP rewrite KEVCVSS 3.1HIGH 8.8
- TI-2021-02452 Overlayfs flaw in Linux kernel lets attackers gain elevated privileges KEVCVSS 3.1HIGH 8.8
- TI-2013-05264 Missing address checks in Linux kernel get_user and put_user on ARM KEVCVSS 3.1HIGH 8.8
- TI-2022-00125 Heap overflow in Linux kernel lets local users escalate privileges KEVCVSS 3.1HIGH 8.4
- TI-2013-01864 Wrong integer type in Linux kernel perf_swevent_init KEVCVSS 3.1HIGH 8.4
Sources
- CVE-2026-139215 · CVE Program
- CVE-2026-139215 · NVD
- GHSA-2h96-524f-7rrv · GitHub Advisory Database · CC BY 4.0
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences