本工具包包含用于分析潜在恶意 SVG 文件并检测安全机制的专用 Python 工具。
该工具包由四个主要工具组成:
一种基于模式的静态分析工具,无需执行任何代码即可从恶意 SVG 文件中解码混淆的 URL。这是进行初步分析时更安全的选择。
String.fromCharCode 模式# Analyze a single SVG file
python3 extract.py -i malicious.svg
# Verbose output showing decoded JavaScript
python3 extract.py -i malicious.svg -v
# Debug mode with detailed analysis steps
python3 extract.py -i malicious.svg -d
# Read from stdin
python3 extract.py < malicious.svg
String.fromCharCode(115,101,99,...)(“secretkey”)parseInt 和 XOR 运算的 for 循环data: URI 中提取并解码 Base64 内容atob("base64") + variableName 模式DYNAMIC SVG URL EXTRACTOR
=========================================================
SVG #1 Results:
----------------------------------------
Obfuscation: XOR decoding (key length: 9)
Extracted URLs:
→ https://malicious.example.com/[email protected]
一款复杂的动态分析工具,使用 box-js 提取并分析 SVG 文件中嵌入的 JavaScript。该工具会在沙箱环境中执行 JavaScript,旨在提取最终完整的 URL,即使这些 URL 是通过复杂混淆构建而成。
location、window.open、fetch、XHR、Image.src 等# Required: box-js must be installed globally
npm install -g box-js
# Python requirements (optional)
pip install -r requirements.txt
# Basic analysis of a single SVG
python3 extract_dynamic.py -i malicious.svg
# Analyze with custom output directory
python3 extract_dynamic.py -i malicious.svg -o analysis_results
# Analyze directory of SVGs with extended timeout
python3 extract_dynamic.py -i svg_samples/ -t 60
# Keep temporary files for debugging
python3 extract_dynamic.py -i malicious.svg --keep-temp
# Save URL blocklist to file
python3 extract_dynamic.py -i malicious.svg --blocklist-out urls.txt
# Mask email addresses for privacy
python3 extract_dynamic.py -i malicious.svg --mask-emails
该工具注入一段全面的 JavaScript 载荷,用于 Hook:
location.href、location.assign()、location.replace()window.open()、导航方法fetch()、XMLHttpRequest.open()String.prototype.concat、字符串处理atob()、decodeURI()、unescape()eval()、Function()、setTimeout()自动检测并处理:
=== Processing: malicious.svg ===
Wrote temp JS -> /tmp/boxjs_svg_ABC/test.boxed.js
Running box-js (timeout 30s) with sink hooks...
[+] box-js finished. Results in: boxjs_out/malicious.svg.boxjs_results
*** FINAL COMPLETE URLs FOUND ***:
→ https://evil.example.com/[email protected]
Emails found:
→ [email protected]
=== FINAL ANALYSIS SUMMARY ===
🎯 COMPLETE URLs EXTRACTED (1 total):
======================================================
→ https://evil.example.com/[email protected]
======================================================
一款网络侦察工具,用于检测 Cloudflare 安全机制,包括跨重定向链的 Turnstile、CAPTCHA 系统、浏览器验证及其他防护措施。
pip install requests
pip install brotli # Optional for brotli support
# Check single URL for Cloudflare protections
python3 cf_probe.py https://example.com
# Scan with JavaScript file analysis
python3 cf_probe.py https://example.com --scan-js
# Process multiple URLs from file
python3 cf_probe.py -i urls.txt
# Custom User-Agent and timeout
python3 cf_probe.py https://example.com -A "Custom-Agent" -t 30
# Disable TLS verification (for testing)
python3 cf_probe.py https://example.com --insecure
# Dump HTML/JS for analysis
python3 cf_probe.py https://example.com --dump analysis_dump/
data-sitekey 属性turnstile.render() JavaScript 调用turnstile.create() JavaScript 调用cf-turnstile CSS 类=== Redirect/Navigation Chain (3 steps) ===
[0] URL: https://example.com
Status: 301
Cloudflare Protection: YES (CF Headers)
CF Header: cf-ray: 123abc456def789
[1] URL: https://protected.example.com
Status: 200
Cloudflare Protection: YES (Turnstile, Custom CAPTCHA)
Turnstile Site key(s): 0x1AAA000000000000000
CAPTCHA Evidence: Click the computer to verify
=== Summary ===
Cloudflare Protection Detected: Turnstile with key(s): 0x1AAA000000000000000 | Custom CAPTCHA
生成带有各种编码模式的混淆 SVG 文件,用于测试分析工具。
# Generate single pattern
python3 encoder.py -u "https://evil.com/c2" -p 1 -o test.svg
# Generate all patterns in directory
python3 encoder.py --random-all -o test_patterns/
# Custom email address
python3 encoder.py -u "https://evil.com" -e "[email protected]" -p 3 -o custom.svg
Function 构造函数进行十六进制编码的动态执行Array.find() 执行的字符映射$ python3 encoder.py --random-all -o test_suite/
Generated xor_proxy_enhanced: test_suite/pattern_01_xor_proxy_enhanced.svg
URL: https://r4nd0m.example.com/[email protected]
Generated hex_function: test_suite/pattern_02_hex_function.svg
URL: https://evil-site.org/[email protected]
[... 4 more patterns ...]
# Step 1: Generate test cases
python3 encoder.py --random-all -o test_cases/
# Step 2: Static analysis first (safer)
python3 extract.py -i test_cases/pattern_01_*.svg -v > static_results.txt
# Step 3: Dynamic analysis (in isolated environment)
python3 extract_dynamic.py -i test_cases/ -o dynamic_results/ --blocklist-out malicious_urls.txt
# Step 4: Verify Cloudflare protection on extracted URLs (if safe to do so)
python3 cf_probe.py -i malicious_urls.txt
# Clone or download the toolkit
cd svg_tools/
# Install Python dependencies
pip install -r requirements.txt
# Install box-js globally (for dynamic analysis)
npm install -g box-js
# Verify installation
python3 extract.py --help
python3 extract_dynamic.py --help
python3 cf_probe.py --help
python3 encoder.py --help