刚完成CTFshow Web1-20系列挑战时,我意识到信息收集的质量直接决定解题效率。不同于常规的逐题解析,这里将分享经过实战验证的系统性方法——这些技巧不仅能用于CTF竞赛,在合法授权的渗透测试中同样适用。
浏览器开发者工具(F12)是基础中的基础,但90%的新手只停留在"Elements"标签页。进阶操作包括:
Ctrl+Shift+F跨文件搜索关键词(如flag、password)bash复制# 快速获取页面源码的curl命令
curl -s http://example.com | grep -i "flag\|comment"
注意:禁用右键的页面通常通过
oncontextmenu事件实现,可用以下代码绕过:
javascript复制document.oncontextmenu = null;
敏感文件泄露在真实漏洞中占比高达34%(据HackerOne 2023报告)。必备检查清单:
| 文件类型 | 典型路径 | 检测工具 |
|---|---|---|
| 版本控制文件 | /.git/ /svn/ | GitHack, dvcs-ripper |
| 备份文件 | /index.php.bak | dirsearch, gobuster |
| 编辑器缓存 | *.swp *.swo | find / -name "..sw" |
| 数据库文件 | /db.mdb /backup.sql | sqlmap --file-read |
推荐工具组合:
python复制# 自动化探测脚本示例
import requests
from concurrent.futures import ThreadPoolExecutor
def check_path(url, path):
try:
r = requests.get(f"{url}/{path}", timeout=3)
if r.status_code == 200:
print(f"[+] Found: {path}")
except:
pass
common_paths = ['.git', 'robots.txt', 'backup.zip']
with ThreadPoolExecutor(10) as executor:
[executor.submit(check_path, target_url, p) for p in common_paths]
响应头常包含关键线索,重点关注这些字段:
使用Burp Suite的Repeater模块时,建议添加这些头部:
http复制GET / HTTP/1.1
Host: example.com
X-Forwarded-For: 127.0.0.1
User-Agent: Mozilla/5.0 (compatible; Googlebot/2.1)
手工测试效率有限,智能工具组合能提升10倍效率:
初始扫描:使用Nikto进行快速安全评估
bash复制nikto -h http://target.com -output nikto_scan.html
深度爬取:OWASP ZAP的主动扫描模式
敏感文件发现:定制化字典的Dirsearch
bash复制python3 dirsearch.py -u http://target.com -e php,js,bak -w custom.txt
专业提示:调整
--delay参数避免触发WAF,企业级目标建议设置为300ms以上
通过文件元数据可能发现:
ExifTool经典用法:
bash复制exiftool -a -u -g1 image.jpg # 查看图片元数据
pdfinfo document.pdf # 提取PDF信息
真实案例:某次CTF中,通过PNG图片的Photoshop元数据发现内网IP段
当直接渗透受阻时,尝试:
site:github.com "target.com" password推荐信息聚合工具:
python复制# 使用API查询子域名
import shodan
api = shodan.Shodan('API_KEY')
results = api.search(f'hostname:*.target.com')
超越常规Web路径的检查点:
使用Nmap进行服务发现:
bash复制nmap -sV --script=http-enum target.com -p 80,443,8000-9000
现代Web应用常见漏洞模式:
硬编码凭证:
javascript复制// 反例
const API_KEY = 'sk_live_1234567890';
调试接口:
javascript复制fetch('/internal/api/users')
.then(res => res.json())
加密参数逆向:
python复制# 使用Python调用前端加密逻辑
from py_mini_racer import MiniRacer
ctx = MiniRacer()
ctx.eval(open('crypto.js').read())
ctx.call('encrypt', 'payload')
技术手段失效时的备选方案:
实用技巧:在登录页面尝试?debug=true参数,可能开启调试模式
高效选手的装备清单:
浏览器插件:
本地脚本:
bash复制# 快速检查HTTP头
alias checkheaders="curl -I -s http://\$1 | grep -iE 'server|x-powered'"
自定义字典:
text复制# 备份文件字典
backup_2023.zip
v2.1.3.tar.gz
prod.sql.bak
在最近一次企业授权测试中,通过组合使用.git泄露扫描和GitHack工具,我们成功还原了完整的源代码树,最终在config.php中发现数据库凭证。这种系统化的信息收集方法,远比随机猜测高效得多。