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

66 lines
4.7 KiB
Markdown
Raw Normal View History

2022-08-21 14:40:42 +00:00
# HTTP Connection Request Smuggling
<details>
2023-04-25 18:35:28 +00:00
<summary><a href="https://cloud.hacktricks.xyz/pentesting-cloud/pentesting-cloud-methodology"><strong>☁️ HackTricks Cloud ☁️</strong></a> -<a href="https://twitter.com/hacktricks_live"><strong>🐦 Twitter 🐦</strong></a> - <a href="https://www.twitch.tv/hacktricks_live/schedule"><strong>🎙️ Twitch 🎙️</strong></a> - <a href="https://www.youtube.com/@hacktricks_LIVE"><strong>🎥 Youtube 🎥</strong></a></summary>
2022-08-21 14:40:42 +00:00
2022-11-04 15:54:08 +00:00
* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)!
* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family)
* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com)
2023-04-25 18:35:28 +00:00
* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.**
2022-12-05 22:29:21 +00:00
* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**.
2022-08-21 14:40:42 +00:00
</details>
## Connection state attacks <a href="#state" id="state"></a>
### **First-request validation**
Reverse proxies often use the **Host header** to identify **which back-end server to route** each request to, and have a whitelist of hosts that people are **allowed to access.**
However, some proxies only apply this **whitelist to the first request sent** over a given connection. This means attackers can gain **access to internal** websites by issuing a **request to an allowed** destination, **followed** by one for the **internal site** down the same connection:
```
GET / HTTP/1.1
Host: redacted
GET / HTTP/1.1
Host: intranet.redacted
```
Mercifully, this **mistake is quite rare**.
### **First-request routing**
First-request routing occurs when the front-end uses the **first request's Host header to decide** which back-end to route the request to, and then **routes all subsequent requests** from the same client connection down the **same back-end connection**.
```
GET / HTTP/1.1
Host: example.com
POST /pwreset HTTP/1.1
Host: psres.net
```
This could be chained with [**Host header attacks**](https://portswigger.net/web-security/host-header) like password reset poisoning, [**web cache poisoning**](https://portswigger.net/web-security/web-cache-poisoning), and gaining access to other virtual hosts.
{% hint style="info" %}
You can scan for these two flaws using the 'connection-state probe' option in HTTP Request Smuggler.
{% endhint %}
2022-11-04 15:54:08 +00:00
## References
2022-08-21 14:40:42 +00:00
2022-11-04 15:54:08 +00:00
* [https://portswigger.net/research/browser-powered-desync-attacks](https://portswigger.net/research/browser-powered-desync-attacks)
2022-08-21 14:40:42 +00:00
2022-11-04 15:54:08 +00:00
<details>
2022-08-21 14:40:42 +00:00
2023-04-25 18:35:28 +00:00
<summary><a href="https://cloud.hacktricks.xyz/pentesting-cloud/pentesting-cloud-methodology"><strong>☁️ HackTricks Cloud ☁️</strong></a> -<a href="https://twitter.com/hacktricks_live"><strong>🐦 Twitter 🐦</strong></a> - <a href="https://www.twitch.tv/hacktricks_live/schedule"><strong>🎙️ Twitch 🎙️</strong></a> - <a href="https://www.youtube.com/@hacktricks_LIVE"><strong>🎥 Youtube 🎥</strong></a></summary>
2022-08-21 14:40:42 +00:00
2022-11-04 15:54:08 +00:00
* Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)!
* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family)
* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com)
2023-04-25 18:35:28 +00:00
* **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.**
2022-12-05 22:29:21 +00:00
* **Share your hacking tricks by submitting PRs to the [hacktricks repo](https://github.com/carlospolop/hacktricks) and [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**.
2022-08-21 14:40:42 +00:00
</details>