Skip to content
RCE Write-up Advanced

Rooting with chwoot: Deep Dive into CVE-2025-32463

Sudo 1.9.15 changed its root directory to an attacker-controlled location during command path resolution, then later loaded NSS shared libraries relative to that new root. An attacker who controls the directory and nsswitch.conf could get a malicious library loaded and run code as root.

Mohamed Sayed Follow

Published on flex0geek.blogspot.com

on July 20, 2025

Mohamed Sayed (Flex), on flex0geek.blogspot.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the pivot_root/chroot into an attacker-controlled directory happened before NSS libraries were loaded, so dlopen resolved libnss_*.so.2 paths inside that controlled root.

Impact

An attacker able to control the directory and nsswitch.conf could execute arbitrary code as root, escalating privileges on the host.

What the attacker needed

Sudo 1.9.15 installed; control of a directory used as new root; ability to edit nsswitch.conf

The fix

The vulnerable pivot_root logic was removed in version 1.9.17p1, which fixes the issue.

How it was found

  1. Create a fake root directory containing a libnss_ subfolder with a malicious shared object.
  2. Edit nsswitch.conf so the passwd line points to the attacker-chosen NSS module name.
  3. Run sudo with the crafted setup so it pivots into the controlled root.
  4. Sudo later calls dlopen for the NSS library and loads the attacker's object, giving a root shell.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

Sudo is a program that lets ordinary users run commands as the administrator. It also loads small helper libraries to look up user details, and it trusted a folder the attacker could write to when choosing which library to load. That let the attacker's own code run with full administrator rights.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More by Mohamed Sayed

View all

9 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.