|
3 | 3 | {{#include ../banners/hacktricks-training.md}} |
4 | 4 |
|
5 | 5 |
|
| 6 | + |
6 | 7 | ## HTTP Parameter Pollution (HPP) Overview |
7 | 8 |
|
8 | 9 | HTTP Parameter Pollution (HPP) is a technique where attackers manipulate HTTP parameters to change the behavior of a web application in unintended ways. This manipulation is done by adding, modifying, or duplicating HTTP parameters. The effect of these manipulations is not directly visible to the user but can significantly alter the application's functionality on the server side, with observable impacts on the client side. |
@@ -50,6 +51,35 @@ The way web technologies handle duplicate HTTP parameters varies, affecting thei |
50 | 51 | - **Flask:** Adopts the first parameter value encountered, such as `a=1` in a query string `a=1&a=2`, prioritizing the initial instance over subsequent duplicates. |
51 | 52 | - **PHP (on Apache HTTP Server):** Contrarily, prioritizes the last parameter value, opting for `a=2` in the given example. This behavior can inadvertently facilitate HPP exploits by honoring the attacker's manipulated parameter over the original. |
52 | 53 |
|
| 54 | + |
| 55 | +### HPP Testing Notes (OWASP WSTG) |
| 56 | + |
| 57 | +- HTTP standards do not define how to interpret multiple parameters with the same name, so behavior varies across stacks and components. |
| 58 | +- When testing server-side HPP, duplicate each parameter in query strings or bodies and observe whether the application concatenates values, uses first/last, or errors. |
| 59 | +- For client-side HPP, inject a URL-encoded `&` into a reflected parameter value (e.g., `%26HPP_TEST`) and look for decoded occurrences such as `&HPP_TEST` or `&HPP_TEST` inside generated links or form actions. |
| 60 | + |
| 61 | +### Server-Side Parameter Pollution (SSPP) in Internal APIs |
| 62 | + |
| 63 | +Some applications embed user input into server-side requests to internal APIs. If that input is not properly encoded, you can inject or override parameters in the internal request. Test any user input, including query parameters, form fields, headers, and URL path parameters. |
| 64 | + |
| 65 | +Common probes: |
| 66 | + |
| 67 | +- Add a new parameter with `%26` (URL-encoded `&`). |
| 68 | +- Truncate the downstream query with `%23` (URL-encoded `#`). |
| 69 | +- Override an existing parameter by duplicating it. |
| 70 | + |
| 71 | +Example: |
| 72 | + |
| 73 | +```http |
| 74 | +GET /userSearch?name=peter%26name=carlos&back=/home |
| 75 | +``` |
| 76 | + |
| 77 | +Potentially results in a server-side request like: |
| 78 | + |
| 79 | +```http |
| 80 | +GET /users/search?name=peter&name=carlos&publicProfile=true |
| 81 | +``` |
| 82 | + |
53 | 83 | ## Parameter pollution by technology |
54 | 84 |
|
55 | 85 | There results were taken from [https://medium.com/@0xAwali/http-parameter-pollution-in-2024-32ec1b810f89](https://medium.com/@0xAwali/http-parameter-pollution-in-2024-32ec1b810f89) |
@@ -118,6 +148,10 @@ There results were taken from [https://medium.com/@0xAwali/http-parameter-pollut |
118 | 148 |
|
119 | 149 | ## JSON Injection |
120 | 150 |
|
| 151 | +{{#ref}} |
| 152 | +json-xml-yaml-hacking.md |
| 153 | +{{#endref}} |
| 154 | + |
121 | 155 | ### Duplicate keys |
122 | 156 |
|
123 | 157 | ```ini |
@@ -223,8 +257,7 @@ Which might create inconsistences |
223 | 257 | - [https://medium.com/@0xAwali/http-parameter-pollution-in-2024-32ec1b810f89](https://medium.com/@0xAwali/http-parameter-pollution-in-2024-32ec1b810f89) |
224 | 258 | - [https://bishopfox.com/blog/json-interoperability-vulnerabilities](https://bishopfox.com/blog/json-interoperability-vulnerabilities) |
225 | 259 |
|
| 260 | +- [https://owasp.org/www-project-web-security-testing-guide/v42/4-Web_Application_Security_Testing/07-Input_Validation_Testing/04-Testing_for_HTTP_Parameter_Pollution](https://owasp.org/www-project-web-security-testing-guide/v42/4-Web_Application_Security_Testing/07-Input_Validation_Testing/04-Testing_for_HTTP_Parameter_Pollution) |
| 261 | +- [https://portswigger.net/web-security/api-testing/server-side-parameter-pollution](https://portswigger.net/web-security/api-testing/server-side-parameter-pollution) |
226 | 262 |
|
227 | 263 | {{#include ../banners/hacktricks-training.md}} |
228 | | - |
229 | | - |
230 | | - |
|
0 commit comments