Local privilege escalation with sudo via shell escape

by FelixBauer
GNU/Linux ◆ foot-extra ◆ zsh 358 views

tina has sudo (with configuration mistake) permissions to run systemctl

We abuse it to get root making use of nanos shell escape

https://gtfobins.github.io/gtfobins/nano/

We can not pass environmental variables through sudo in this case so the fix is to define sudoedit as the editor (which does not have a shell escape) and further limit access to systemctl e.g. with further arguments (restart|status)