πŸ“¦ Base64 Encoding / Decoding for File Transfers

πŸ“¦ Base64 Encoding / Decoding for File Transfers

Want to move files between systems without network tools? 🀯 You can use Base64 encoding via the terminal to do just that! It’s perfect for quick transfers between machines where you have terminal access but not much else.


πŸ›‘οΈ Step 1: Check the File’s MD5 Hash

Let’s say you have a file like an SSH private key. First, check its MD5 hash to verify integrity later:

z3tssu@htb[/htb]$ md5sum id_rsa

βœ… Example Output:

4e301756a07ded0a2dd6953abf015278  id_rsa

πŸ“€ Step 2: Encode the File to Base64

Use cat and base64 to turn your file into a string:

z3tssu@htb[/htb]$ cat id_rsa | base64 -w 0; echo
  • -w 0 puts everything on one line (easier to copy πŸ“‹)

  • echo helps with formatting by creating a new line

You’ll get a long Base64 string like this:

LS0tLS1CRUdJTiBPUEVOU1NIIFBSSVZBVEUgS0VZLS0tLS0K...

πŸ“₯ Step 3: Transfer & Decode the File on the Target

Paste the Base64-encoded content on your target machine and decode it:

πŸ” This converts the Base64 back into the original file and saves it as id_rsa.


πŸ§ͺ Step 4: Verify the File with MD5

Run md5sum again on the decoded file to confirm the hash matches:

βœ… Should return:

If the hashes match, the transfer was perfectly successful! πŸŽ‰


Transfer Files in Reverse

You can also use this method in reverse! From your compromised machine, use:

Then decode the output on your Pwnbox or local system using:


Last updated