hacktricks/pentesting-web/http-connection-request-smuggling.md

66 lines
3.9 KiB
Markdown
Raw Normal View History

2022-08-21 14:40:42 +00:00
# HTTP Connection Request Smuggling
2024-07-18 20:49:07 +00:00
{% hint style="success" %}
Learn & practice AWS Hacking:<img src="/.gitbook/assets/arte.png" alt="" data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="/.gitbook/assets/arte.png" alt="" data-size="line">\
Learn & practice GCP Hacking: <img src="/.gitbook/assets/grte.png" alt="" data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<img src="/.gitbook/assets/grte.png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte)
2022-08-21 14:40:42 +00:00
<details>
2024-07-18 20:49:07 +00:00
<summary>Support HackTricks</summary>
2022-08-21 14:40:42 +00:00
2024-07-18 20:49:07 +00:00
* 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.
2022-08-21 14:40:42 +00:00
</details>
2024-07-18 20:49:07 +00:00
{% endhint %}
2022-08-21 14:40:42 +00:00
**This is a summary of the post** [**https://portswigger.net/research/browser-powered-desync-attacks**](https://portswigger.net/research/browser-powered-desync-attacks)
2022-08-21 14:40:42 +00:00
2024-02-06 03:10:38 +00:00
## Connection State Attacks <a href="#state" id="state"></a>
2022-08-21 14:40:42 +00:00
2024-02-06 03:10:38 +00:00
### First-request Validation
2022-08-21 14:40:42 +00:00
2024-02-06 03:10:38 +00:00
When routing requests, reverse proxies might depend on the **Host header** to determine the destination back-end server, often relying on a whitelist of hosts that are permitted access. However, a vulnerability exists in some proxies where the whitelist is only enforced on the initial request in a connection. Consequently, attackers could exploit this by first making a request to an allowed host and then requesting an internal site through the same connection:
2022-08-21 14:40:42 +00:00
```
2022-08-21 14:40:42 +00:00
GET / HTTP/1.1
2024-02-06 03:10:38 +00:00
Host: [allowed-external-host]
2022-08-21 14:40:42 +00:00
GET / HTTP/1.1
2024-02-06 03:10:38 +00:00
Host: [internal-host]
2022-08-21 14:40:42 +00:00
```
2024-02-06 03:10:38 +00:00
### First-request Routing
2022-08-21 14:40:42 +00:00
2024-02-06 03:10:38 +00:00
In some configurations, a front-end server may use the **Host header of the first request** to determine the back-end routing for that request, and then persistently route all subsequent requests from the same client connection to the same back-end connection. This can be demonstrated as:
2022-08-21 14:40:42 +00:00
```
2022-08-21 14:40:42 +00:00
GET / HTTP/1.1
Host: example.com
POST /pwreset HTTP/1.1
Host: psres.net
```
2024-02-06 03:10:38 +00:00
This issue can potentially be combined with [Host header attacks](https://portswigger.net/web-security/host-header), such as password reset poisoning or [web cache poisoning](https://portswigger.net/web-security/web-cache-poisoning), to exploit other vulnerabilities or gain unauthorized access to additional virtual hosts.
2022-08-21 14:40:42 +00:00
{% hint style="info" %}
2024-02-06 03:10:38 +00:00
To identify these vulnerabilities, the 'connection-state probe' feature in HTTP Request Smuggler can be utilized.
2022-08-21 14:40:42 +00:00
{% endhint %}
2024-07-18 20:49:07 +00:00
{% hint style="success" %}
Learn & practice AWS Hacking:<img src="/.gitbook/assets/arte.png" alt="" data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="/.gitbook/assets/arte.png" alt="" data-size="line">\
Learn & practice GCP Hacking: <img src="/.gitbook/assets/grte.png" alt="" data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<img src="/.gitbook/assets/grte.png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte)
2022-11-04 15:54:08 +00:00
<details>
2022-08-21 14:40:42 +00:00
2024-07-18 20:49:07 +00:00
<summary>Support HackTricks</summary>
2022-08-21 14:40:42 +00:00
2024-07-18 20:49:07 +00:00
* 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.
2022-08-21 14:40:42 +00:00
</details>
2024-07-18 20:49:07 +00:00
{% endhint %}