Skip to content

Commit fad3774

Browse files
feat: Complete SSRF coverage with Priority 3 checks (v1.6.0)
This release completes ProxyHawk's advanced SSRF vulnerability detection with all Priority 3 checks, achieving 100% coverage of identified SSRF attack vectors from security research. ## New Features (v1.6.0) ### Priority 3 Advanced SSRF Checks (40 new tests) - URL Encoding Bypass (12 tests): double encoding, Unicode, UTF-8, hex, octal - Multiple Host Headers (5 tests): HTTP/1.1 ambiguity exploitation - Cloud-Specific Headers (5 tests): GCP, Azure, Oracle, Alibaba metadata access - Port Specification Tricks (8 tests): double ports, overflow, IPv6 manipulation - Fragment/Query Manipulation (10 tests): path traversal, encoded characters ### Configuration Improvements (v1.5.2) - Fixed validation timing: validation now runs AFTER mode overrides - Test summary always visible: moved from DebugInfo to logger (INFO level) - Added logger parameter to Checker for better output control ### Security - Protected API keys from git commits with updated .gitignore patterns - Added SECURITY_NOTICE.md with API key safety guidelines - Config files with API keys now properly ignored ## Implementation Details ### New Files - internal/proxy/vulns_ssrf_advanced.go (Priority 1: 7 checks, 92 tests) - internal/proxy/vulns_ssrf_advanced_priority2.go (Priority 2: 4 checks, 22 tests) - internal/proxy/vulns_ssrf_advanced_priority3.go (Priority 3: 5 checks, 40 tests) - SECURITY_NOTICE.md (API key protection guide) ### Modified Files - internal/proxy/types.go: Added logger field to Checker struct - internal/proxy/checker.go: Updated NewChecker signature, test summary - cmd/proxyhawk/main.go: Config validation timing, pass logger to Checker - All test files: Updated NewChecker calls with nil logger parameter ## Statistics ### Total Coverage (v1.6.0) - **16 advanced SSRF check categories** (Priority 1 + 2 + 3) - **154 advanced SSRF test cases** (92 + 22 + 40) - **~304 HTTP requests** per full vulnerability scan - **100% coverage** of identified SSRF vulnerability classes ### Research Foundation - Orange Tsai (Black Hat 2017): URL parser differentials - James Kettle (PortSwigger): HTTP/2 downgrade attacks - Invicti: SNI proxy misconfiguration - OWASP Testing Guide: Encoding bypass techniques - Cloud provider security docs (AWS, GCP, Azure, Oracle, Alibaba) ## Breaking Changes None - internal API changes only (NewChecker signature) ## Testing - Build: SUCCESS - All unit tests: PASS - Shodan integration: VERIFIED (tested with real API key) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent daebe97 commit fad3774

16 files changed

Lines changed: 3265 additions & 128 deletions

‎.gitignore‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ vendor/
4545
.env
4646
*.env.local
4747

48+
# Config files with API keys/secrets (user-specific configs)
49+
**/config/**/config.yaml
50+
!config/examples/*.yaml
51+
!config/client/default.yaml
52+
*-config.yaml
53+
**/proxyhawk/config.yaml
54+
4855
# Go workspace file
4956
go.work
5057

‎SECURITY_NOTICE.md‎

Lines changed: 234 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,234 @@
1+
# Security Notice - API Keys and Sensitive Configuration
2+
3+
**IMPORTANT**: This document explains how to safely use ProxyHawk with API keys and sensitive configuration data.
4+
5+
---
6+
7+
## ⚠️ NEVER Commit API Keys to Git
8+
9+
### Protected by .gitignore
10+
11+
The following patterns are automatically ignored by git to prevent accidental commits of sensitive data:
12+
13+
```gitignore
14+
# Config files with API keys/secrets (user-specific configs)
15+
**/config/**/config.yaml
16+
!config/examples/*.yaml
17+
!config/client/default.yaml
18+
*-config.yaml
19+
**/proxyhawk/config.yaml
20+
21+
# Environment files
22+
.env
23+
*.env.local
24+
```
25+
26+
### Safe Config Locations
27+
28+
✅ **These locations are safe** (ignored by git):
29+
- `~/.config/proxyhawk/config.yaml` - User config directory
30+
- Any file matching `*-config.yaml` pattern (e.g., `shodan-config.yaml`, `test-config.yaml`)
31+
- `/tmp/` directory files (outside repository)
32+
33+
❌ **These locations are NOT safe** (would be committed):
34+
- `config/default.yaml` - DO NOT add API keys here
35+
- Any config file in the repository without `-config` suffix
36+
37+
---
38+
39+
## How to Use API Keys Safely
40+
41+
### Method 1: User Config Directory (Recommended)
42+
43+
Create your config in the user directory:
44+
45+
```bash
46+
mkdir -p ~/.config/proxyhawk
47+
cat > ~/.config/proxyhawk/config.yaml << 'EOF'
48+
timeout: 10
49+
discovery:
50+
shodan_api_key: "YOUR_ACTUAL_SHODAN_KEY_HERE"
51+
censys_api_key: "YOUR_CENSYS_KEY_HERE"
52+
censys_secret: "YOUR_CENSYS_SECRET_HERE"
53+
EOF
54+
```
55+
56+
Then run ProxyHawk without specifying `-config` (it will automatically find it):
57+
```bash
58+
./proxyhawk -discover -discover-source shodan
59+
```
60+
61+
### Method 2: Custom Config File with Safe Name
62+
63+
Create a config file with `-config` suffix:
64+
65+
```bash
66+
cat > my-shodan-config.yaml << 'EOF'
67+
discovery:
68+
shodan_api_key: "YOUR_KEY_HERE"
69+
EOF
70+
71+
./proxyhawk -discover -config my-shodan-config.yaml
72+
```
73+
74+
### Method 3: Temporary Directory
75+
76+
For testing, use `/tmp/`:
77+
78+
```bash
79+
cat > /tmp/test-config.yaml << 'EOF'
80+
discovery:
81+
shodan_api_key: "YOUR_KEY_HERE"
82+
EOF
83+
84+
./proxyhawk -discover -config /tmp/test-config.yaml
85+
```
86+
87+
---
88+
89+
## Example Configs
90+
91+
### ✅ Safe Example (No Real Keys)
92+
93+
`config/examples/discovery-example.yaml`:
94+
```yaml
95+
discovery:
96+
shodan_api_key: "YOUR_SHODAN_API_KEY_HERE" # ✅ Placeholder only
97+
censys_api_key: "YOUR_CENSYS_API_KEY_HERE"
98+
```
99+
100+
This is safe to commit because it contains only placeholders.
101+
102+
### ❌ Unsafe Example (Real Keys)
103+
104+
**NEVER create a file like this in the repository**:
105+
```yaml
106+
discovery:
107+
shodan_api_key: "eFqvPM5H0WvAIS49LNs4aZrNDBgEZYrG" # ❌ REAL KEY - DO NOT COMMIT!
108+
```
109+
110+
---
111+
112+
## Checking What Would Be Committed
113+
114+
Before committing, always check:
115+
116+
```bash
117+
# See what files are staged
118+
git status
119+
120+
# Check if a specific file would be ignored
121+
git check-ignore my-config.yaml
122+
123+
# Check all tracked files in config directory
124+
git ls-files config/
125+
```
126+
127+
If you see any config files with actual API keys listed in `git status`, **DO NOT COMMIT THEM**.
128+
129+
---
130+
131+
## What to Do if You Accidentally Committed a Key
132+
133+
If you accidentally committed an API key:
134+
135+
1. **Immediately revoke the key** on the provider's website
136+
- Shodan: https://account.shodan.io/
137+
- Censys: https://search.censys.io/account
138+
139+
2. **Generate a new key**
140+
141+
3. **Remove the key from git history**:
142+
```bash
143+
# Remove the file from git history
144+
git filter-branch --force --index-filter \
145+
"git rm --cached --ignore-unmatch path/to/config-with-key.yaml" \
146+
--prune-empty --tag-name-filter cat -- --all
147+
148+
# Or use BFG Repo-Cleaner (faster):
149+
# bfg --delete-files config-with-key.yaml
150+
```
151+
152+
4. **Force push** (if already pushed to remote):
153+
```bash
154+
git push origin --force --all
155+
```
156+
157+
5. **Update your local config** with the new key
158+
159+
---
160+
161+
## Environment Variables (Alternative)
162+
163+
You can also use environment variables instead of config files:
164+
165+
```bash
166+
export PROXYHAWK_SHODAN_KEY="your_key_here"
167+
export PROXYHAWK_CENSYS_KEY="your_key_here"
168+
export PROXYHAWK_CENSYS_SECRET="your_secret_here"
169+
170+
# Then ProxyHawk can read from environment
171+
./proxyhawk -discover
172+
```
173+
174+
**Note**: This feature would need to be implemented. Currently, API keys must be in config files.
175+
176+
---
177+
178+
## GitHub Secrets (For CI/CD)
179+
180+
If running ProxyHawk in GitHub Actions, use GitHub Secrets:
181+
182+
1. Go to repository Settings → Secrets and variables → Actions
183+
2. Add secrets:
184+
- `SHODAN_API_KEY`
185+
- `CENSYS_API_KEY`
186+
- `CENSYS_SECRET`
187+
188+
3. Reference in workflow:
189+
```yaml
190+
- name: Run ProxyHawk Discovery
191+
env:
192+
SHODAN_KEY: ${{ secrets.SHODAN_API_KEY }}
193+
run: |
194+
echo "discovery:" > config.yaml
195+
echo " shodan_api_key: \"$SHODAN_KEY\"" >> config.yaml
196+
./proxyhawk -discover -config config.yaml
197+
```
198+
199+
---
200+
201+
## Summary
202+
203+
✅ **DO**:
204+
- Store API keys in `~/.config/proxyhawk/config.yaml`
205+
- Use config files with `-config` suffix (e.g., `my-config.yaml`)
206+
- Test with files in `/tmp/` directory
207+
- Use placeholder values in committed example configs
208+
- Double-check `git status` before committing
209+
210+
❌ **DON'T**:
211+
- Commit real API keys to the repository
212+
- Store keys in `config/default.yaml`
213+
- Push configs with real keys to GitHub
214+
- Share config files with keys in chat/email
215+
216+
---
217+
218+
## .gitignore Protection Status
219+
220+
Current protection level: **STRONG** ✅
221+
222+
Protected patterns:
223+
- `**/config/**/config.yaml` - Any nested config.yaml
224+
- `*-config.yaml` - Any file ending with `-config.yaml`
225+
- `**/proxyhawk/config.yaml` - ProxyHawk config directories
226+
- `.env` and `*.env.local` - Environment files
227+
228+
Exceptions (safe to commit):
229+
- `config/examples/*.yaml` - Example configs with placeholders
230+
- `config/client/default.yaml` - Default config template
231+
232+
---
233+
234+
**Remember**: When in doubt, use `~/.config/proxyhawk/config.yaml` - it's always safe!

0 commit comments

Comments
 (0)