Vulnerability DatabaseGHSA-wgrg-5h56-jg27

GHSA-wgrg-5h56-jg27
Rust vulnerability analysis and mitigation

Overview

An out-of-bounds write vulnerability was discovered in the nix crate 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 for Rust. The vulnerability affects the unistd::getgrouplist function when a user is in more than 16 /etc/groups groups. This security issue was reported on September 27, 2021, and was assigned CVE-2021-45707 with a CVSS v3.1 base score of 9.8 (Critical) (NVD, RustSec).

Technical details

The vulnerability stems from the nix::unistd::getgrouplist function's interaction with the libc getgrouplist function. The libc function takes an in/out parameter ngroups specifying the size of the group buffer. When the buffer is too small, certain libc implementations (including glibc and Solaris libc) modify ngroups to indicate the actual number of groups while returning an error. The nix implementation resizes the buffer to twice its size but fails to update the ngroups variable accordingly. This mismatch between the buffer capacity and ngroups value leads to an out-of-bounds write when the user has more than twice as many groups as the initial buffer size of 8 (GitHub Advisory).

Impact

The vulnerability can result in memory corruption, potential segmentation faults, and allocator corruption when destroying the Vec buffer. This leads to undefined behavior in the affected systems. The severity is rated as Critical with a CVSS v3.1 base score of 9.8, indicating the potential for high impact on system security (NVD).

Mitigation and workarounds

The vulnerability has been patched in versions 0.20.2, 0.21.2, 0.22.2, and all versions from 0.23.0 onwards. Users should upgrade to these patched versions to mitigate the vulnerability. The fix involves properly updating the ngroups parameter to match the buffer's capacity in each loop iteration (RustSec).

Additional resources


SourceThis report was generated using AI

Related Rust vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2026-22698HIGH8.7
  • RustRust
  • sm2
NoNoJan 10, 2026
CVE-2026-22700HIGH7.5
  • RustRust
  • sm2
NoNoJan 10, 2026
CVE-2026-22699HIGH7.5
  • RustRust
  • sm2
NoNoJan 10, 2026
CVE-2026-22705MEDIUM6.4
  • RustRust
  • ml-dsa
NoYesJan 10, 2026
CVE-2025-15504MEDIUM4.8
  • PythonPython
  • lief
NoYesJan 10, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management