Skip to content

Commit 71ce00f

Browse files
authored
Merge pull request #1153 from HackTricks-wiki/research_update_src_pentesting-web_ssrf-server-side-request-forgery_url-format-bypass_20250719_012840
Research Update Enhanced src/pentesting-web/ssrf-server-side...
2 parents 104d4e1 + cd2780d commit 71ce00f

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

src/pentesting-web/ssrf-server-side-request-forgery/url-format-bypass.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,46 @@ The “left square bracket” character `[` in the userinfo segment can cause Sp
217217

218218
image from [https://claroty.com/2022/01/10/blog-research-exploiting-url-parsing-confusion/](https://claroty.com/2022/01/10/blog-research-exploiting-url-parsing-confusion/)
219219

220+
### IPv6 Zone Identifier (%25) Trick
221+
222+
Modern URL parsers that support RFC 6874 allow *link-local* IPv6 addresses to include a **zone identifier** after a percent sign. Some security filters are not aware of this syntax and will only strip square-bracketed IPv6 literals, letting the following payload reach an internal interface:
223+
224+
```text
225+
http://[fe80::1%25eth0]/ # %25 = encoded '%', interpreted as fe80::1%eth0
226+
http://[fe80::a9ff:fe00:1%25en0]/ # Another example (macOS style)
227+
```
228+
229+
If the target application validates that the host is *not* `fe80::1` but stops parsing at the `%`, it may incorrectly treat the request as external. Always normalise the address **before** any security decision or strip the optional zone id entirely.
230+
231+
### Recent Library Parsing CVEs (2022–2025)
232+
233+
A number of mainstream frameworks have suffered from hostname-mismatch issues that can be exploited for SSRF once URL validation has been bypassed with the tricks listed above:
234+
235+
| Year | CVE | Component | Bug synopsis | Minimal PoC |
236+
|------|-----|-----------|--------------|-------------|
237+
| 2024 | CVE-2024-22243 / ‑22262 | Spring `UriComponentsBuilder` | `[` is not allowed in the *userinfo* section, so `https://example.com\[@internal` is parsed as host `example.com` by Spring but as `internal` by browsers, enabling open-redirect & SSRF when host allow-lists are used. Upgrade to Spring 5.3.34 / 6.0.19 / 6.1.6+. |
238+
| 2023 | CVE-2023-27592 | **urllib3** <1.26.15 | Backslash confusion allowed `http://example.com\\@169.254.169.254/` to bypass host filters that split on `@`. |
239+
| 2022 | CVE-2022-3602 | OpenSSL | Hostname verification skipped when the name is suffixed with a `.` (dotless ___domain confusion). |
240+
241+
When you depend on third-party URL parsers, **compare the canonicalised host returned by the library you trust with the raw string supplied by the user** to detect these classes of issues.
242+
243+
### Payload-generation helpers (2024+)
244+
245+
Creating large custom word-lists by hand is cumbersome. The open-source tool **SSRF-PayloadMaker** (Python 3) can now generate *80 k+* host-mangling combinations automatically, including mixed encodings, forced-HTTP downgrade and backslash variants:
246+
247+
```bash
248+
# Generate every known bypass that transforms the allowed host example.com to attacker.com
249+
python3 ssrf_maker.py --allowed example.com --attacker attacker.com -A -o payloads.txt
250+
```
251+
252+
The resulting list can be fed directly into Burp Intruder or `ffuf`.
253+
220254
## References
221255

222256
- [https://as745591.medium.com/albussec-penetration-list-08-server-side-request-forgery-ssrf-sample-90267f095d25](https://as745591.medium.com/albussec-penetration-list-08-server-side-request-forgery-ssrf-sample-90267f095d25)
223257
- [https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Server%20Side%20Request%20Forgery/README.md](https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Server%20Side%20Request%20Forgery/README.md)
224258
- [https://portswigger.net/research/new-crazy-payloads-in-the-url-validation-bypass-cheat-sheet](https://portswigger.net/research/new-crazy-payloads-in-the-url-validation-bypass-cheat-sheet)
259+
- [https://nvd.nist.gov/vuln/detail/CVE-2024-22243](https://nvd.nist.gov/vuln/detail/CVE-2024-22243)
260+
- [https://github.com/hsynuzm/SSRF-PayloadMaker](https://github.com/hsynuzm/SSRF-PayloadMaker)
225261

226262
{{#include ../../banners/hacktricks-training.md}}

0 commit comments

Comments
 (0)