mirror of
https://github.com/carlospolop/hacktricks
synced 2024-11-26 22:52:06 +00:00
90 lines
4.3 KiB
Markdown
90 lines
4.3 KiB
Markdown
# PHP SSRF
|
|
|
|
<details>
|
|
|
|
<summary><strong>Leer AWS-hacking vanaf nul tot held met</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (HackTricks AWS Red Team Expert)</strong></a><strong>!</strong></summary>
|
|
|
|
Ander maniere om HackTricks te ondersteun:
|
|
|
|
* As jy wil sien dat jou **maatskappy geadverteer word in HackTricks** of **HackTricks aflaai in PDF-formaat**, kyk na die [**INSKRYWINGSPLANNE**](https://github.com/sponsors/carlospolop)!
|
|
* Kry die [**amptelike PEASS & HackTricks swag**](https://peass.creator-spring.com)
|
|
* Ontdek [**Die PEASS Familie**](https://opensea.io/collection/the-peass-family), ons versameling eksklusiewe [**NFTs**](https://opensea.io/collection/the-peass-family)
|
|
* **Sluit aan by die** 💬 [**Discord-groep**](https://discord.gg/hRep4RUj7f) of die [**telegram-groep**](https://t.me/peass) of **volg** ons op **Twitter** 🐦 [**@carlospolopm**](https://twitter.com/hacktricks\_live)**.**
|
|
* **Deel jou haktruuks deur PR's in te dien by die** [**HackTricks**](https://github.com/carlospolop/hacktricks) en [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github-opslag.
|
|
|
|
</details>
|
|
|
|
**Try Hard Security Group**
|
|
|
|
<figure><img src="/.gitbook/assets/telegram-cloud-document-1-5159108904864449420.jpg" alt=""><figcaption></figcaption></figure>
|
|
|
|
{% embed url="https://discord.gg/tryhardsecurity" %}
|
|
|
|
***
|
|
|
|
### SSRF PHP funksies
|
|
|
|
Sommige funksies soos **file\_get\_contents(), fopen(), file(), md5\_file()** aanvaar URL's as insette wat hulle sal volg en sodoende **moontlike SSRF-gebreke** kan veroorsaak as die gebruiker die data kan beheer:
|
|
```php
|
|
file_get_contents("http://127.0.0.1:8081");
|
|
fopen("http://127.0.0.1:8081", "r");
|
|
file("http://127.0.0.1:8081");
|
|
md5_file("http://127.0.0.1:8081");
|
|
```
|
|
### CRLF
|
|
|
|
Verder, in sommige gevalle kan dit selfs moontlik wees om arbitrêre koppe te stuur via CRLF "kwesbaarhede" in die vorige funksies:
|
|
```php
|
|
# The following will create a header called from with value Hi and
|
|
# an extra header "Injected: I HAVE IT"
|
|
ini_set("from", "Hi\r\nInjected: I HAVE IT");
|
|
file_get_contents("http://127.0.0.1:8081");
|
|
|
|
GET / HTTP/1.1
|
|
From: Hi
|
|
Injected: I HAVE IT
|
|
Host: 127.0.0.1:8081
|
|
Connection: close
|
|
|
|
# Any of the previously mentioned functions will send those headers
|
|
```
|
|
{% hint style="warning" %}
|
|
Vir meer inligting oor daardie CRLF-fout, kyk na hierdie fout [https://bugs.php.net/bug.php?id=81680\&edit=1](https://bugs.php.net/bug.php?id=81680\&edit=1)
|
|
{% endhint %}
|
|
|
|
Merk op dat hierdie funksie moontlik ander metodes het om arbitrêre koppe in versoeke in te stel, soos:
|
|
```php
|
|
$url = "";
|
|
|
|
$options = array(
|
|
'http'=>array(
|
|
'method'=>"GET",
|
|
'header'=>"Accept-language: en\r\n" .
|
|
"Cookie: foo=bar\r\n" . // check function.stream-context-create on php.net
|
|
"User-Agent: Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.102011-10-16 20:23:10\r\n" // i.e. An iPad
|
|
)
|
|
);
|
|
|
|
$context = stream_context_create($options);
|
|
$file = file_get_contents($url, false, $context);
|
|
```
|
|
**Try Hard Security Group**
|
|
|
|
<figure><img src="/.gitbook/assets/telegram-cloud-document-1-5159108904864449420.jpg" alt=""><figcaption></figcaption></figure>
|
|
|
|
{% embed url="https://discord.gg/tryhardsecurity" %}
|
|
|
|
|
|
<details>
|
|
|
|
<summary><strong>Leer AWS hakwerk vanaf nul tot held met</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (HackTricks AWS Red Team Expert)</strong></a><strong>!</strong></summary>
|
|
|
|
Ander maniere om HackTricks te ondersteun:
|
|
|
|
* As jy jou **maatskappy geadverteer wil sien in HackTricks** of **HackTricks in PDF wil aflaai** Kyk na die [**INSKRYWINGSPLANNE**](https://github.com/sponsors/carlospolop)!
|
|
* Kry die [**amptelike PEASS & HackTricks swag**](https://peass.creator-spring.com)
|
|
* Ontdek [**Die PEASS Familie**](https://opensea.io/collection/the-peass-family), ons versameling eksklusiewe [**NFTs**](https://opensea.io/collection/the-peass-family)
|
|
* **Sluit aan by die** 💬 [**Discord groep**](https://discord.gg/hRep4RUj7f) of die [**telegram groep**](https://t.me/peass) of **volg** ons op **Twitter** 🐦 [**@carlospolopm**](https://twitter.com/hacktricks\_live)**.**
|
|
* **Deel jou haktruuks deur PRs in te dien by die** [**HackTricks**](https://github.com/carlospolop/hacktricks) en [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
|
|
|
|
</details>
|