{"id":"GHSA-wgrg-5h56-jg27","revision":"4ebc294a72b44466829f160e6b5bdfa3","records":[{"revision":"4ebc294a72b44466829f160e6b5bdfa3","observedAt":"2026-10-24T13:19:54.901+00:00","statement":{"source":"osv","id":"GHSA-wgrg-5h56-jg27","aliases":["CVE-2021-45707","GHSA-76w9-p8mg-j927","RUSTSEC-2021-0119"],"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 reqested 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.\n","state":0,"publishedAt":"2022-06-17T00:13:59+00:00","modifiedAt":"2026-09-10T03:49:44.2307553+00:00","affected":[{"ecosystem":"crates.io","name":"nix","ranges":[{"type":"SEMVER","events":[{"kind":"introduced","version":"0.16.0"},{"kind":"fixed","version":"0.20.2"}]}],"versions":[],"rawVersionEvidence":null},{"ecosystem":"crates.io","name":"nix","ranges":[{"type":"SEMVER","events":[{"kind":"introduced","version":"0.21.0"},{"kind":"fixed","version":"0.21.2"}]}],"versions":[],"rawVersionEvidence":null},{"ecosystem":"crates.io","name":"nix","ranges":[{"type":"SEMVER","events":[{"kind":"introduced","version":"0.22.0"},{"kind":"fixed","version":"0.22.2"}]}],"versions":[],"rawVersionEvidence":null}],"metrics":[{"system":"Publisher rating","vector":null,"score":null,"severity":"HIGH"}],"references":["https://github.com/nix-rust/nix/issues/1541","https://github.com/nix-rust/nix","https://rustsec.org/advisories/RUSTSEC-2021-0119.html"],"sourceUrl":"https://github.com/advisories/GHSA-wgrg-5h56-jg27","license":"GitHub Advisory Database · CC-BY-4.0","key":"osv:GHSA-wgrg-5h56-jg27","identifiers":["GHSA-wgrg-5h56-jg27","CVE-2021-45707","GHSA-76w9-p8mg-j927","RUSTSEC-2021-0119"]},"retained":false,"historicalAffected":[]}],"coverage":[]}