Skip to content
DoS Disclosed report Intermediate

DOM based cookie bomb

A script on Twitter's site set a cookie using the URL fragment as the cookie name and the referrer as the value, without limiting length or escaping special characters. An attacker could craft a link that causes the victim's browser to store an oversized cookie, making Twitter services inaccessible.

File Descriptor Follow

Originally disclosed on HackerOne

  • Triaged in 27 hours
  • Fixed in 15 days
  • Paid in 4 days
  • Disclosed after 24 months

Hi, I would like to report an issue that allows attackers to plant a "cookie bomb" on a victim's browser, so that the victim will be unable to access any Twitter services.

##PoC

  1. Go to http://innerht.ml/pocs/twitter-dom-based-cookie-bomb/
  2. Click on the "DoS" link
  3. Wait for a moment
  4. Now Twitter will be unaccessible

Video demonstration https://vimeo.com/125377697 (password: c4)

##Details Let's examine the very first script block on https://twitter.com:

JavaScript
function d(a) {
...
        var b = document.referrer || "none",
            d = "ev_redir_" + encodeURIComponent(a) + "=" + b + "; path=/";
        document.cookie = d;
...
}
...
window.location.hash != "" && d(window.location.hash.substr(1).toLowerCase())

In short, it sets a cookie with hash as the name and referrer as the value. The problems are that there is no length limitation setting the cookie and referrer is not properly escaped (i.e. the ";" character). Thus, the attacker can craft a long enough cookie to *.twitter.com and manipulate the referrer value to add additional cookie attributes to make the attack persistent. All requests to Twitter will then result in HTTP 431, causing a DoS on the client side.

The original report as published on HackerOne, by filedescriptor. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

The script set a cookie using unvalidated URL fragment and referrer values without length limits or escaping, allowing an attacker to inject cookie attributes and create an oversized persistent cookie.

Impact

The victim's browser stores an oversized cookie, causing all requests to Twitter to return HTTP 431 and making Twitter services inaccessible to that user.

What the attacker needed

Victim clicks a crafted link

How it was found

  1. Visit the attacker's proof-of-concept page.
  2. Click the link labelled 'DoS'.
  3. Wait for a moment.
  4. Twitter becomes inaccessible.

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 report has not been written yet. The Original tab links to the source.

A cookie is a small piece of data a website asks your browser to store and send back on every request. Here, a Twitter script created a cookie from parts of the web address and the page you came from, without checking how big it was or cleaning special characters. An attacker could make your browser store a huge cookie, so every request to Twitter became too large and the site stopped working for you.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More by File Descriptor

View all

20 more disclosed reports, best first.

More from X / xAI

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.