{"id":"RUSTSEC-2021-0119","revision":"5cddedd565d6482f9ae156da40a87bf6","records":[{"revision":"5cddedd565d6482f9ae156da40a87bf6","observedAt":"2026-10-24T13:19:54.901+00:00","statement":{"source":"osv","id":"RUSTSEC-2021-0119","aliases":["CVE-2021-45707","GHSA-76w9-p8mg-j927","GHSA-wgrg-5h56-jg27"],"title":"Out-of-bounds write in nix::unistd::getgrouplist","description":"On certain platforms, if a user has more than 16 groups, the\n`nix::unistd::getgrouplist` function will call the libc `getgrouplist`\nfunction with a length parameter greater than the size of the buffer it\nprovides, resulting in an out-of-bounds write and memory corruption.\n\nThe libc `getgrouplist` function takes an in/out parameter `ngroups`\nspecifying the size of the group buffer. When the buffer is too small to\nhold all of the requested user's group memberships, some libc\nimplementations, including glibc and Solaris libc, will modify `ngroups`\nto indicate the actual number of groups for the user, in addition to\nreturning an error. The version of `nix::unistd::getgrouplist` in nix\n0.16.0 and up will resize the buffer to twice its size, but will not\nread or modify the `ngroups` variable. Thus, if the user has more than\ntwice as many groups as the initial buffer size of 8, the next call to\n`getgrouplist` will then write past the end of the buffer.\n\nThe issue would require editing /etc/groups to exploit, which is usually\nonly editable by the root user.","state":0,"publishedAt":"2021-09-27T12:00:00+00:00","modifiedAt":"2023-11-08T04:07:23.055467+00:00","affected":[{"ecosystem":"crates.io","name":"nix","ranges":[{"type":"SEMVER","events":[{"kind":"introduced","version":"0.16.0"},{"kind":"fixed","version":"0.20.2"},{"kind":"introduced","version":"0.21.0-0"},{"kind":"fixed","version":"0.21.2"},{"kind":"introduced","version":"0.22.0-0"},{"kind":"fixed","version":"0.22.2"},{"kind":"introduced","version":"0.23.0-0"},{"kind":"fixed","version":"0.23.0"}]}],"versions":[],"rawVersionEvidence":null}],"metrics":[],"references":["https://crates.io/crates/nix","https://rustsec.org/advisories/RUSTSEC-2021-0119.html","https://github.com/nix-rust/nix/issues/1541"],"sourceUrl":"https://osv.dev/vulnerability/RUSTSEC-2021-0119","license":"OSV · upstream source license applies","key":"osv:RUSTSEC-2021-0119","identifiers":["RUSTSEC-2021-0119","CVE-2021-45707","GHSA-76w9-p8mg-j927","GHSA-wgrg-5h56-jg27"]},"retained":false,"historicalAffected":[]}],"coverage":[]}