Combining Request Smuggling and CBC Byte-flipping to stored-XSS
The application used a CBC-encrypted session cookie whose decrypted username was reflected unsanitised, and a username path-traversal quirk allowed crafting cookies containing JavaScript. A request smuggling flaw let the attacker set that cookie in another user's browser for one request, turning a self-XSS into a stored-XSS.
blog.scrt.ch
Published on blog.scrt.ch
During a recent penetration test we stumbled upon a couple of issues which independently might not have warranted any attention, but when combined allowed to compromise other users by injecting arbitrary JavaScript into their browsers. It goes to show that even certain issues which might not always seem particularly…
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the decrypted cookie value was rendered without sanitisation, and the front-end and back-end servers disagreed on request boundaries, enabling request smuggling.
Impact
An attacker could execute arbitrary JavaScript in another user's browser for one request, allowing the script to interact with the affected domain as the legitimate user; a restrictive CSP could have limited this, but none was present.
What the attacker needed
A valid user account; victim uses the affected web application; no restrictive CSP present
How it was found
- Log in with a valid account and observe the base64-encoded session cookie.
- Notice that the cookie starts with the same values but has differing endings.
- Attempt a CBC byte-flipping attack and see scrambled text in the resulting page.
- Log in with a path-traversal-style username using the same password as the original account.
- Use the name traversal to generate encrypted cookies with arbitrary blocks that produce self-XSS.
- Use Burp's request smuggler plugin to send the malicious cookie to another user's browser.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
A session cookie is a small piece of data a website stores in your browser to remember who you are. Here the cookie was encrypted, but the site showed the decrypted username on the page without cleaning it, so a tampered cookie could contain JavaScript. Separately, a request smuggling bug let the attacker slip extra data into another user's request, so the victim's browser briefly used the attacker's cookie and ran the script.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.