VYPR
Moderate severityNVD Advisory· Published Dec 26, 2021· Updated Aug 4, 2024

CVE-2021-45707

CVE-2021-45707

Description

An out-of-bounds write in nix::unistd::getgrouplist occurs when a user belongs to more than 16 groups, leading to memory corruption.

AI Insight

LLM-synthesized narrative grounded in this CVE's description and references.

An out-of-bounds write in nix::unistd::getgrouplist occurs when a user belongs to more than 16 groups, leading to memory corruption.

Vulnerability

An out-of-bounds write vulnerability exists in the nix::unistd::getgrouplist function of the Rust nix crate, affecting versions 0.16.0 and later before 0.20.2, 0.21.x before 0.21.2, and 0.22.x before 0.22.2 [1][3]. The function wraps the libc getgrouplist call with an in/out parameter ngroups indicating the buffer size. When the initial buffer (size 8) is too small, certain libc implementations (e.g., glibc) modify ngroups to the actual number of groups and return an error. However, the nix wrapper resizes the buffer to twice its size but does not update ngroups accordingly, so a subsequent call can write past the buffer end if the user has more than 16 groups (i.e., more than twice the initial buffer size) [3][4].

Exploitation

An attacker would need the ability to add a user to more than 16 groups in /etc/groups, which typically requires root or equivalent administrative privileges on the system [3][4]. The vulnerable code path is triggered by any application that calls nix::unistd::getgrouplist for a user with such a large group membership. No user interaction beyond this call is required; the out-of-bounds write occurs in the libc function's call within the nix wrapper.

Impact

Successful exploitation results in an out-of-bounds write, causing memory corruption [3][4]. This can lead to undefined behavior, including denial of service, data corruption, or potentially arbitrary code execution depending on the memory layout and system state. The compromise occurs at the privilege level of the process calling getgrouplist.

Mitigation

The issue is fixed in nix versions 0.20.2, 0.21.2, 0.22.2, and all later versions (>=0.23.0) [3][4]. Users should upgrade to one of these patched releases. No workaround is available for unpatched versions; the vulnerability is considered low severity because exploitation requires administrative access to group files. The CVE is not listed in the known exploited vulnerabilities (KEV) catalog as of publication.

AI Insight generated on May 21, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
nixcrates.io
>= 0.16.0, < 0.20.20.20.2
nixcrates.io
>= 0.21.0, < 0.21.20.21.2
nixcrates.io
>= 0.22.0, < 0.22.20.22.2

Affected products

3

Patches

0

No patches discovered yet.

Vulnerability mechanics

AI mechanics synthesis has not run for this CVE yet.

References

6

News mentions

0

No linked articles in our index yet.