Skip to content
Threat Feed
high advisory

Sudo Chroot Privilege Escalation via NSSwitch File Manipulation (CVE-2025-32463)

Attackers can exploit CVE-2025-32463, a privilege escalation vulnerability in `sudo` when used with `chroot`, by creating a malicious `nsswitch.conf` file and associated Name Service Switch (NSS) modules within a controlled chroot environment to trick `sudo` into loading attacker-controlled code, leading to root privileges on Linux systems.

CVE-2025-32463 describes a critical privilege escalation vulnerability affecting the sudo utility when used with the chroot command on Linux systems. This vulnerability allows an attacker to gain root privileges by manipulating the Name Service Switch (NSS) configuration. Specifically, a malicious actor stages a fake root filesystem (e.g., in /tmp/chroot), which includes a specially crafted nsswitch.conf file and attacker-controlled NSS modules (e.g., libnss_*.so). When sudo executes a command within this chroot environment, it can be tricked into resolving names using the attacker's malicious NSS configuration. This forces sudo to load the attacker's libraries, which then execute arbitrary code with root privileges. The technique relies on the creation of nsswitch.conf in non-standard locations by shell processes, serving as an early indicator of this exploitation attempt.

Attack Chain

  1. An attacker establishes initial access to a Linux system as a low-privileged user.
  2. The attacker creates a temporary directory structure to serve as a fake root filesystem, for example, /tmp/chroot.
  3. The attacker places a crafted nsswitch.conf file within this fake root, typically at /tmp/chroot/etc/nsswitch.conf, by using a shell process.
  4. The attacker also places malicious Name Service Switch (NSS) modules (e.g., libnss_*.so) into appropriate library paths within the fake root, such as /tmp/chroot/lib or /tmp/chroot/usr/lib.
  5. The attacker then executes a sudo chroot command, directing it to use the chroot environment they've created (e.g., sudo chroot /tmp/chroot).
  6. During the execution of sudo chroot, if name resolution is triggered, sudo attempts to load NSS modules from the chrooted environment, inadvertently loading the attacker's malicious modules.
  7. The malicious NSS module executes arbitrary code with root privileges, leading to a complete system compromise and full privilege escalation.

Impact

Successful exploitation of CVE-2025-32463 results in complete privilege escalation to root on the affected Linux system. This grants the attacker full control over the compromised machine, enabling them to install backdoors, exfiltrate sensitive data, disrupt services, or launch further attacks. While specific victim numbers are not available, the widespread use of sudo and chroot means a broad range of Linux environments are potentially vulnerable if not patched. Organizations using sudo with chroot functionality are at high risk.

Recommendation

  • Deploy the provided Sigma rule to your SIEM to detect suspicious nsswitch.conf file creations outside standard paths.
  • Patch CVE-2025-32463 immediately by updating sudo and glibc to the latest versions provided by your Linux distribution vendor.
  • Enable comprehensive file creation and process execution logging to capture file.path, process.name, and event.type to activate the rules above.
  • Configure sudoers to disallow chroot if not explicitly required, and enforce env_reset, noexec, and secure_path policies.
  • Mount /tmp and /var/tmp filesystems with noexec, nosuid, and nodev options to prevent execution of attacker-controlled libraries or binaries from user-writable temporary directories.

Detection coverage 1

Detects CVE-2025-32463 Exploitation - Suspicious NSSwitch File Creation

high

Detects CVE-2025-32463 exploitation - suspicious creation of the `nsswitch.conf` file by a shell process outside of the regular `/etc/nsswitch.conf` path, which is an early indicator of an attempt to stage a fake root to coerce `sudo chroot` and hijack NSS resolution.

sigma tactics: privilege_escalation techniques: T1068, T1574, T1574.006 sources: file_event, linux

Detection queries are available on the platform. Get full rules →