What’s Sudo Shell Escaping
Sudo shell escaping refers to a technique where a user with limited privileges uses sudo to bypass restrictions and execute commands as a higher-privileged user, typically root. This can occur if the sudo configuration (the sudoers file) allows running commands that invoke a shell or provide shell-like functionality.
Getting Privilege Escalation
To gain higher privileges using sudo, follow these steps:
Check how many commands you can run with
sudoas a low-privilege user:1sudo -l

As seen in the image, there are some tools and services that can be run as `sudo`. To make exploitation easier, we can visit this site: [GTFOBins](https://gtfobins.github.io/).
This site provides a lot of useful information. Let's search for one of these services, such as **Vim**.

Simply copy the following command and paste it into your target terminal, and you will gain root privileges.
Conclusion
In conclusion, sudo shell escaping is a powerful technique that can be exploited to gain unauthorized root access on a system. By identifying commands that can be run with elevated privileges, attackers can leverage tools like GTFOBins to execute malicious payloads and bypass security restrictions. Understanding these offensive methods is crucial for penetration testers and security professionals as they simulate attacks and identify vulnerabilities.
