# Kupitisha Kinga za Proksi / WAF
Jifunze kuhusu kudukua AWS kutoka sifuri hadi shujaa na htARTE (Mtaalam wa Timu Nyekundu ya AWS ya HackTricks)! 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 kudukua kwa kuwasilisha PRs kwa** [**HackTricks**](https://github.com/carlospolop/hacktricks) na [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) repos za github.
{% embed url="https://websec.nl/" %} ## Kupitisha Sheria za ACL za Nginx kwa Kudhibiti Jina la Njia Mbinu [kutoka kwa utafiti huu](https://rafa.hashnode.dev/exploiting-http-parsers-inconsistencies). Mfano wa sheria ya Nginx: ```plaintext location = /admin { deny all; } location = /admin/ { deny all; } ``` Kwa lengo la kuzuia njia za kuzunguka, Nginx hufanya upanuzi wa njia kabla ya kuikagua. Hata hivyo, ikiwa seva ya nyuma inafanya upanuzi tofauti (kuondoa herufi ambazo nginx haiondoi) inaweza kuwa inawezekana kuzunguka ulinzi huu. ### **NodeJS - Express** | Nginx Version | **Node.js Bypass Characters** | | ------------- | ----------------------------- | | 1.22.0 | `\xA0` | | 1.21.6 | `\xA0` | | 1.20.2 | `\xA0`, `\x09`, `\x0C` | | 1.18.0 | `\xA0`, `\x09`, `\x0C` | | 1.16.1 | `\xA0`, `\x09`, `\x0C` | ### **Flask** | Nginx Version | **Flask Bypass Characters** | | ------------- | -------------------------------------------------------------- | | 1.22.0 | `\x85`, `\xA0` | | 1.21.6 | `\x85`, `\xA0` | | 1.20.2 | `\x85`, `\xA0`, `\x1F`, `\x1E`, `\x1D`, `\x1C`, `\x0C`, `\x0B` | | 1.18.0 | `\x85`, `\xA0`, `\x1F`, `\x1E`, `\x1D`, `\x1C`, `\x0C`, `\x0B` | | 1.16.1 | `\x85`, `\xA0`, `\x1F`, `\x1E`, `\x1D`, `\x1C`, `\x0C`, `\x0B` | ### **Spring Boot** | Nginx Version | **Spring Boot Bypass Characters** | | ------------- | --------------------------------- | | 1.22.0 | `;` | | 1.21.6 | `;` | | 1.20.2 | `\x09`, `;` | | 1.18.0 | `\x09`, `;` | | 1.16.1 | `\x09`, `;` | ### **PHP-FPM** Nginx FPM configuration: ```plaintext location = /admin.php { deny all; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php8.1-fpm.sock; } ``` Nginx imeboreshwa kuzuia ufikiaji wa `/admin.php` lakini inawezekana kuidanganya kwa kufikia `/admin.php/index.php`. ### Jinsi ya kuzuia ```plaintext location ~* ^/admin { deny all; } ``` ## Kupita Sheria za Mod Usalama ### Kupotosha Njia [Katika chapisho hili](https://blog.sicuranext.com/modsecurity-path-confusion-bugs-bypass/) imeelezwa kuwa ModSecurity v3 (hadi 3.0.12), **haikutekeleza ipasavyo kipengele cha `REQUEST_FILENAME`** ambacho kilipaswa kuwa na njia iliyofikiwa (hadi mwanzo wa vigezo). Hii ni kwa sababu ilifanya URL decode kupata njia.\ Hivyo, ombi kama `http://example.com/foo%3f';alert(1);foo=` katika mod usalama itadhani kuwa njia ni `/foo` kwa sababu `%3f` inabadilishwa kuwa `?` ikimaliza njia ya URL, lakini kwa kweli njia ambayo seva itapokea itakuwa `/foo%3f';alert(1);foo=`. Vipengele `REQUEST_BASENAME` na `PATH_INFO` pia vilikuwa vimeathiriwa na kosa hili. Kitu kama hicho kilitokea katika toleo la 2 la Mod Security ambalo liliruhusu kukiuka ulinzi uliokuwa unazuia mtumiaji kupata faili zenye nyongeza maalum zinazohusiana na faili za nakala rudufu (kama vile `.bak`) kwa kutuma tu dot URL encoded katika `%2e`, kwa mfano: `https://example.com/backup%2ebak`. ## Kupita AWS WAF ACL ### Kichwa Kimeharibika [Utafiti huu](https://rafa.hashnode.dev/exploiting-http-parsers-inconsistencies) unataja kuwa ilikuwa inawezekana kukiuka sheria za AWS WAF zilizotumika kwenye vichwa vya HTTP kwa kutuma kichwa "kilichoharibika" ambacho hakikuwa kimechambuliwa ipasavyo na AWS lakini kilikuwa na seva ya nyuma. Kwa mfano, kutuma ombi lifuatalo lenye sindano ya SQL kwenye kichwa X-Query: ```http GET / HTTP/1.1\r\n Host: target.com\r\n X-Query: Value\r\n \t' or '1'='1' -- \r\n Connection: close\r\n \r\n ``` Ilionekana inawezekana kudukua AWS WAF kwa sababu haingeweza kuelewa kuwa mstari ufuatao ni sehemu ya thamani ya kichwa wakati server ya NODEJS ilifanya (hii ilisuluhishwa). ## Marejeo * [https://rafa.hashnode.dev/exploiting-http-parsers-inconsistencies](https://rafa.hashnode.dev/exploiting-http-parsers-inconsistencies) * [https://blog.sicuranext.com/modsecurity-path-confusion-bugs-bypass/](https://blog.sicuranext.com/modsecurity-path-confusion-bugs-bypass/)
{% embed url="https://websec.nl/" %}
Jifunze kuhusu kudukua AWS kutoka sifuri hadi shujaa na htARTE (Mtaalam wa Timu Nyekundu ya AWS ya HackTricks)! 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) 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.