🛡️ CVE-2021-45707 — nix
Description
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 requested 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.
How this vulnerability can be exploited
This issue can be reached with local access to the system, attack complexity is low, an attacker needs administrative privileges on the target. No user interaction is required. The scope is unchanged, so the impact stays within the vulnerable component. Rated impact: confidentiality high, integrity high, availability high.
Weakness class
CVE-2021-45707 is classified as CWE-787: Out-of-bounds Write. Data is written past the end or before the start of a buffer, corrupting whatever is stored there.
Affected software
CVE-2021-45707 is recorded against 1 package.
- nix
Timeline and source
Published on 6 January 2022 and last revised on 8 July 2026. No public exploit is currently recorded for this entry. Record sourced from OSV.
References
nvd.nist.gov (Advisory)
github.com (Web)
github.com (Advisory)
github.com (Package)
raw.githubusercontent.com (Web)
rustsec.org (Web)
CVE-2021-45707 on other distributions
Each distribution ships its own build and its own fixed version. Pick the one you run:
Details
CVSS:3.1/AV:L/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H
Affected Packages
| Software | From version | Fixed in |
|---|---|---|
| nix | — | — |
References
Similar Threats
- Unknown DEBIAN-CVE-2026-44029
- Unknown openSUSE-SU-2026:10696-1
- Unknown DEBIAN-CVE-2026-44028
- Critical CVE-2026-39860
- Unknown DEBIAN-CVE-2026-39860
More CVE 2021 advisories
Browse all of CVE 2021 in the advisory index.
Site Security Check
Is nix part of your stack?
CVE-2021-45707 is rated CVSS 8.0 High. BotEraser scans your installation against known CVE records and tells you whether this vulnerability applies to the versions you actually run.
Scan My Site Free →No credit card required · Results in minutes
ⓘ Data Notice: The information presented above has been compiled from publicly available internet sources. Boteraser aggregates this data solely for informational purposes and does not independently classify, evaluate, or endorse any findings about the vulnerabilities listed. The accuracy and completeness of this information is the sole responsibility of the original publishers. Boteraser and its operators accept no liability for any decisions made based on this data.