Skip to content
XSS Write-up Intermediate

Using Blind XSS to steal session cookies and log in as a differen

The text describes a general method for blind cross-site scripting: injecting a script that sends the victim's session cookie to an attacker-controlled server, then swapping the cookie in the browser to impersonate the victim. It does not describe a specific vulnerability in a named target, only a tutorial-style walkthrough.

shehacks_ Follow

Published on medium.com

However, when it comes to Blind XSS, we already have one specific user in mind someone we want to log in as. Most of the time, that’s an admin or someone with high privileges on the website, but it could also be any individual we’re interested in targeting.

shehacks_, 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 a user input field that is not sanitised before being shown to other users, allowing injected script to run in a victim's browser.

Impact

An attacker could steal a victim's session cookie and log in as that user, but this fails if the cookie is marked HttpOnly, and may only work with a weak or misconfigured Content Security Policy.

What the attacker needed

Attacker-controlled server; victim visits a page with the injected field; cookie not marked HttpOnly

How it was found

  1. Set up a small server that logs incoming cookie values.
  2. Create a script that sends the visitor's cookie to that server.
  3. Inject a script tag pointing to that script into each input field on the site.
  4. Wait for a request to arrive on the server, which shows the vulnerable field fired.
  5. Open the browser developer tools, go to the cookies storage, and replace the session cookie name and value with the captured one.
  6. Reload the site to be logged in as the victim.

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.

Cross-site scripting (XSS) is when a website shows text from a user without cleaning it, so an attacker can slip in a small program (JavaScript) that runs in other visitors' browsers. 'Blind' XSS means the attacker cannot see the result directly, so they set up their own server to catch a signal when the code runs. The stolen signal here is the session cookie, a short code the site uses to remember who is logged in; copying it lets the attacker pretend to be that user.

What is XSS?

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

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.