Sudo Service Privilege Escalation
The service command is vulnerable to privilege escalation if we can execute as root.
If we can execute service command as root, we may be able to escalate to root privilege.
Assume we can operate the vsftpd service as root. Firse off, find the service config file for vsftpd.
For instance, we'll find the location as below.
When getting the locations, the next thing to do is to check the permission. If we have a write permission for the above each files, we can update the execution when vsftpd started.
Insert the payload for reverse shell to the value of the “ExecStartPre”. Doing this, we can get a shell from our listener when the FTP daemon restarted.
Then we need to reload the daemon.
In local machine, start listener for getting a shell.
Now execute the command which can be executed with sudo.
We should get a shell as root user.
Last updated