Sudo Systemctl Privilege Escalation
sudo systemctl is vulnerable to privilege escalation by modifying the configuration file.
Modify Configurations
If we can run "systemctl" command as root, and we can edit the config file, then we might be a root user.
1. Update the Config File
We need to insert the payload for reverse shell to get a root shell into the /etc/systemd/system/example.service.
Replace “<local-ip>” with your local ip address.
2. Start Listener in Local Machine
Then start listener for getting a root shell.
3. Restart the Service
Reload the daemon and restart.
Now we should get a shell in local machine.
Spawn Shell in the Pager
If we can execute systemctl status
as root, we can spawn another shell in the pager.
Just run the command with sudo
.
Then enter the following command in the pager like less
.
Spawning the shell, then we can get another user shell.
Last updated