GHSA-WGRG-5H56-JG27

GHSA-WGRG-5H56-JG27 is a high-severity security vulnerability in nix (rust), affecting versions >= 0.16.0, < 0.20.2. It is fixed in 0.20.2, 0.21.2, 0.22.2.

Does this CVE actually affect you?

Kodem shows which CVEs are reachable and running in your applications, so you fix what's exploitable, not just what's listed.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Runtime intelligence, not another scanner.

Summary

Out-of-bounds write in nix::unistd::getgrouplist

On certain platforms, if a user has more than 16 groups, the
nix::unistd::getgrouplist function will call the libc getgrouplist
function with a length parameter greater than the size of the buffer it
provides, resulting in an out-of-bounds write and memory corruption.

The libc getgrouplist function takes an in/out parameter ngroups
specifying the size of the group buffer. When the buffer is too small to
hold all of the reqested user's group memberships, some libc
implementations, including glibc and Solaris libc, will modify ngroups
to indicate the actual number of groups for the user, in addition to
returning an error. The version of nix::unistd::getgrouplist in nix
0.16.0 and up will resize the buffer to twice its size, but will not
read or modify the ngroups variable. Thus, if the user has more than
twice as many groups as the initial buffer size of 8, the next call to
getgrouplist will then write past the end of the buffer.

The issue would require editing /etc/groups to exploit, which is usually
only editable by the root user.

Impact

Affected versions

nix (>= 0.16.0, < 0.20.2) nix (>= 0.21.0, < 0.21.2) nix (>= 0.22.0, < 0.22.2)

Security releases

nix → 0.20.2 (rust) nix → 0.21.2 (rust) nix → 0.22.2 (rust)

Kodem intelligence

Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.

Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.

Already deployed Kodem?

See it in your environmentNew to Kodem? Get a demo →

Remediation advice

Upgrade the following packages to resolve this vulnerability:

nix to 0.20.2 or later; nix to 0.21.2 or later; nix to 0.22.2 or later

Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.

Frequently Asked Questions

  1. What is GHSA-WGRG-5H56-JG27? GHSA-WGRG-5H56-JG27 is a high-severity security vulnerability in nix (rust), affecting versions >= 0.16.0, < 0.20.2. It is fixed in 0.20.2, 0.21.2, 0.22.2.
  2. Which versions of nix are affected by GHSA-WGRG-5H56-JG27? nix (rust) versions >= 0.16.0, < 0.20.2 is affected.
  3. Is there a fix for GHSA-WGRG-5H56-JG27? Yes. GHSA-WGRG-5H56-JG27 is fixed in 0.20.2, 0.21.2, 0.22.2. Upgrade to this version or later.
  4. Is GHSA-WGRG-5H56-JG27 exploitable, and should I be worried? Whether GHSA-WGRG-5H56-JG27 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
  5. What actually determines whether GHSA-WGRG-5H56-JG27 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
  6. How do I fix GHSA-WGRG-5H56-JG27?
    • Upgrade nix to 0.20.2 or later
    • Upgrade nix to 0.21.2 or later
    • Upgrade nix to 0.22.2 or later

Other vulnerabilities in nix

Stop the waste.
Protect your environment with Kodem.