Quick Checks before escalation
Before we start the action let's check our capabilities and manage our shell
let's check what can be used and what cannot
for cmd in gcc cc python perl python3 python2 wget curl fetch nc ncat nc.traditional socat; do which $cmd >/dev/null 2>&1 && echo "[✔] $cmd: $(which $cmd)" || echo "[✘] $cmd: Not found"; done
tip
If you are not able to execute above one liner you can use which command to check for capabilites one by one such as which python
.Knowing capabilites will help you to select the type of exploits that can be execute in the machine
After you know your capabilites you can use below commands to spawn a TTY shell
Get into tty shell
Python TTY shell
python -c 'import pty; pty.spawn("/bin/bash")'
Perl TTY shell
perl —e 'exec "/bin/sh";'
perl: exec "/bin/sh";
Ruby TTY shell
perl -e “exec ‘/bin/bash’;”
info
Some times in restricted environment you might not be able to execute the above commands so you have to be creative and keep looking for other options across the internet, Keep Trying
.