Spawing Interactive Shells
🧠 Spawning Interactive Shells
When you land a limited shell (non-tty), your capabilities may be restricted:
No prompt
No job control
Limited or blocked commands (e.g.,
sudo
,su
,ctrl + c
)
Use one of the following methods to upgrade to an interactive TTY shell, depending on which tools/languages are available on the system.
📜 Methods for Spawning TTY Shells
🐍 Python (most common)
Alternative (if python3
is available):
🧮 /bin/sh (Bourne Shell)
Launches an interactive shell directly
🧙 Perl
Or, from a script:
💎 Ruby
From script:
🐢 Lua
From script:
🧾 AWK
Uses
system()
to spawn shell viaawk
, available on most Unix systems
🔍 Find
Searches for a file, and spawns a shell using awk
:
Or directly invoke shell:
📝 VIM
Escape to shell from within Vim:
Or manually from Vim:
🔐 Checking Execution Permissions
Check if you can run a file or binary:
Example:
🔑 Check sudo
Permissions
sudo
PermissionsIf you have a stable interactive shell, run:
Example output:
Indicates full sudo access without password — potential for privilege escalation.
⚠️ Note: sudo -l
may not work in unstable or limited shells.
Last updated