# Portswigger HTTP Request Smuggling 😣 <style>body {text-align: justify}</style> Hi, dưới đây là writeup của 22/22 bài lab về tấn công [HTTP request smuggling](https://portswigger.net/web-security/request-smuggling) mình đã solve trong quá trình ôn tập thi chứng chỉ của Portswigger. ### 1. HTTP request smuggling, basic CL.TE vulnerability ##### Description > This lab involves a front-end and back-end server, and the front-end server doesn't support chunked encoding. The front-end server rejects requests that aren't using the GET or POST method. > > To solve the lab, smuggle a request to the back-end server, so that the next request processed by the back-end server appears to use the method `GPOST`. ##### Writeup Request trang chủ với method POST. Do đây là dạng CL.TE nên ta sẽ gửi request dạng: ``` POST / HTTP/1.1 Host: 0ae100d9040a41adc0976def003b003e.web-security-academy.net Content-Type: application/x-www-form-urlencoded Content-Length: 6 Transfer-Encoding: chunked 0\r\n \r\n G ``` Lúc này, front-end server sẽ hiểu body chứa 6 kí tự bắt đầu từ kí tự `0` đến kí tự `G`, trong khi back-end server hiểu body là 1 chunk size 0 nên terminate request đầu và chèn kí tự `G` vào request tiếp theo. Gửi lần 1 &rarr; `G` được coi là kí tự đầu của request tiếp theo. ![](https://i.imgur.com/vWL9dlg.png) Gửi lần 2, `G` ghép với `POST` của request thành `GPOST` &rarr; front-end server coi đó là phương thức `GPOST` và forbidden. ![](https://i.imgur.com/9Ujvxvt.png) Như vậy ta solve được challenge. ![](https://i.imgur.com/IZDVtg8.png) ### 2. HTTP request smuggling, basic TE.CL vulnerability ##### Description > This lab involves a front-end and back-end server, and the back-end server doesn't support chunked encoding. The front-end server rejects requests that aren't using the GET or POST method. > > To solve the lab, smuggle a request to the back-end server, so that the next request processed by the back-end server appears to use the method GPOST. ##### Writeup Bài này là dạng TE.CL. Ta gửi request như sau: ``` POST / HTTP/1.1 Host: 0a9d00f703e5e071c996e5cf00550064.web-security-academy.net Content-Type: application/x-www-form-urlencoded Content-Length: 4 Transfer-Encoding: chunked 5a\r\n GPOST / HTTP/1.1\r\n Content-Type: application/x-www-form-urlencoded\r\n Content-Length: 13\r\n \r\n a\r\n 0\r\n \r\n ``` Lúc này, front-end server coi body là 2 chunk size `5a` và size `0`. Chunk size `5a` sẽ chứa: ``` GPOST / HTTP/1.1\r\n Content-Type: application/x-www-form-urlencoded\r\n Content-Length: 13\r\n \r\n a ``` Trong khi đó, back-end server sẽ coi body có 4 kí tự `5a\r\n` &rarr; Phần còn lại sẽ được gán vào đầu request sau. Chú ý: Content-Length tại payload attack: ``` Content-Length: 13\r\n \r\n a\r\n 0\r\n \r\n ``` phải lớn hơn 8 ( do `a\r\n 0\r\n \r\n` có 8 kí tự) vì nếu = 8 thì request sau vẫn được xử lí bình thường, còn > 8 thì nó sẽ lấy đi một số kí tự ở request sau &rarr; lúc này mới smuggling được. Gửi lần 1: ![](https://i.imgur.com/Rv8rWvb.png) Gửi lần 2 ta thấy request chứa GPOST đã được gửi và xử lí. ![](https://i.imgur.com/SlN7YUs.png) Ta solve được challenge. ![](https://i.imgur.com/qZuEFxr.png) ### 3. HTTP request smuggling, obfuscating the TE header ##### Description > This lab involves a front-end and back-end server, and the two servers handle duplicate HTTP request headers in different ways. The front-end server rejects requests that aren't using the GET or POST method. > > To solve the lab, smuggle a request to the back-end server, so that the next request processed by the back-end server appears to use the method GPOST. ##### Writeup Khi POST với 2 trường `Content-Length` và `Transfer-Encoding` hợp lệ thì vẫn trả request bình thường mà không bị smuggling &rarr; Cả front-end và back-end server đều hỗ trợ `Transfer-Encoding` và ignore `Content-Length`. ![](https://i.imgur.com/2Gbzljd.png) Tuy nhiên khi thêm 1 header `Transfer-Encoding: x` thì lại trigger được smuggling sau khi gửi 2 lần. &rarr; Trong khi front-end chấp nhận `Transfer-Encoding: chunked` đầu tiên thì back-end chấp nhận `Transfer-Encoding: x` &rarr; Back-end phải sử dụng `Content-Length` do `Transfer-Encoding: x` không hợp lệ. ![](https://i.imgur.com/3Vpoijo.png) Lúc này ta quay về bài toán TE.CL như lab2. Cách giải sẽ giống y chang: ![](https://i.imgur.com/8GAOkbq.png) Ta solve được challenge. ![](https://i.imgur.com/uidP3av.png) ### 4. HTTP request smuggling, confirming a CL.TE vulnerability via differential responses ##### Description > This lab involves a front-end and back-end server, and the front-end server doesn't support chunked encoding. > > To solve the lab, smuggle a request to the back-end server, so that a subsequent request for / (the web root) triggers a 404 Not Found response. ##### Writeup Để xác định đây là dạng CL.TE, ta gửi request sau: ``` POST / HTTP/1.1 Host: 0ac40011049a46fbc120900a007300f0.web-security-academy.net Content-Type: application/x-www-form-urlencoded Content-Length: 36 Transfer-Encoding: chunked 1\r\n A\r\n 0\r\n \r\n GET /404 HTTP/1.1\r\n Foo: x ``` Front-end không hỗ trợ chunked encoding nên nó sẽ sử dụng `Content-Length` với body dài 36 kí tự: ``` 1\r\n A\r\n 0\r\n \r\n GET /404 HTTP/1.1\r\n Foo: x ``` Trong khi back-end hỗ trợ `Transfer-Encoding: chunked` nên nó sẽ gán `GET /404 HTTP/1.1\r\n Foo: x` vào request sau. Gửi request attack: ![](https://i.imgur.com/VbeVMYJ.png) Gửi request trang chủ một cách thông thường &rarr; bị trả 404 do bị smuggling. ![](https://i.imgur.com/q69LLCj.png) Như vậy ứng dụng bị dính HTTP Smuggling dạng CL.TE. ![](https://i.imgur.com/sG9eLHv.png) ### 5. HTTP request smuggling, confirming a TE.CL vulnerability via differential responses ##### Description > This lab involves a front-end and back-end server, and the back-end server doesn't support chunked encoding. > > To solve the lab, smuggle a request to the back-end server, so that a subsequent request for / (the web root) triggers a 404 Not Found response. ##### Writeup Để xác định đây là dạng TE.CL, ta gửi request sau: ``` POST / HTTP/1.1 Host: 0aa800dd0329d39fc1ce537b007800f1.web-security-academy.net Content-Type: application/x-www-form-urlencoded Content-Length: 4 Transfer-Encoding: chunked 9b\r\n GET /404 HTTP/1.1\r\n Host: 0aa800dd0329d39fc1ce537b007800f1.web-security-academy.net\r\n Content-Type: application/x-www-form-urlencoded\r\n Content-Length: 9\r\n \r\n A\r\n 0\r\n \r\n ``` Front-end server xem body chứa 2 chunk, trong đó chunk size 9b bao gồm: ``` GET /404 HTTP/1.1\r\n Host: 0aa800dd0329d39fc1ce537b007800f1.web-security-academy.net\r\n Content-Type: application/x-www-form-urlencoded\r\n Content-Length: 9\r\n \r\n A ``` Trong khi đó back-end server hiểu body chứa 4 kí tự `9c\r\n` dựa vào `Content-Length`. Phần còn lại sẽ được gửi vào request sau. Chú ý: Content-Length tại payload attack: ``` Content-Length: 9\r\n \r\n A\r\n 0\r\n \r\n ``` phải lớn hơn 8 ( do `A\r\n 0\r\n \r\n` có 8 kí tự) vì nếu = 8 thì request sau vẫn được xử lí bình thường, còn > 8 thì nó sẽ lấy đi một số kí tự ở request sau &rarr; lúc này mới smuggling được. Gửi attack request ![](https://i.imgur.com/Y9rYUmj.png) Gửi normal request ta thấy trả về 404. ![](https://i.imgur.com/LlLql1f.png) Như vậy đây là dạng TE.CL. ![](https://i.imgur.com/xKBbNj3.png) ### 6. Exploiting HTTP request smuggling to bypass front-end security controls, CL.TE vulnerability ##### Description > This lab involves a front-end and back-end server, and the front-end server doesn't support chunked encoding. There's an admin panel at `/admin`, but the front-end server blocks access to it. > > To solve the lab, smuggle a request to the back-end server that accesses the admin panel and deletes the user `carlos`. ##### Writeup Đường dẫn `/admin` đã bị block bởi front-end server. ![](https://i.imgur.com/CvahN35.png) Ta detect được ứng dụng bị dính HTTP Request Smuggling dạng CL.TE bằng phương pháp tương tự bài lab 4. ![](https://i.imgur.com/zGmqMAz.png) ![](https://i.imgur.com/P6zko0I.png) Bây giờ ta dựa vào HTTP Request Smuggling để request đến `/admin`. Thử `GET /admin` bằng HTTP Request Smuggling. ![](https://i.imgur.com/KxBtV8l.png) Ta thấy response ở request sau chứa nội dung trang `/admin` mà không còn bị block nữa. Tuy nhiên vì back-end server check thấy mình không phải là local users nên không thể dùng chức năng. ![](https://i.imgur.com/hF2Yt1y.png) Thử tấn công bằng cách thêm `Host: localhost`, ![](https://i.imgur.com/nby6syE.png) thì bị báo duplicate header Host với request sau. ![](https://i.imgur.com/XABUsy2.png) Như vậy ta sẽ thử `POST /admin` với `Host: localhost` để lúc này cắt được Host header của request sau ra. Chú ý `Content-Length` phải lớn hơn độ dài của body thực. Ở đây là 3 > 2 (`x=`). Lí do là để lấy được một số kí tự của request sau để tấn công thành công. ![](https://i.imgur.com/779JWVD.png) Lúc này gửi request sau ta đã vào được `/admin`. ![](https://i.imgur.com/riSmH8L.png) Thực hiện xóa user carlos. ![](https://i.imgur.com/wT6B410.png) ![](https://i.imgur.com/FIZ4AOY.png) Ta solve được challenge. ![](https://i.imgur.com/LMdmQRL.png) ### 7. Exploiting HTTP request smuggling to bypass front-end security controls, TE.CL vulnerability ##### Description > This lab involves a front-end and back-end server, and the back-end server doesn't support chunked encoding. There's an admin panel at `/admin`, but the front-end server blocks access to it. > > To solve the lab, smuggle a request to the back-end server that accesses the admin panel and deletes the user `carlos`. ##### Writeup Tương tự bài trên nhưng ở dạng TE.CL. Kết hợp lab 5 kèm theo phân tích như lab 6, ta sử dụng payload sau để attack. ![](https://i.imgur.com/4g21Olf.png) Gửi request sau, ta thấy trang `/admin` đã truy cập thành công. ![](https://i.imgur.com/TmUsEwF.png) Xóa user carlos. ![](https://i.imgur.com/gS3HaAL.png) ![](https://i.imgur.com/jeqpA5q.png) Ta solve được challenge. ![](https://i.imgur.com/j0PCemy.png) ### 8. Exploiting HTTP request smuggling to reveal front-end request rewriting ##### Description > This lab involves a front-end and back-end server, and the front-end server doesn't support chunked encoding. > > There's an admin panel at /admin, but it's only accessible to people with the IP address 127.0.0.1. The front-end server adds an HTTP header to incoming requests containing their IP address. It's similar to the X-Forwarded-For header but has a different name. > > To solve the lab, smuggle a request to the back-end server that reveals the header that is added by the front-end server. Then smuggle a request to the back-end server that includes the added header, accesses the admin panel, and deletes the user carlos. ##### Writeup Ứng dụng có chức năng search. Khi search sẽ có một POST request chứa tham số `search` và chuỗi search sẽ được reflected ở response. ![](https://i.imgur.com/xyfOHPa.png) Ta detect được đây là dạng CL.TE (Tương tự bài lab 4) ![](https://i.imgur.com/pZYmUB0.png) ![](https://i.imgur.com/4Q7yo0q.png) Vì response của POST search request này reflect chuỗi search &rarr; tấn công HTTP Request Smuggling bằng POST với `search=` &rarr; phần request sau sẽ được nối vào `search=` &rarr; Ta xem được headers của request sau. ![](https://i.imgur.com/a9qNr6v.png) Bằng cách như vậy ta xem được header cần tìm là `X-WzNZzA-Ip`. ![](https://i.imgur.com/RNYhrR1.png) Giờ mình chỉ cần thêm header trên với giá trị `127.0.0.1` để truy cập trang admin. ![](https://i.imgur.com/l0iZhb2.png) ![](https://i.imgur.com/17201yg.png) Xóa user carlos. ![](https://i.imgur.com/rlg7Qbv.png) ![](https://i.imgur.com/k2X1wUG.png) Ta solve challenge. ![](https://i.imgur.com/WEAfCRW.png) ### 9. Exploiting HTTP request smuggling to capture other users' requests ##### Description > This lab involves a front-end and back-end server, and the front-end server doesn't support chunked encoding. > > To solve the lab, smuggle a request to the back-end server that causes the next user's request to be stored in the application. Then retrieve the next user's request and use the victim user's cookies to access their account. ##### Writeup Đây là dạng bài CL.TE. Ứng dụng có chức năng comment và mình có thể xem comment của bất kì ai. ![](https://i.imgur.com/Bn4hmIM.png) Lợi dụng HTTP request smuggling dạng CL.TE, ta khến back-end xử lý request sau là post comment với trường comment rỗng &rarr; request sau của user khác sẽ bị nối vào trường comment này và hiển thị lên comment. `Content-Length` ở đây ta sẽ chỉnh sao cho comment hiển thị chứa cookie cần lấy. ![](https://i.imgur.com/GYbmwi5.png) Sau khi gửi request attack, đợi 1 xíu, quay lại xem comment đã thấy request của user victim chứa cookie. ![](https://i.imgur.com/Ay9SpPn.png) Set cookie vào request, ta truy cập được account nạn nhân. ![](https://i.imgur.com/KxqALk4.png) Ta solve challenge. ![](https://i.imgur.com/bMkCE5l.png) ### 10. Exploiting HTTP request smuggling to deliver reflected XSS ##### Description > This lab involves a front-end and back-end server, and the front-end server doesn't support chunked encoding. > > The application is also vulnerable to reflected XSS via the User-Agent header. > > To solve the lab, smuggle a request to the back-end server that causes the next user's request to receive a response containing an XSS exploit that executes alert(1). ##### Writeup Tại phần form post comment tại các post, giá trị trường `User-Agent` được thêm vào value của input hidden. Ta có thể dẽ dàng trigger XSS. ![](https://i.imgur.com/spShlrp.png) Đây là dạng bài CL.TE nên ta sẽ dùng payload sau với User-Agent là XSS payload. ![](https://i.imgur.com/Dvg7cBv.png) Khi đó request tiếp theo của nạn nhân sẽ thêm vào smuggled request ở trên &rarr; dính XSS &rarr; Ta solve được challenge. ![](https://i.imgur.com/2EH0jHV.png) ### 11. Response queue poisoning via H2.TE request smuggling ##### Description > This lab is vulnerable to request smuggling because the front-end server downgrades HTTP/2 requests even if they have an ambiguous length. > > To solve the lab, delete the user carlos by using response queue poisoning to break into the admin panel at /admin. An admin user will log in approximately every 15 seconds. > > The connection to the back-end is reset every 10 requests, so don't worry if you get it into a bad state - just send a few normal requests to get a fresh connection. ##### Writeup Smuggling complete request với đường dẫn không tồn tại thành công với chunked encoding &rarr; H2.TE ![](https://i.imgur.com/WHz5YZ1.png) Send request để poison response queue. Send liên tục cho đến khi nhận được response 302 chứa cookie &rarr; đây là response sau khi admin đăng nhập thành công. ![](https://i.imgur.com/Iz9abcV.png) Lấy cookie và truy cập trang web thì thấy admin panel. Như vậy ta đã đánh cắp response chứa cookie của admin thành công thông qua poison response queue. ![](https://i.imgur.com/O6pYSZE.png) Truy cập trang `/admin`. ![](https://i.imgur.com/FLpJk0X.png) Xóa user carlos. ![](https://i.imgur.com/psMBdLV.png) Và ta solve được challenge. ![](https://i.imgur.com/H8DciFB.png) ### 12. H2.CL request smuggling ##### Description > This lab is vulnerable to request smuggling because the front-end server downgrades HTTP/2 requests even if they have an ambiguous length. > > To solve the lab, perform a request smuggling attack that causes the victim's browser to load and execute a malicious JavaScript file from the exploit server, calling alert(document.cookie). The victim user accesses the home page every 10 seconds. ##### Writeup Thử tấn công smuggling với body bất kì kèm theo `Content-Length: 0` thì thấy response 404 sau khi gửi 1 số lần &rarr; Tấn công thành công dạng H2.CL. ![](https://i.imgur.com/78UMqUP.png) Mặt khác, khi request trang chủ thì có các request import js tại `/resources/...`. Thử request đến `/resources` thì bị redirect về `/resources/`. ![](https://i.imgur.com/DmajzL4.png) Thử tấn công smuggling đến `/resources` với Host header bất kì `abc.com` thì thấy server redirect về đường dẫn chứa Host đó: `https://abc.com/resources/`. ![](https://i.imgur.com/vk6gtUc.png) Như vậy ta sẽ tạo `https://<Exploit-server>/resources/` chứa `alert(document.cookie)`. ![](https://i.imgur.com/o4Q3ixn.png) Sumggling với host header là exploit-server. ![](https://i.imgur.com/ufRAmRJ.png) Gửi một số lần mới thành công do ta cần timing thời điểm trước khi browser của nạn nhân import các file js. ![](https://i.imgur.com/CQNeG2y.png) ### 13. HTTP/2 request smuggling via CRLF injection ##### Description > This lab is vulnerable to request smuggling because the front-end server downgrades HTTP/2 requests and fails to adequately sanitize incoming headers. > > To solve the lab, use an HTTP/2-exclusive request smuggling vector to gain access to another user's account. The victim accesses the home page every 15 seconds. > > If you're not familiar with Burp's exclusive features for HTTP/2 testing, please refer to the documentation for details on how to use them. ##### Writeup Ứng dụng có chức năng search và hiển thi history search theo session cookie. ![](https://i.imgur.com/Z9kPq8W.png) Khi search sẽ có request POST như dưới, và chuỗi search sẽ được reflect lên trang web ở phần history. ![](https://i.imgur.com/VaKG608.png) Sau hi thử các dạng H2.CL, H2.TE không thành công, ta thực hiện CLRF injection tại 1 header bất kì để khi downgrade HTTP/2 xuống HTTP/1 sẽ xuất hiện header TE và gửi cho back-end. Vào inspector và ấn `SHIFT+ENTER` để inject CLRF. ![](https://i.imgur.com/Tn314nX.png) Gửi request smuggling với giá trị search để rỗng để capture request của user victim. Ngoài ra cần set session cookie hiện tại vì mình cần xem history search theo session. ![](https://i.imgur.com/rbrjav4.png) Đợi 1 chút, truy cập web với session cookie trên, ta thấy history chứa request của user nạn nhân. Trích xuất được cookie của nạn nhân. ![](https://i.imgur.com/IDX0Z1h.png) Truy cập bằng cookie của nạn nhân carlos và ta solve được challenge. ![](https://i.imgur.com/0W100ph.png) ### 14. HTTP/2 request splitting via CRLF injection ##### Description > This lab is vulnerable to request smuggling because the front-end server downgrades HTTP/2 requests and fails to adequately sanitize incoming headers. > > To solve the lab, delete the user carlos by using response queue poisoning to break into the admin panel at /admin. An admin user will log in approximately every 10 seconds. > > The connection to the back-end is reset every 10 requests, so don't worry if you get it into a bad state - just send a few normal requests to get a fresh connection. ##### Writeup Ở bài này, ta thực hiện CLRF injection tại header để splitting 1 request &rarr; poison response queue. ![](https://i.imgur.com/YwHtfKv.png) Send request nhiều lần thấy được response 404 &rarr; inject thành công. ![](https://i.imgur.com/70q7xZq.png) Ta tiếp tục send đúng thời điểm response trả về 302 chứa cookie của admin sau khi đăng nhập. ![](https://i.imgur.com/4NAqjbo.png) Lấy session cookie truy cập ta vào được trang `/admin`. ![](https://i.imgur.com/kapJE5C.png) Xóa user carlos. ![](https://i.imgur.com/g9rWLTZ.png) Và ta solve được challenge. ![](https://i.imgur.com/7kCazNP.png) ### 15. CL.0 request smuggling ##### Description > This lab is vulnerable to CL.0 request smuggling attacks. The back-end server ignores the Content-Length header on requests to some endpoints. > > To solve the lab, identify a vulnerable endpoint, smuggle a request to the back-end to access to the admin panel at /admin, then delete the user carlos. ##### Writeup Tại request load các resources bị smuggled. ![](https://i.imgur.com/GLUDIRu.png) Đơn giản thay thành request đến `/admin` và request smuggling này sẽ là prefix cho request sau &rarr; ta truy cập được trang admin. ![](https://i.imgur.com/FY63426.png) Xóa user carlos. ![](https://i.imgur.com/GPiAdyZ.png) Ta solve challenge. ![](https://i.imgur.com/1Z26hYA.png) **Cách 2:** Pipeline Gửi 2 request cùng lúc: - Request 1: gửi đúng content-length chứa request `/admin`. - Request 2: Bất kì &rarr; response của `/admin` &rarr; server trả về đồng thời 2 response ![](https://i.imgur.com/3Gf5Wgl.png) ### 16. Exploiting HTTP request smuggling to perform web cache poisoning ##### Description > This lab involves a front-end and back-end server, and the front-end server doesn't support chunked encoding. The front-end server is configured to cache certain responses. > > To solve the lab, perform a request smuggling attack that causes the cache to be poisoned, such that a subsequent request for a JavaScript file receives a redirection to the exploit server. The poisoned cache should alert `document.cookie`. ##### Writeup Ta thấy request load file `tracking.js` được cached. ![](https://i.imgur.com/dllTr7C.png) Smuggling dạng CL.TE thành công. ![](https://i.imgur.com/6Zpnerf.png) Lúc này gửi request import `tracking.js` thì nó trả về response smuggled từ cache. ![](https://i.imgur.com/dt1zPh9.png) Mặt khác để ý tại chức năng `Next post` thì xuất hiện request đến `/post/next?postId=<ID>` và sau đó được redirect đến next post. ![](https://i.imgur.com/zl9ScuW.png) Smuggling với request `/post/next?postId=<ID>` bằng host bất kì thì thấy redirect về chính host đó với đường dẫn `/post`. ![](https://i.imgur.com/LS4j6bk.png) Tạo `alert(document.cookie)` tại đường dẫn `/post` của exploit-server. ![](https://i.imgur.com/flIlGFy.png) Lúc này smuggling với request `/post/next?postId=<ID>` bằng host là exploit-server, thì khi tất cả các nạn nhân import `tracking.js` sau sẽ được cache với response là redirect về `//<exploit-server/post`. ![](https://i.imgur.com/BcYcsKM.png) ![](https://i.imgur.com/bgktVjW.png) Lúc này nạn nhân sẽ trigger `alert(document.cookie)` và ta solve challenge. ![](https://i.imgur.com/eo1ppSS.png) ### 17. Exploiting HTTP request smuggling to perform web cache deception ##### Description > This lab involves a front-end and back-end server, and the front-end server doesn't support chunked encoding. The front-end server is caching static resources. > > To solve the lab, perform a request smuggling attack such that the next user's request causes their API key to be saved in the cache. Then retrieve the victim user's API key from the cache and submit it as the lab solution. You will need to wait for 30 seconds from accessing the lab before attempting to trick the victim into caching their API key. > > You can log in to your own account using the following credentials: `wiener:peter` ##### Writeup Tương tự, các request load resources đều được cached. ![](https://i.imgur.com/eeYuNYR.png) Sau khi đăng nhập ta có thể xem API key tại `/my-account`. ![](https://i.imgur.com/f194GzT.png) Ta gửi request tấn công smuggling với request đến `/my-account`. ![](https://i.imgur.com/x3e9JKn.png) Đợi 1 chút để victim truy cập trang. Khi đó, victim sẽ gửi request đến `/resources/js/tracking.js` đầu tiên &rarr; nhận response smuggled của `/my-account` chứa thông tin của nạn nhân &rarr; cache lưu response đối với `/resources/js/tracking.js`. Giờ mình send request đến `/resources/js/tracking.js` và sẽ nhận được response chứa thông tin API key của nạn nhân. ![](https://i.imgur.com/hw28QWV.png) submit API key tìm được và ta solve challenge. ![](https://i.imgur.com/wNWP4ff.png) ### 18. Basic password reset poisoning ##### Description > ##### Writeup ### 19. Basic password reset poisoning ##### Description > ##### Writeup ### 20. Basic password reset poisoning ##### Description > ##### Writeup ### 21. Basic password reset poisoning ##### Description > ##### Writeup ### 22. Basic password reset poisoning ##### Description > ##### Writeup --- ## Notes **HTTP request smuggling** is a technique for interfering with the way a web site processes *sequences of HTTP requests* that are received from one or more users. **Why?** The HTTP specification provides two different ways to specify where a request ends: - *Content-Length* - *Transfer-Encoding*: chunked encoding &rarr; use both to conflict =))) &rarr; Request smuggling is fundamentally about exploiting discrepancies between how different servers interpret the length of a request **Methodology** - **CL.TE**: the `front-end` server uses the `Content-Length` header and the `back-end` server uses the `Transfer-Encoding` header. - **TE.CL**: the `front-end` server uses the `Transfer-Encoding` header and the `back-end` server uses the `Content-Length` header. - **TE.TE**: the front-end and back-end servers both support the `Transfer-Encoding` header, but one of the servers can be induced not to process it by obfuscating the header in some way. **HTTP/2 Smuggling** - HTTP/2 message length: sum of its frame lengths - HTTP/2 downgrading: - H2.CL: front-end servers often add an HTTP/1 `Content-Length` header before sending to back-end &rarr; we can define it in the HTTP/2 header. &rarr; should validate built-in calculated length vs `Content-Length`. - H2.TE: **Impact** - bypass security controls - Front-end servers are equiped with access control before sending to back-end servers while back-end ones donot &rarr; HTTP request smuggling to bypass - gain unauthorized access to sensitive data - *Web cache deception*: cause sensitive data stored in cache and attacker then retrieves this content from the cache - directly compromise other application users - *Web cache poisoning*: causes the application to store some malicious content in the cache, and this content is served from the cache to other application users **Detect** - Timing techniques - Differential responses - The "attack" request and the "normal" request should be sent to the server using different network connections. - The "attack" request and the "normal" request should use the same URL and parameter names - Should send the "normal" request immediately after the "attack" request - If your "attack" and "normal" requests are forwarded to different back-end systems, then the attack will fail. - If your attack succeeds in interfering with a subsequent request, but this wasn't the "normal" request that you sent to detect the interference, then this means that another application user was affected by your attack. ###### tags: `portswigger`, `http-smuggling`, `advanced`