Skip to content
XSS Write-up Intermediate

Cookie based injection XSS making explitable with exploiting other vulns

A parameter reflected into an inline script was encoded, but a session cookie value also appeared reflected in the same script block and was injectable. By moving the cookie parameter into the URL query string, the author made the injection reachable through a crafted link and could steal a victim's cookies.

Utkarsh Agrawal Follow

Published on medium.com

I was testing a site [redacted.com] can’t take name for Obvious reasons. I was testing it on the Repeater tab on the burp and testing a parameter which was reflecting back on the HTML page but encoded.

Utkarsh Agrawal, on medium.com

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 application reflected a cookie value into an inline JavaScript context without encoding, and also accepted the same parameter from the query string.

Impact

An attacker could craft a link that runs script in a victim's browser and sends their cookies to an attacker-controlled server.

What the attacker needed

Victim clicks a crafted link; injectable cookie parameter accepted via URL

How it was found

  1. Send a request with a parameter that reflects into an inline script and observe it is encoded.
  2. Notice a cookie value also appears reflected inside the same script block.
  3. Test whether the cookie value can be injected into that script context.
  4. Move the cookie parameter into the URL query string and confirm the injection still works.
  5. Use a payload that redirects the browser to an attacker server with the document cookies attached.

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 web page was putting a value from the visitor's cookie straight into a script on the page without cleaning it. Normally a cookie is hard for an attacker to set on someone else, so the author found that the same value could be passed in the web address instead, letting a crafted link run attacker code in a victim's browser and send their cookies away.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

More by Utkarsh Agrawal

View all

2 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.