Skip to content
XSS Write-up Intermediate

Cookie Jar Overflow: A New Threat to HttpOnly Cookies in XSS Vuln

A reflected XSS flaw in a dashboard search feature let an attacker run script that floods the browser's cookie jar with many cookies, causing the browser to evict older cookies. The attacker then sets a chosen session ID cookie, which the victim's browser keeps, so the attacker can later log in as the victim.

sushil phuyal Follow

Published on infosecwriteups.com

Cross-Site Scripting (XSS) is often considered a beautiful attack due to its elegance and effectiveness in exploiting vulnerabilities within web applications. As security professionals and ethical hackers, we frequently encounter XSS vulnerabilities, and the excitement of discovering one is often paired with the dread…

sushil phuyal, on infosecwriteups.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 search parameter was reflected into the page without encoding, and the browser's cookie jar eviction behaviour allowed an injected script to replace the session cookie.

Impact

An attacker could take over the victim's account by fixing their session ID, though the text only demonstrates this in the author's own lab and on Chrome.

What the attacker needed

Reflected XSS in a page; victim clicks a crafted link; victim logs in again; Chrome browser

How it was found

  1. Log in to the lab application so a PHP session cookie is set.
  2. Find that the dashboard search feature reflects input and is vulnerable to reflected XSS.
  3. Send the victim a link whose search value runs script that creates many cookies.
  4. The script then sets a session ID cookie chosen by the attacker.
  5. The victim is logged out and logs in again, keeping the planted session ID.
  6. The attacker uses the same session ID to access the victim's account.

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.

Websites store small pieces of data called cookies in your browser, and one of them is a session ID that proves who you are. A cross-site scripting (XSS) bug lets an attacker run their own code on the site. Here the code fills the browser's cookie storage with junk until the browser throws away old cookies, then plants a session ID the attacker already knows, so the attacker can later act as the victim.

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 sushil phuyal

View all

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