diff --git a/SUMMARY.md b/SUMMARY.md index 60279767a..0103b2fa9 100644 --- a/SUMMARY.md +++ b/SUMMARY.md @@ -604,7 +604,7 @@ * [OAuth to Account takeover](pentesting-web/oauth-to-account-takeover.md) * [Open Redirect](pentesting-web/open-redirect.md) * [ORM Injection](pentesting-web/orm-injection.md) -* [Parameter Pollution](pentesting-web/parameter-pollution.md) +* [Parameter Pollution | JSON Injection](pentesting-web/parameter-pollution.md) * [Phone Number Injections](pentesting-web/phone-number-injections.md) * [PostMessage Vulnerabilities](pentesting-web/postmessage-vulnerabilities/README.md) * [Blocking main page to steal postmessage](pentesting-web/postmessage-vulnerabilities/blocking-main-page-to-steal-postmessage.md) diff --git a/pentesting-web/parameter-pollution.md b/pentesting-web/parameter-pollution.md index aec575d7a..bbf96ae34 100644 --- a/pentesting-web/parameter-pollution.md +++ b/pentesting-web/parameter-pollution.md @@ -1,18 +1,18 @@ -# Parameter Pollution +# Parameter Pollution | JSON Injection ## Parameter Pollution {% hint style="success" %} -Jifunze na fanya mazoezi ya AWS Hacking:[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)\ -Jifunze na fanya mazoezi ya GCP Hacking: [**HackTricks Training GCP Red Team Expert (GRTE)**](https://training.hacktricks.xyz/courses/grte) +Learn & practice AWS Hacking:[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)\ +Learn & practice GCP Hacking: [**HackTricks Training GCP Red Team Expert (GRTE)**](https://training.hacktricks.xyz/courses/grte)
Support HackTricks -* Angalia [**mpango wa usajili**](https://github.com/sponsors/carlospolop)! -* **Jiunge na** 💬 [**kikundi cha Discord**](https://discord.gg/hRep4RUj7f) au [**kikundi cha telegram**](https://t.me/peass) au **tufuatilie** kwenye **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.** -* **Shiriki mbinu za hacking kwa kuwasilisha PRs kwa** [**HackTricks**](https://github.com/carlospolop/hacktricks) na [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) repos za github. +* Check the [**subscription plans**](https://github.com/sponsors/carlospolop)! +* **Join the** 💬 [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** us on **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.** +* **Share hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
{% endhint %} @@ -21,9 +21,9 @@ Jifunze na fanya mazoezi ya GCP Hacking: @@ -104,7 +104,7 @@ Matokeo haya yalichukuliwa kutoka [https://medium.com/@0xAwali/http-parameter-po

https://miro.medium.com/v2/resize:fit:1100/format:webp/1*JzNkLOSW7orcHXswtMHGMA.jpeg

1. Inatambua jina\[]. -2. Unganisha vigezo mfano wa kwanza, mwisho. +2. Unganisha vigezo e.g. kwanza, mwisho. ### GO 1.22.7 @@ -134,27 +134,112 @@ Matokeo haya yalichukuliwa kutoka [https://medium.com/@0xAwali/http-parameter-po 1. Haitaeleweka jina\[]. 2. Pendelea kigezo cha mwisho. -## Marejeleo +## JSON Injection + +### Duplicate keys +```ini +obj = {"test": "user", "test": "admin"} +``` +The front-end inaweza kuamini tukio la kwanza wakati backend inatumia tukio la pili la ufunguo. + +### Key Collision: Character Truncation and Comments + +Makala fulani hazitatafsiriwa vizuri na frontend lakini backend itazitafsiri na kutumia ufunguo hizo, hii inaweza kuwa na manufaa ili **kupita vizuizi fulani**: +```json +{"test": 1, "test\[raw \x0d byte]": 2} +{"test": 1, "test\ud800": 2} +{"test": 1, "test"": 2} +{"test": 1, "te\st": 2} +``` +Kumbuka jinsi katika hizi kesi upande wa mbele unaweza kufikiri kwamba `test == 1` na upande wa nyuma utafikiri kwamba `test == 2`. + +Hii pia inaweza kutumika kupita vizuizi vya thamani kama: +```json +{"role": "administrator\[raw \x0d byte]"} +{"role":"administrator\ud800"} +{"role": "administrator""} +{"role": "admini\strator"} +``` +### **Kutumia Kukata Maoni** + +{% code overflow="wrap" %} +```ini +obj = {"description": "Duplicate with comments", "test": 2, "extra": /*, "test": 1, "extra2": */} +``` +{% endcode %} + +Hapa tutatumia serializer kutoka kila parser ili kuona matokeo yake. + +Serializer 1 (mfano, maktaba ya GoJay ya GoLang) itatoa: + +* `description = "Duplicate with comments"` +* `test = 2` +* `extra = ""` + +Serializer 2 (mfano, maktaba ya JSON-iterator ya Java) itatoa: + +* `description = "Duplicate with comments"` +* `extra = "/*"` +* `extra2 = "*/"` +* `test = 1` + +Vinginevyo, matumizi rahisi ya maoni yanaweza pia kuwa na ufanisi: +```ini +obj = {"description": "Comment support", "test": 1, "extra": "a"/*, "test": 2, "extra2": "b"*/} +``` +Maktaba ya GSON ya Java: +```json +{"description":"Comment support","test":1,"extra":"a"} +``` +Maktaba ya simdjson ya Ruby: +```json +{"description":"Comment support","test":2,"extra":"a","extra2":"b"} +``` +### **Kukosekana kwa Kipaumbele: Deserialization dhidi ya Serialization** +```ini +obj = {"test": 1, "test": 2} + +obj["test"] // 1 +obj.toString() // {"test": 2} +``` +### Float and Integer + +Nambari +```undefined +999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 +``` +inaweza kufasiriwa kwa uwakilishi mwingi, ikiwa ni pamoja na: +```undefined +999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 +9.999999999999999e95 +1E+96 +0 +9223372036854775807 +``` +Which might create inconsistences + +## References * [https://medium.com/@shahjerry33/http-parameter-pollution-its-contaminated-85edc0805654](https://medium.com/@shahjerry33/http-parameter-pollution-its-contaminated-85edc0805654) * [https://github.com/google/google-ctf/tree/master/2023/web-under-construction/solution](https://github.com/google/google-ctf/tree/master/2023/web-under-construction/solution) * [https://medium.com/@0xAwali/http-parameter-pollution-in-2024-32ec1b810f89](https://medium.com/@0xAwali/http-parameter-pollution-in-2024-32ec1b810f89) +* [https://bishopfox.com/blog/json-interoperability-vulnerabilities](https://bishopfox.com/blog/json-interoperability-vulnerabilities)
{% embed url="https://websec.nl/" %} {% hint style="success" %} -Jifunze na fanya mazoezi ya AWS Hacking:[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)\ -Jifunze na fanya mazoezi ya GCP Hacking: [**HackTricks Training GCP Red Team Expert (GRTE)**](https://training.hacktricks.xyz/courses/grte) +Jifunze & fanya mazoezi ya AWS Hacking:[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)\ +Jifunze & fanya mazoezi ya GCP Hacking: [**HackTricks Training GCP Red Team Expert (GRTE)**](https://training.hacktricks.xyz/courses/grte)
Support HackTricks -* Angalia [**mpango wa usajili**](https://github.com/sponsors/carlospolop)! -* **Jiunge na** 💬 [**kikundi cha Discord**](https://discord.gg/hRep4RUj7f) au [**kikundi cha telegram**](https://t.me/peass) au **tufuatilie** kwenye **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.** -* **Shiriki mbinu za hacking kwa kuwasilisha PRs kwa** [**HackTricks**](https://github.com/carlospolop/hacktricks) na [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) repos za github. +* Check the [**subscription plans**](https://github.com/sponsors/carlospolop)! +* **Join the** 💬 [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** us on **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.** +* **Share hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
{% endhint %}