Transfer & Exfiltration

Encryption before transferring

Notes and commands for Encryption before transferring.

2024-03-28
Tags file-transferencryption-before-transferring

As a pentester, encrypt files before transferring to protect client data.

PowerShell encryption module

Import the module:

1
PS C:\htb> Import-Module .\Invoke-AESEncryption.ps1

Encrypt a file:

1
PS C:\htb> Invoke-AESEncryption -Mode Encrypt -Key "p4ssw0rd" -Path .\scan-results.txt

This generates a new file with the .aes extension.

Encrypt files using OpenSSL

1
Momothechi@htb[/htb]$ openssl enc -aes256 -iter 100000 -pbkdf2 -in /etc/passwd -out passwd.enc

After pressing Enter, provide a password.

Decrypt using OpenSSL

1
Momothechi@htb[/htb]$ openssl enc -d -aes256 -iter 100000 -pbkdf2 -in passwd.enc -out passwd