Sudo Privilege escalation

Systemctl

systemctl is vulnerable to privilege escalation by modifying the configuration file.

If we can run "systemctl" command as root, and we can edit the config file, then we might be a root user.

Case #1 Modify the configuration file

We need to insert the payload for reverse shell to get a root shell into the /etc/systemd/system/example.service.

Finally restart the service

Case #2 systemctl permissions to see the status

If we can execute systemctl status as root, we can spawn another shell in the pager.

Doas

doas is an alternative to sudo typically found on OpenBSD operating systems, but that can be installed on Debian-base Linux OSes like Ubuntu.

Last updated