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.
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
- Go to http://innerht.ml/pocs/twitter-dom-based-cookie-bomb/
- Click on the "DoS" link
- Wait for a moment
- 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:
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.
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
- Visit the attacker's proof-of-concept page.
- Click the link labelled 'DoS'.
- Wait for a moment.
- 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.