GHSA-2H96-524F-7RRV

Vulnerability from github – Published: 2026-11-30 15:32 – Updated: 2026-11-30 15:32
VLAI
Details

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.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2026-139215"
  ],
  "database_specific": {
    "cwe_ids": [],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2026-11-30T14:18:41Z",
    "severity": null
  },
  "details": "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-\u003eflags only on the success path:\n\n\tif (flags \u0026 CLONE_NEWUSER)\n\t\tnsset-\u003ecred = prepare_creds();\n\t...\n\t} else if (flags \u0026 CLONE_NEWNS) {\n\t\tnsset-\u003efs = copy_fs_struct(me-\u003efs);\n\t\tif (!nsset-\u003efs)\n\t\t\tgoto out;\t/* flags still 0 here */\n\t}\n\tnsset-\u003eflags = flags;\n\treturn 0;\nout:\n\tput_nsset(nsset);\n\nput_nsset() decides what to release from nsset-\u003eflags:\n\n\tif (flags \u0026 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-\u003eflags is still the zero from the caller\u0027s\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-\u003eflags 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-\u003ecred 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.",
  "id": "GHSA-2h96-524f-7rrv",
  "modified": "2026-11-30T15:32:22Z",
  "published": "2026-11-30T15:32:22Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-139215"
    },
    {
      "type": "WEB",
      "url": "https://git.kernel.org/stable/c/09a5a04a2d36c33881e323ddf7d84cf252bf6682"
    },
    {
      "type": "WEB",
      "url": "https://git.kernel.org/stable/c/39b61af703ab5beb810edd5ac1f854e6fe3411ba"
    },
    {
      "type": "WEB",
      "url": "https://git.kernel.org/stable/c/3ba6455f58f9bd307dc093e177fa302c19ba7da5"
    },
    {
      "type": "WEB",
      "url": "https://git.kernel.org/stable/c/43cbb8cdb829ef735824eff286a3ecd8e5c820e4"
    },
    {
      "type": "WEB",
      "url": "https://git.kernel.org/stable/c/4de99588da937b13ed8fbb92369d19eee969700a"
    },
    {
      "type": "WEB",
      "url": "https://git.kernel.org/stable/c/6097ae45077b4066e478f898653430c719ec8102"
    },
    {
      "type": "WEB",
      "url": "https://git.kernel.org/stable/c/85ecdfd12f4a6a2b91479ffe9dd7bd51f21a6f4f"
    },
    {
      "type": "WEB",
      "url": "https://git.kernel.org/stable/c/e08601d3a7b2236f4915497dca353dcf117bab5c"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}



Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Drag nodes to arrange them. Double-click a related vulnerability to open it, or a source to visit its link. The Physics button on the left tunes the layout and the simulation; the legend at the bottom left hides or shows nodes by kind and by sighting type.

Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.

Sightings

Author Source Type Date Other

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
Vulnerability timeline

Sightings and recorded dates, grouped by day · UTC

JSON
How durations are calculated

Following the VTEM framework (Black Hat USA 2015), time to patch starts when the vendor or a coordinator was informed, total time to patch at discovery, and disclosure to patch at public disclosure; vendor response time runs from the report to its acknowledgement. Time to exploit and time unpatched start at the earliest discovery or report, falling back to public disclosure. Unpatched time ends at the first recorded patch, or the calculation time when no patch is recorded. Exploitation to patch shows the interval between those two events; a published proof of concept is a public exploit, not exploitation. The method is described in a publication.

Each result shows its source dates. A negative interval means the end event came first; when date-only inputs leave the order open, the result says so. Date-only inputs are approximate. The earliest evidence wins: KEV report dates and sightings are labelled as such. Records describing another vulnerability are listed but never calculated from, and a PoC alone does not establish exploitation. Missing patch evidence does not prove that no patch exists. Filters below change the event list only.

Events included in the timeline

Loading timeline…


    Loading…

    Loading…

    Loading…

    Related by attack behaviour

    Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.