🛡️ CVE-2021-45707 — nix

🟠 CVSS 8.0 — High ✅ No Known Exploit CWE-787 OSV
8.0
CVSS Score
0 Low4 Medium7 High9 Critical10

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

Severity HIGH
CVSS Score 8.0
CVSS Vector CVSS:3.1/AV:L/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H
CWE CWE-787
Public Exploit ✅ No
Source OSV
Published 2022-01-06
Updated 2026-08-12
Modified 2026-07-08
Fix URL N/A

Affected Packages

Software From version Fixed in
nix

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.