{"api_version":"1","generated_at":"2026-11-30T19:38:15+00:00","cve":"CVE-2026-139215","urls":{"html":"https://cve.report/CVE-2026-139215","api":"https://cve.report/api/cve/CVE-2026-139215.json","docs":"https://cve.report/api","cve_org":"https://www.cve.org/CVERecord?id=CVE-2026-139215","nvd":"https://nvd.nist.gov/vuln/detail/CVE-2026-139215"},"summary":{"title":"nsproxy: Fix cred leak in the error path of prepare_nsset()","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nnsproxy: Fix cred leak in the error path of prepare_nsset()\n\nA task that calls setns() with CLONE_NEWUSER together with CLONE_NEWNS\nand at least one more namespace flag leaks a struct cred (and the\nuser_namespace, ucounts and group_info references it holds) whenever the\ncall fails at the fs_struct copy.  On a kernel with CONFIG_USER_NS the\nleak is one cred per failed setns(); under memory pressure, or driven by\na fault-injecting attacker, it accumulates and pins user namespaces that\ncan then never be freed.\n\nprepare_nsset() sets nsset->flags only on the success path:\n\n\tif (flags & CLONE_NEWUSER)\n\t\tnsset->cred = prepare_creds();\n\t...\n\t} else if (flags & CLONE_NEWNS) {\n\t\tnsset->fs = copy_fs_struct(me->fs);\n\t\tif (!nsset->fs)\n\t\t\tgoto out;\t/* flags still 0 here */\n\t}\n\tnsset->flags = flags;\n\treturn 0;\nout:\n\tput_nsset(nsset);\n\nput_nsset() decides what to release from nsset->flags:\n\n\tif (flags & CLONE_NEWUSER)\n\t\tput_cred(nsset_cred(nsset));\n\nOn the copy_fs_struct() failure arm prepare_creds() has already\nallocated the cred, but nsset->flags is still the zero from the caller's\n\"struct nsset nsset = {}\", so put_nsset() does not see CLONE_NEWUSER and\nnever drops it.  The caller (__do_sys_setns) returns the error without\ntouching nsset, so the cred is lost.\n\nSet nsset->flags at the start of prepare_nsset(), before anything can\nfail, so every error exit through put_nsset() releases what was taken.\ncommit_nsset(), which clears nsset->cred on success, is unaffected.\n\nReproduced on x86_64 under QEMU with failslab aimed at the fs_struct\ncache and kmemleak enabled: 500 calls of\nsetns(pidfd, CLONE_NEWUSER | CLONE_NEWNS | CLONE_NEWUTS) each fail with\n-ENOMEM and leave 851 unreferenced cred objects allocated from\nprepare_creds() via setns() before the fix, and none after (the program\nis in the notes below).\n\nFound by formal verification of kernel/nsproxy.c.","state":"PUBLISHED","assigner":"Linux","published_at":"2026-11-30 14:18:41","updated_at":"2026-11-30 14:18:41"},"problem_types":[],"metrics":[],"references":[{"url":"https://git.kernel.org/stable/c/39b61af703ab5beb810edd5ac1f854e6fe3411ba","name":"https://git.kernel.org/stable/c/39b61af703ab5beb810edd5ac1f854e6fe3411ba","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://git.kernel.org/stable/c/09a5a04a2d36c33881e323ddf7d84cf252bf6682","name":"https://git.kernel.org/stable/c/09a5a04a2d36c33881e323ddf7d84cf252bf6682","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://git.kernel.org/stable/c/85ecdfd12f4a6a2b91479ffe9dd7bd51f21a6f4f","name":"https://git.kernel.org/stable/c/85ecdfd12f4a6a2b91479ffe9dd7bd51f21a6f4f","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://git.kernel.org/stable/c/4de99588da937b13ed8fbb92369d19eee969700a","name":"https://git.kernel.org/stable/c/4de99588da937b13ed8fbb92369d19eee969700a","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://git.kernel.org/stable/c/3ba6455f58f9bd307dc093e177fa302c19ba7da5","name":"https://git.kernel.org/stable/c/3ba6455f58f9bd307dc093e177fa302c19ba7da5","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://git.kernel.org/stable/c/6097ae45077b4066e478f898653430c719ec8102","name":"https://git.kernel.org/stable/c/6097ae45077b4066e478f898653430c719ec8102","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://git.kernel.org/stable/c/e08601d3a7b2236f4915497dca353dcf117bab5c","name":"https://git.kernel.org/stable/c/e08601d3a7b2236f4915497dca353dcf117bab5c","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://git.kernel.org/stable/c/43cbb8cdb829ef735824eff286a3ecd8e5c820e4","name":"https://git.kernel.org/stable/c/43cbb8cdb829ef735824eff286a3ecd8e5c820e4","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://www.cve.org/CVERecord?id=CVE-2026-139215","name":"CVE Program record","refsource":"CVE.ORG","tags":["canonical"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-139215","name":"NVD vulnerability detail","refsource":"NVD","tags":["canonical","analysis"]}],"affected":[{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 303cc571d107b3641d6487061b748e70ffe15ce4 85ecdfd12f4a6a2b91479ffe9dd7bd51f21a6f4f git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 303cc571d107b3641d6487061b748e70ffe15ce4 43cbb8cdb829ef735824eff286a3ecd8e5c820e4 git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 303cc571d107b3641d6487061b748e70ffe15ce4 6097ae45077b4066e478f898653430c719ec8102 git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 303cc571d107b3641d6487061b748e70ffe15ce4 4de99588da937b13ed8fbb92369d19eee969700a git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 303cc571d107b3641d6487061b748e70ffe15ce4 39b61af703ab5beb810edd5ac1f854e6fe3411ba git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 303cc571d107b3641d6487061b748e70ffe15ce4 3ba6455f58f9bd307dc093e177fa302c19ba7da5 git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 303cc571d107b3641d6487061b748e70ffe15ce4 09a5a04a2d36c33881e323ddf7d84cf252bf6682 git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 303cc571d107b3641d6487061b748e70ffe15ce4 e08601d3a7b2236f4915497dca353dcf117bab5c git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 5.8","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 5.8 semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 5.10.275 5.10.* semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 5.15.226 5.15.* semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 6.1.193 6.1.* semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 6.6.163 6.6.* semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 6.12.119 6.12.* semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 6.18.65 6.18.* semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 7.3.6 7.3.* semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 7.4-rc1 * original_commit_for_fix","platforms":[]}],"timeline":[],"solutions":[],"workarounds":[],"exploits":[],"credits":[],"nvd_cpes":[],"vendor_comments":[],"enrichments":{"kev":null,"epss":null,"legacy_qids":[]},"source_records":{"cve_program":{"containers":{"cna":{"affected":[{"defaultStatus":"unaffected","product":"Linux","programFiles":["kernel/nsproxy.c"],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","vendor":"Linux","versions":[{"lessThan":"85ecdfd12f4a6a2b91479ffe9dd7bd51f21a6f4f","status":"affected","version":"303cc571d107b3641d6487061b748e70ffe15ce4","versionType":"git"},{"lessThan":"43cbb8cdb829ef735824eff286a3ecd8e5c820e4","status":"affected","version":"303cc571d107b3641d6487061b748e70ffe15ce4","versionType":"git"},{"lessThan":"6097ae45077b4066e478f898653430c719ec8102","status":"affected","version":"303cc571d107b3641d6487061b748e70ffe15ce4","versionType":"git"},{"lessThan":"4de99588da937b13ed8fbb92369d19eee969700a","status":"affected","version":"303cc571d107b3641d6487061b748e70ffe15ce4","versionType":"git"},{"lessThan":"39b61af703ab5beb810edd5ac1f854e6fe3411ba","status":"affected","version":"303cc571d107b3641d6487061b748e70ffe15ce4","versionType":"git"},{"lessThan":"3ba6455f58f9bd307dc093e177fa302c19ba7da5","status":"affected","version":"303cc571d107b3641d6487061b748e70ffe15ce4","versionType":"git"},{"lessThan":"09a5a04a2d36c33881e323ddf7d84cf252bf6682","status":"affected","version":"303cc571d107b3641d6487061b748e70ffe15ce4","versionType":"git"},{"lessThan":"e08601d3a7b2236f4915497dca353dcf117bab5c","status":"affected","version":"303cc571d107b3641d6487061b748e70ffe15ce4","versionType":"git"}]},{"defaultStatus":"affected","product":"Linux","programFiles":["kernel/nsproxy.c"],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","vendor":"Linux","versions":[{"status":"affected","version":"5.8"},{"lessThan":"5.8","status":"unaffected","version":"0","versionType":"semver"},{"lessThanOrEqual":"5.10.*","status":"unaffected","version":"5.10.275","versionType":"semver"},{"lessThanOrEqual":"5.15.*","status":"unaffected","version":"5.15.226","versionType":"semver"},{"lessThanOrEqual":"6.1.*","status":"unaffected","version":"6.1.193","versionType":"semver"},{"lessThanOrEqual":"6.6.*","status":"unaffected","version":"6.6.163","versionType":"semver"},{"lessThanOrEqual":"6.12.*","status":"unaffected","version":"6.12.119","versionType":"semver"},{"lessThanOrEqual":"6.18.*","status":"unaffected","version":"6.18.65","versionType":"semver"},{"lessThanOrEqual":"7.3.*","status":"unaffected","version":"7.3.6","versionType":"semver"},{"lessThanOrEqual":"*","status":"unaffected","version":"7.4-rc1","versionType":"original_commit_for_fix"}]}],"cpeApplicability":[{"nodes":[{"cpeMatch":[{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"5.10.275","versionStartIncluding":"5.8","vulnerable":true},{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"5.15.226","versionStartIncluding":"5.8","vulnerable":true},{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"6.1.193","versionStartIncluding":"5.8","vulnerable":true},{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"6.6.163","versionStartIncluding":"5.8","vulnerable":true},{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"6.12.119","versionStartIncluding":"5.8","vulnerable":true},{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"6.18.65","versionStartIncluding":"5.8","vulnerable":true},{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"7.3.6","versionStartIncluding":"5.8","vulnerable":true},{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"7.4-rc1","versionStartIncluding":"5.8","vulnerable":true}],"negate":false,"operator":"OR"}]}],"descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nnsproxy: Fix cred leak in the error path of prepare_nsset()\n\nA task that calls setns() with CLONE_NEWUSER together with CLONE_NEWNS\nand at least one more namespace flag leaks a struct cred (and the\nuser_namespace, ucounts and group_info references it holds) whenever the\ncall fails at the fs_struct copy.  On a kernel with CONFIG_USER_NS the\nleak is one cred per failed setns(); under memory pressure, or driven by\na fault-injecting attacker, it accumulates and pins user namespaces that\ncan then never be freed.\n\nprepare_nsset() sets nsset->flags only on the success path:\n\n\tif (flags & CLONE_NEWUSER)\n\t\tnsset->cred = prepare_creds();\n\t...\n\t} else if (flags & CLONE_NEWNS) {\n\t\tnsset->fs = copy_fs_struct(me->fs);\n\t\tif (!nsset->fs)\n\t\t\tgoto out;\t/* flags still 0 here */\n\t}\n\tnsset->flags = flags;\n\treturn 0;\nout:\n\tput_nsset(nsset);\n\nput_nsset() decides what to release from nsset->flags:\n\n\tif (flags & CLONE_NEWUSER)\n\t\tput_cred(nsset_cred(nsset));\n\nOn the copy_fs_struct() failure arm prepare_creds() has already\nallocated the cred, but nsset->flags is still the zero from the caller's\n\"struct nsset nsset = {}\", so put_nsset() does not see CLONE_NEWUSER and\nnever drops it.  The caller (__do_sys_setns) returns the error without\ntouching nsset, so the cred is lost.\n\nSet nsset->flags at the start of prepare_nsset(), before anything can\nfail, so every error exit through put_nsset() releases what was taken.\ncommit_nsset(), which clears nsset->cred on success, is unaffected.\n\nReproduced on x86_64 under QEMU with failslab aimed at the fs_struct\ncache and kmemleak enabled: 500 calls of\nsetns(pidfd, CLONE_NEWUSER | CLONE_NEWNS | CLONE_NEWUTS) each fail with\n-ENOMEM and leave 851 unreferenced cred objects allocated from\nprepare_creds() via setns() before the fix, and none after (the program\nis in the notes below).\n\nFound by formal verification of kernel/nsproxy.c."}],"providerMetadata":{"dateUpdated":"2026-11-30T13:32:39.234Z","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","shortName":"Linux"},"references":[{"url":"https://git.kernel.org/stable/c/85ecdfd12f4a6a2b91479ffe9dd7bd51f21a6f4f"},{"url":"https://git.kernel.org/stable/c/43cbb8cdb829ef735824eff286a3ecd8e5c820e4"},{"url":"https://git.kernel.org/stable/c/6097ae45077b4066e478f898653430c719ec8102"},{"url":"https://git.kernel.org/stable/c/4de99588da937b13ed8fbb92369d19eee969700a"},{"url":"https://git.kernel.org/stable/c/39b61af703ab5beb810edd5ac1f854e6fe3411ba"},{"url":"https://git.kernel.org/stable/c/3ba6455f58f9bd307dc093e177fa302c19ba7da5"},{"url":"https://git.kernel.org/stable/c/09a5a04a2d36c33881e323ddf7d84cf252bf6682"},{"url":"https://git.kernel.org/stable/c/e08601d3a7b2236f4915497dca353dcf117bab5c"}],"title":"nsproxy: Fix cred leak in the error path of prepare_nsset()","x_generator":{"engine":"bippy-1.2.0"}}},"cveMetadata":{"assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","assignerShortName":"Linux","cveId":"CVE-2026-139215","datePublished":"2026-11-30T13:32:39.234Z","dateReserved":"2026-11-30T13:22:15.920Z","dateUpdated":"2026-11-30T13:32:39.234Z","state":"PUBLISHED"},"dataType":"CVE_RECORD","dataVersion":"5.2"},"nvd":{"publishedDate":"2026-11-30 14:18:41","lastModifiedDate":"2026-11-30 14:18:41","problem_types":[],"metrics":[],"configurations":[]},"legacy_mitre":{"record":{"CveYear":"2026","CveId":"139215","Ordinal":"1","Title":"nsproxy: Fix cred leak in the error path of prepare_nsset()","CVE":"CVE-2026-139215","Year":"2026"},"notes":[{"CveYear":"2026","CveId":"139215","Ordinal":"1","NoteData":"In the Linux kernel, the following vulnerability has been resolved:\n\nnsproxy: Fix cred leak in the error path of prepare_nsset()\n\nA task that calls setns() with CLONE_NEWUSER together with CLONE_NEWNS\nand at least one more namespace flag leaks a struct cred (and the\nuser_namespace, ucounts and group_info references it holds) whenever the\ncall fails at the fs_struct copy.  On a kernel with CONFIG_USER_NS the\nleak is one cred per failed setns(); under memory pressure, or driven by\na fault-injecting attacker, it accumulates and pins user namespaces that\ncan then never be freed.\n\nprepare_nsset() sets nsset->flags only on the success path:\n\n\tif (flags & CLONE_NEWUSER)\n\t\tnsset->cred = prepare_creds();\n\t...\n\t} else if (flags & CLONE_NEWNS) {\n\t\tnsset->fs = copy_fs_struct(me->fs);\n\t\tif (!nsset->fs)\n\t\t\tgoto out;\t/* flags still 0 here */\n\t}\n\tnsset->flags = flags;\n\treturn 0;\nout:\n\tput_nsset(nsset);\n\nput_nsset() decides what to release from nsset->flags:\n\n\tif (flags & CLONE_NEWUSER)\n\t\tput_cred(nsset_cred(nsset));\n\nOn the copy_fs_struct() failure arm prepare_creds() has already\nallocated the cred, but nsset->flags is still the zero from the caller's\n\"struct nsset nsset = {}\", so put_nsset() does not see CLONE_NEWUSER and\nnever drops it.  The caller (__do_sys_setns) returns the error without\ntouching nsset, so the cred is lost.\n\nSet nsset->flags at the start of prepare_nsset(), before anything can\nfail, so every error exit through put_nsset() releases what was taken.\ncommit_nsset(), which clears nsset->cred on success, is unaffected.\n\nReproduced on x86_64 under QEMU with failslab aimed at the fs_struct\ncache and kmemleak enabled: 500 calls of\nsetns(pidfd, CLONE_NEWUSER | CLONE_NEWNS | CLONE_NEWUTS) each fail with\n-ENOMEM and leave 851 unreferenced cred objects allocated from\nprepare_creds() via setns() before the fix, and none after (the program\nis in the notes below).\n\nFound by formal verification of kernel/nsproxy.c.","Type":"Description","Title":"nsproxy: Fix cred leak in the error path of prepare_nsset()"}]}}}