Sudo misconfigurations on Linux systems provide a common vector for privilege escalation. Attackers exploit overly permissive sudo rules to gain root-level access.

How It Happens

If a user can run commands as root without password or with unrestricted arguments, they might execute arbitrary commands as root.

Examples

  • Running /bin/bash with sudo:
    sudo /bin/bash
    
  • Using allowed commands with shell escapes:
    sudo vim -c ':!sh'
    
  • Exploiting vulnerable scripts run via sudo:

Detection & Mitigation

  • Regularly audit /etc/sudoers and sudoers.d files

  • Limit commands users can run with sudo

  • Avoid NOPASSWD for dangerous commands

Misconfigured sudo is a low-hanging fruit in many Linux privilege escalation scenarios.

References:

  • GTFOBins: Sudo

  • Linux Privilege Escalation Guide by Pentest Academy