A critical vulnerability was recently identified in the widely-used sudo utility, affecting systems that rely on host-based rules in the sudoers file. Known as CVE‑2025‑32462, this bug allows low-privileged local users to escalate to root by abusing the -h/--host option. Discovered by Rich Mirch of Stratascale and present in sudo for over a decade, this flaw highlights the need for diligent patching—even in mature tools like sudo.
In the blog post, we’ll cover what the issue is, how it works, how to detect it, and most importantly, how to fix it.
- What’s Going On?
- Who Is at Risk?
- How It Works
- Detection & Testing
- Fix and Recommendations
- Conclusion
What’s Going On?
- The
-h/--hostflag insudowas originally intended to list how a user’s permissions apply on different hosts—not for executing commands. - Due to a logic oversight, this flag could be misused to apply permissions from a different host context, effectively bypassing host-based restrictions in the
sudoersfile.
Who Is at Risk?
- Environments using host-based
sudoersrules, especially withHostorHost_Aliasdirectives—typical in LDAP or multi-machine setups. - All versions of
sudofrom 1.8.8 up to, but not including, 1.9.17p1. - Affects major Linux distributions (Ubuntu, Debian, Red Hat, SUSE, Alpine, Amazon Linux, etc.) and Unix-like systems including macOS.
How It Works
- An attacker with a low-privileged account on
hostAuses:
sudo -h hostB <allowed-command>
sudoapplies permissions intended forhostB, nothostA.- Even if the user is restricted on
hostA, they can now run root commands that are permitted onhostB.
Detection & Testing
- Search your
sudoersand/etc/sudoers.d/files forHostorHost_Aliasdirectives. - Attempt the exploit by running a harmless command with
-hto test if host-based rules are enforced.
Example:
sudo -h <trusted-host> -l
If host-based restrictions don’t apply as expected, your sudo version is vulnerable.
Fix and Recommendations
- Upgrade sudo to
v1.9.17p1or later using your distro’s package manager. - Review
sudoersconfigurations—minimize the use of host-based rules. - For added security, monitor
sudousage and consider removing the-hoption or move toward centralized authorization (e.g., LDAP).
Conclusion
This vulnerability shows that even seasoned tools like sudo can harbor high-impact bugs when new flags are introduced. If your setup uses host-specific rules in sudoers, your systems are at risk unless updated.
Next steps:
- Patch systems immediately to v1.9.17p1 or newer.
- Audit
sudoersfor host-based policies. - Continue security reviews for foundational tools.
📝 For more information about this vulnerability, please review this article.