CTF思路
点击放大

> A currated list of all capture the flag tips and strategies to sol CTF challenges and Hackthebox Machines.
---
<!-- TOC start (generated with ) -->
<!-- TOC end -->
To disco, services, and efficiently in CTF en, Nmap is a critical tool. Below are curated commands and strategies:
---
#### 🔍 Discover Li in a Subnet:
Use this to quickly find which machines are up.
#### 🔧 Service and Detection:
Identify open ports and the of services running.
#### 🚨 Scanning:
Uses default detection scripts against known services.
#### 🔍 Aggressive Full Port + OS Detection + Script Scanning:
Scans all 65535 TCP ports with OS, detection, script scanning and traceroute.
#### 🔐 SSL/TLS Enumeration:
Displays supported SSL/TLS ciphers for HTTPS services.
---
Focus on commonly used service ports.
Scans the 100 most common ports.
Useful for services like DNS (53), SNMP (161).
Try brute force login on exposed FTP.
List web directories.
Helpful for lateral mo or sensitive info.
Runs a set of default scripts for information gathering.
Useful for documentation or later review.
---
Le Nmap's script database (ls /usr/share/nmap/scripts/) to explore more targeted scripts based on your CTF scenario.
Stay stealthy when required, and always adapt your scanning strategy to the time constraints and rules of the challenge.
To passively disco on the network, use Netdiscover. It listens for ARP requests to identify li without sending packets, making it ideal for stealth reconnaissance in CTFs or red team exercises.
If unsure of your interface, identify it using:
Sample Output:
---
-r flag to scan specific subnet range:Faster than default mode for known ranges (e.g., in HackTheBox or TryHackMe labs).
netdiscover to find acti and then monitor them with packet sniffers.netdiscover running in a separate terminal to monitor new devices that join the network.---
Important: Netdisco only on local networks. It cannot disco outside of your subnet.
For maximum effecti, always complement passi with acti (like Nmap) once initial targets are discovered.
---
To scan for web using Nikto, a powerful web ser that tests for thousands of known issues.
This tool is effective for identifying outdated software, insecure configurations, and common CVEs.
---
Detects SSL-specific .
Useful for documentation or post-exploitation analysis.
Often CTFs run web servers on non-standard ports.
Intercept and analyze requests manually.
gobuster, wpscan, or custom scripts.---
Note: Nikto is noisy and easily detectable. Avoid using in stealth/red team scenarios unless allowed.
When ports 80 (HTTP) or 443 (HTTPS) are open, it likely indicates a web service. This presents an opportunity to enumerate for flags, directories, and .
---
Common in CTFs for holding easter eggs or clues.
Sample Output:
Look at the Server: header to find out if it’s Apache, Nginx, or a specific .
---
This may indicate:
#### Workarounds:
Sometimes port a changes after time or after other ports are probed.
Example output:
SYN scans (-sS) may be blocked or filtered by the firewall, while -sT (full TCP handshake) can bypass it in some setups.
---
whatweb or wappalyzer to detect CMS or frameworks.gobuster or dirsearch for brute-forcing directories:admin:admin, guest:guest).---
Web services often hold CTF flags in directories, source code comments, or misconfigurations. Always inspect thoroughly!
---
To enumerate hidden directories and files on a web server, directory brute-forcing is essential in CTFs.
#### Using wfuzz:
#### Using gobuster (faster alternative):
#### Using dirsearch (Python-based tool):
---
.php, .txt, .bak, etc.dirsearch to go deep into discovered folders..git/, config.php, .env.wfuzz:---
Use cewl to crawl a target website and generate a custom wordlist based on its content—useful for password attacks, username discovery, or directory bruteforcing.
#### Basic Usage:
#### Word Count:
---
-d) to extract words from deeper pages (e.g., /about, /team, /login).-e to include email addresses in output:-a) to bypass basic WAFs:--with-numbers if the site includes numbers in words (e.g., admin123).---
When ports 139/445 are open, the target may be running SMB (Ser Block)—commonly misconfigured in CTFs, making it a goldmine for enumeration and exploitation.
---
#### 🔍 Anonymous Share Enumeration
Lists a shares. If successful without credentials, the ser anonymous login.
---
#### 📂 Mounting SMB Share (Anonymous or Authenticated)
Or use credentials:
---
#### 🔐 With Credentials – Using smbmap
Enumerates shares, permissions, and access level.
---
#### 🚀 Gaining Shell – Using psexec.py
If credentials are valid and ADMIN$ is accessible, this will drop you into a SYSTEM shell.
---
enum4linux for a quick, detailed SMB sweep:Backups, Users, or C$.smbclient interactively to explore shares:-N):psexec.py fails, try wmiexec.py, smbexec.py, or atexec.py (from Impacket).crackmapexec for wide-scale credential spraying:---
Hard Disk (VHD) files are often found in forensic or Windows-based CTF challenges. These can contain hidden flags, user profiles, or sensiti.
---
#### 📦 List Contents of the VHD
Quickly inspects the archive to confirm structure before mounting.
---
#### 🔗 Mount VHD with Guestmount
--inspector: Auto-detects and mounts the correct partition.-ro: Mounts as read-only (safe for analysis).-v: Enables output.Make sure libguestfs-tools is installed.
---
.flag, .txt, or .zip inside Desktop, Downloads, Documents.AppData/RoamingUsers/<name>/RecentThen mount using loop device:
strings or binwalk to extract clues from within the VHD file:---
Use searchsploit to quickly find known exploits or from the Exploit-DB repository.
#### Basic Usage:
Searches for Apache exploits in the local database.
---
-x to open the exploit directly:---
If /wp-login.php is discovered during web enumeration, the target is likely running WordPress—a common and often CMS in CTFs.
---
#### 🔑 Brute Force Login with Hydra
F= string based on response for failed login.---
#### 🔎 Scan for Plugins, Themes, and with WPScan
---
#### 🐚 Reverse Shell Upload (Metasploit)
---
/readme.html or wp-includes/.php for WordPress leakage.eval() usage in plugin files.---
If port 135 (or 445 with RPC over SMB) is open, it indicates a Windows host with Remote Procedure Call (RPC) capabilities. Misconfigured RPC access can expose usernames, shares, and domain info.
---
#### 🔐 Anonymous RPC Login
Press Enter when prompted for a password to attempt a null session.
---
smbclient to access user directories based on enum results.rpcclient -U user%pass <HOST> for full access.---
PowerShell is a powerful post-exploitation and enumeration tool on Windows machines.
---
#### 🚫 Bypass Execution Policy
Allows execution of unsigned scripts without modifying system-wide policy.
---
-w hidden to suppress PowerShell window (post-exploit):---
---
#### 🔓 Login Bypass Payloads
These exploit MongoDB’s flexible querying:
These payloads allow login by returning true on any non-null or regex match.
---
| Injection | Description |
|-------------------------|-------------------------------------|
| URL parameters | ?username[$ne]=1&password[$ne]=1 |
| Form fields (POST) | login inputs |
| JSON body (APIs) | {"username": {"$ne": null}} |
| HTTP headers | X-User: {"$gt": ""} |
---
Try brute-forcing usernames one letter at a time:
Check for response differences to confirm partial matches.
---
#### 🔍 Extract Usernames
This helps disco users:
---
$where)If $where is supported (JS injection):
Enumerate the length first, then extract char-by-char.
---
If errors don’t help, exploit time:
Or for some frameworks:
If delay occurs, injection is successful.
---
#### 🛠️ NoSQLMap
Use for:
#### 🐍 Burp Suite + Intruder
1. Intercept login POST request.
2. Send to Intruder.
3. Fuzz with:
- [$ne]=1
- [$regex]=^a
- [$where]=...
Monitor responses for .
---
If user exists:
If login succeeds, you’ user admin exists.
To bypass:
If admin panel access is via role:
---
Bypass weak sanitization:
username[$in][]%24ne, %24regex---
X-User, X-Auth) for NoSQL injection in hidden APIs.$where.---
---
Recon is critical in CTFs. Use these tools to gather intelligence before exploiting.
---
#### 🔎 Passi
site:<target.com> ext:logintitle:index.of "backup"---
#### 🌐 Subdomain & Certificate Enumeration
---
#### 📧 Email & Breach Lookup
---
#### 🧠 Fingerprinting and Tech Stack
---
#### 🔐 Headers, Files, and Hidden Paths
---
#### 🕵️♀️ Information Har from Search Engines
-b all for multiengine scraping.---
cewl, crunch).Ping Sweep a network.
SYN Scan with Speed of 4 and port of common 1000 TCP.
All Port scan with All Scanning including OS, , Script and Traceroute.
To scan for UDP Ports (Dont scan all scans, as it takes lot of time).
---
Payloads are code executed on the target after exploitation. In Metasploit, they’re categorized as Staged and Non-Staged.
---
#### 🧱 Non-Staged Payload (Single Payload)
---
#### 🧩 Staged Payload (Modular/Two-Step)
---
msfvenom to generate standalone payloads:multi/handler in Metasploit to catch the shell:---
Shells are essential for post-exploitation access. They can be Bind Shells or Reverse Shells, depending on which side initiates the connection.
---
#### 🔗 Bind Shell
Target listens, and attacker connects in.
1️⃣ On Target (create shell):
2️⃣ On Attacker (connect to shell):
---
#### 🔁 Reverse Shell
Attacker listens, and target connects back.
1️⃣ On Attacker (listen):
2️⃣ On Target (trigger shell):
---
#### 🧪 Perl Reverse Shell (Common in CTFs)
---
If you get a basic shell, upgrade it:
And make it interactive:
---
rlwrap or script to wrap Netcat for history/na.socat or mkfifo shell:---
Buffer o exploits can be used to execute arbitrary code, often giving shell access. One key step is injecting shellcode into the program's memory.
---
#### 🛠️ Generate Shellcode with pwntools (Python)
Quick shellcode to spawn /bin/sh:
---
#### 🔁 Pipe Shellcode into Binary
cat keeps the session ali payload injection.---
pwntools debugger:ROPgadget to find useful instructions for ret2libc or ROP chaining.---
Gobuster is a fast, flexible tool used to brute-force directories, files, and hosts on web servers—critical for disco hidden content during CTFs.
---
#### 🔍 Basic Directory Enumeration
-x php,txt,bak for better results.---
#### 🍪 With Cookies (Authenticated Enumeration)
---
/usr/share/wordlists/dirb/common.txt/usr/share/seclists/Discovery/Web-Content/raft-medium-words.txt-k to ignore SSL (CTFs often use self-signed certs):/admin, /upload, /debug, /backup---
SQLMap automates the detection and exploitation of SQL injection flaws. In CTFs, it’s a fast way to extract databases, users, tables, and even get shells.
---
#### 🔁 Capturing HTTP Request via Burp Suite
1. Intercept a POST request:
2. Right-click → Save to File (e.g., search.req)
---
#### 🚀 Running SQLMap on the Captured Request
-r: Use raw HTTP request file.--batch: Run without interacti.--force-ssl: Useful for HTTPS endpoints.---
---
---
PDFs in CTFs often hide flags using layers, compression, white text, or embedded objects.
---
#### 🖱️ Manual Extraction (Quick Try)
1. Open PDF → Ctrl + A → Ctrl + C
2. Paste into Notepad or any plain text editor.
> ✅ Works if text is layered or colored white.
---
#### 🎨 Use Inkscape (For Embedded/Layered Flags)
1. Open PDF in Inkscape
2. Repeatedly click "Ungroup" (Shift + Ctrl + G)
3. Look for:
- White-on-white text
- Hidden objects or o
- Off-canvas data
> Great for or image-embedded flags.
---
#### 🔧 Decompress PDF with qpdf
flag, HTB, CTF{, etc.---
pdf-parser.py (by Didier Stevens) to inspect PDF objects:binwalk if the PDF is embedded with other files:tesseract) if text is embedded inside images:---
In CTFs, compressed files may hide flags deeply nested or disguised using alternate extensions or embedded formats.
---
#### 🔍 Identify File Type (Magic Bytes)
Check the file header:
50 4B (PK), it’s likely a ZIP file, even if the extension is misleading.---
#### 🧨 Extract Recursively with binwalk
-M: Enables recursi of embedded files.-e: Automatically extracts known file types._FILE_NAME.extracted/.---
file command to confirm type:7z for unknown or nested formats:fcrackzip or john to brute-force:.jpg, .png, or .docx hide zips internally. Use binwalk or steghide to detect.---
CTF files often hide flags in binary, encoded, or obfuscated forms. Use basic Linux tools for deep inspection.
---
#### 🔍 View Embedded or Encoded Text
Use strings to extract ASCII-readable data:
Use hexeditor to manually inspect binary layout:
flag{...}, HTB{...}, or even Unicode-encoded text.---
#### 🔐 Detect Base64 (Common in CTFs)
If you see patterns like:
The == ending suggests base64 encoding:
---
#### 🧩 Monitor Syscalls with strace:
-f: Follow child processes.-s: Increase string capture size (default is 32).#### 🧬 Track Function Calls with ltrace:
---
strace with tee or grep to li extracted data.---
A Caesar cipher is a simple substitution cipher where each letter is shifted by a fixed number in the alphabet.
---
#### 🧭 Classic Caesar Decryption
If the challenge mentions "caesar", it’s likely using a basic shift cipher.
Or use dCode Caesar Solver.
---
#### 🧱 Caesar Box Cipher
If ciphertext contains characters like ! or appears block-like:
Use:
👉 Caesar Box Solver
Paste text and bruteforce dimensions or square sizes.
---
---
The Vigenère cipher is a polyalphabetic substitution cipher that uses a repeating key to shift letters.
---
#### 🔓 Crack Without Knowing the Key
Use this online bruteforce solver:
👉 Guballa Vigenère Solver
---
flag, ctf, security, secret, pass---
The One-Time Pad is an unbreakable cipher when used properly (random key, used once, same length as plaintext). In CTFs, it's often improperly implemented—making it crackable.
---
#### 🔓 Solve OTP Easily
Use this online tool:
👉 OTP Decryption Tool
---
If OTP is a red herring and you find an id_rsa file, use john to crack it:
> ✅ Often used to escalate after retrieving a user's private key in challenges.
---
xxd to identify XOR patterns in binary OTP files.---
Images often hide flags using steganography, metadata, or embedded file structures.
---
#### 📄 Identify Image File Type
---
#### 🧬 Metadata Analysis
Author, Comment, or GPS coordinates.Software, UserComment, or DocumentName.---
#### 🔍 Steganography – Extract Hidden Data
Use zsteg for LSB & color-channel payloads (PNG only):
Use steghide for password-protected embedded content:
rockyou.txt for brute-force attempts.Brute-force steghide with steghide_brute (optional tool):
---
#### 🔡 Extract Embedded Text
---
binwalk to detect embedded ZIPs, images, or files:hexeditor) to inspect tail-end anomalies.stegsolve.jar or StegSpy for deeper analysis.---
binwalk is used to analyze binary files (like images or firmware) for embedded files, compressed archives, or hidden content.
---
#### 🔍 Basic Scan
---
#### 🧠 If ZIP/Archive Is Detected
You can extract it manually:
---
#### 🔓 Auto Extract All Embedded Files
_<IMAGE_NAME>.extracted/---
#### 🔁 Recursi (Handles nested archives)
---
--dd to extract specific types manually:steghide, exiftool, and zsteg after extraction.footer of embedded files — flags may be appended after legitimate content.---
NTFS files may contain hidden data, alternate streams, or partitioned content—commonly le in CTFs.
---
#### 🪟 On Windows (Alternate Data Streams)
1️⃣ List Hidden Streams:
2️⃣ Extract Hidden Stream Content:
or
3️⃣ Use 7-Zip to extract .ntfs containers directly:
---
#### 🐧 On Linux
Mount the NTFS image:
mnt/ for flags in $MFT, $Recycle.Bin, or System Information.---
ntfs-3g for full read/write NTFS access on Linux.sleuthkit or autopsy for forensic-level NTFS inspection.---
Use this method to image and extract deleted file systems remotely—commonly required in forensic or IR-based CTFs.
---
#### 📡 Step 1: Create Disk Image Remotely (via SSH)
dcfldd: Forensic-friendly dd with progress and hashing.gzip: Compress data during transfer.---
#### 📦 Step 2: Decompress Image Locally
---
#### 🔍 Step 3: Extract and Analyze
---
dcfldd not a, use:photorec or foremost for file carving:fdisk -l extract.ddfls and icat from SleuthKit for targeted recovery:---
In CTFs, .pcap or .pcapng files may contain USB keyboard traffic, especially when analyzing hardware-le.
---
#### 🔍 Extract USB Keystrokes from PCAP
Use tshark to extract USB data:
usb.transfer_type == 1: Captures interrupt transfers (used for keyboard).usb.capdata: Extracts raw keystroke data.---
#### 🧠 Full Guide for Decoding USB Input
Follow this detailed article:
👉 Reverse USB Keystrokes from PCAP (Kaizen CTF)
---
usb.deusb.transfer_typeusb.capdataframe contains flag.pcap files:NetworkMiner or tcpflow to reconstruct files or extract credentials.strings on PCAP for quick wins:---
Obfuscated Ja is often used in web-based CTFs to hide logic, flags, or backdoor payloads.
---
#### 🧼 Deobfuscate Quickly
Use this online tool:
👉 JSNice
---
eval() patterns—common obfuscation tricks.eval() with console.log() to inspect decoded payload.prettier or js-beautify locally:---
If the challenge references "JOHN", it's likely hinting at using John the Ripper to crack hashes or protected archives.
---
#### 🧨 Basic Usage
MD5, SHA1, bcrypt, NTLM, etc.---
#### 🔍 Identify Hash Type (if needed)
Or use [hash-identifier] or [NameThatHash].
---
#### 🌐 Online Cracking (Known Hashes)
Use:
👉 CrackStation
---
zip2john, rar2john, pdf2john, ssh2john, etc.---
SAM (Security Account Manager) stores hashed passwords for Windows accounts. In CTFs, it’s often extracted from mounted .vhd or .img disk files.
---
#### 🔓 Extract and Dump Hashes
1️⃣ Copy the SAM and SYSTEM files:
2️⃣ Organize files:
3️⃣ Dump hashes using impacket-secretsdump:
✅ You’ll get outputs like:
---
john:mmls + fls + icat (SleuthKit) for forensic-style SAM/SYSTEM extraction from raw disk images.---
/etc/passwd + /etc/shadowIn Linux systems, user credentials are stored across two files:
/etc/passwd – stores usernames and UID info/etc/shadow – stores password hashes (restricted access)---
#### 🔐 Combine with unshadow
---
#### 🔓 Crack with John the Ripper
---
$6$ – SHA-512$1$ – MD5$y$ – yescrypt (more secure)john --show to reveal cracked results:---
Hashcat is a powerful tool to crack hashes using GPU acceleration—ideal for large datasets or tougher hashes.
---
#### 🚀 Basic Syntax
-m 500: Hash type (500 = MD5 crypt, i.e., $1$)-a 0: Attack mode (0 = dictionary attack)-o: Output file for cracked results--force: Ignore warnings (used in VMs or non-GPU systems)---
-m):| Hash Type | Example Prefix | Mode |
|------------------|----------------|------|
| MD5 | — | 0 |
| SHA1 | — | 100 |
| SHA256 | — | 1400 |
| bcrypt | $2y$, $2b$ | 3200 |
| NTLM | — | 1000 |
| SHA512-crypt | $6$ | 1800 |
| MD5-crypt | $1$ | 500 |
> 🔍 Use hashid or hashid <hash> to detect the hash type.
---
--show to display cracked results:unshadow, zip2john, or ssh2john by identifying their format and using the right mode.---
To extract and crack a password-protected .7z archive, use 7z2john.py from the John the Ripper suite.
#### 🔧 Convert to Hash Format:
#### 🔓 Crack with John:
---
If given an encrypted SSH private key (id_rsa), you can recover its password using ssh2john.py.
#### 🔧 Convert Key to Hash Format:
#### 🔓 Crack with John:
---
john fails, try hashcat with proper hash mode (e.g., -m 14600 for 7z).backup.7z, id_rsa.bak)—they often contain credentials.---
Use these tools to automate pri escalation, system enumeration, and data decoding—critical for post-exploitation in CTFs.
---
#### 🐧 Linux Enumeration
linpeas.sh – Most comprehensi enumeration script.---
#### 🪟 Windows Enumeration
winPEAS.exe – Deep enumeration of Windows services, tasks, misconfigs.---
#### 🕵️ Runtime Process/Job Monitoring
---
#### ⚙️ Exploit Execution Help
sudo, setuid, and capability binaries for pri escalation.---
#### 🧬 Data Analysis & Decoding
---
---
Exploit older Linux kernels with DirtyCow:
👉 PoC Code: dirty.c
---
Check sudo pri:
Common exploit patterns:
---
In Meterpreter:
🔍 Other Tools:
🧬 Migrate Process:
Shell Delivery:
---
MySQL Shell:
:
---
Monitor system jobs:
O input:
---
If executed via a pri script:
Example within :
---
---
Linux:
Windows:
---
If login successful:
---
Multi-threaded recon and service enumeration:
👉 Reconnoitre Tool
---
开发语言:未知
Star 数:147
该项目属于CTF思路方向的开源资源,代码结构清晰,适合安全研究人员学习参考。项目围绕CTF Cheatsheet展开,提供了可运行的实现,对理解相关安全机制、工具原理与攻防技术具有较高的研究价值。
从技术实现角度看,此类项目的核心在于对底层原理的深入理解与工程化落地。开发者在研究过程中可以结合官方文档与社区讨论,梳理项目的初始化流程、核心模块职责与数据流转,逐步掌握其中的技术细节与设计思路。
1. 下载源码压缩包,解压到本地环境。
2. 根据项目类型准备对应的运行环境与依赖。
3. 按照 README 中的步骤完成配置与部署。
4. 在隔离的测试环境中运行验证,避免影响生产系统。
本资源来源于开源社区,仅供安全研究、技术学习与合法授权范围内的攻防演练使用,请勿用于任何非法或侵害他人权益的用途。使用本项目产生的一切后果由使用者自行承担。
| 资源标题 | awesome-ctf-cheatsheet - CTF备忘单 |
| 所属分类 | CTF思路 |
| 发布作者 | admin |
| 发布时间 | 2026-10-05 23:50:10 |
| 下载权限 | 免费下载 |
| 附件数量 | 2 个下载链接 |
| 浏览次数 | 368 |
| 讨论数量 | 0 |
| 主题状态 | 正常讨论中 |