File Transfers

Download Operations

Terminal String Copy & Paste

Linux Encode Base64

cat id_rsa |base64 -w 0;echo

Windows Decode & Write Base64

cmd.exe has a maximum string length of 8,191 & powershell.exe has a maximum string length 2,147,483,647 characters

Web Downloads with Wget & cURL

Download a File Using wget

Fileless Download with wget

Download a File Using cURL

Fileless Download with cURL

Download with Bash (/dev/tcp)

Connect to the Target Webserver

HTTP GET Request

PowerShell Web Downloads

DownloadFile Method

DownloadString - Fileless Method

Invoke-WebRequest

You can use the aliases iwr, curl, and wget instead of the Invoke-WebRequest full name

Common Errors with PowerShell

There may be cases when the Internet Explorer first-launch configuration has not been completed, which prevents the download. This can be bypassed using the parameter -UseBasicParsing
Another error in PowerShell downloads is related to the SSL/TLS secure channel if the certificate is not trusted. We can bypass that error with the following command

SMB Downloads

Create the SMB Server

Copy a File from the SMB Server

New versions of Windows block unauthenticated guest access

Create the SMB Server with Username & Password

Mount the SMB Server with Username and Password

You can also mount the SMB server if you receive an error when you use copy filename \\IP\sharename.

FTP Downloads

Installing the FTP Server Python3 Module - pyftpdlib

Setting up a Python3 FTP Server

Transfering Files from an FTP Server Using PowerShell

Command File for FTP Client To Download File

You may not have an interactive shell. If that's the case, we can create an FTP command file to download a file

Upload Operations

Terminal String Copy & Paste

Windows Encode & Write Base64

Linux Decode Base64

Web Uploads with cURL

PowerShell Web Uploads

Installing a Configured WebServer with Upload

PowerShell Script to Upload a File to Python Upload Server

PowerShell Base64 Web Upload

SMB Uploads

Commonly enterprises don't allow the SMB protocol (TCP/445). An alternative is to run SMB over HTTP with WebDav. When you use SMB, it will first attempt to connect using the SMB protocol, and if there's no SMB share available, it will try to connect using HTTP

Installing WebDav Python modules

Using the WebDav Python module

Connecting to the Webdav Share

DavWWWRoot is a special keyword recognized by the Windows Shell. No such folder exists on your WebDAV server. You can avoid using this keyword if you specify a folder that exists on your server when connecting to the server. For example: \192.168.49.128\sharefolder

Uploading Files using SMB

If there are no SMB (TCP/445) restrictions, you can use impacket-smbserver the same way we set it up for download operations.

FTP Uploads

You need to specify the option --write to allow clients to upload files to our attack host

PowerShell Upload File

Command File for FTP Client to Upload File

Mounting a Linux Folder With RDP

Mounting Using rdesktop

Mounting Using xfreerdp

Evading Detection

Listing out User Agents

Request with Chrome User Agent

Transferring File with GfxDownloadWrapper.exe

Last updated