[livechat.shopify.com] Cookie bomb at customer chats
The customer support application stored URL parameters in cookies without checking their length, and the escape function could triple the size of special characters. An attacker could craft a link that sets an oversized cookie for the .shopify.com domain, causing subsequent requests to the site to be rejected with a 400 error for 30 days.
- Triaged in 7 hours
- Fixed in 6 days
- Disclosed after 35 days
Summary by the program
Our customer support application would store a value from the query string in a cookie without checking the length of the value, which could cause subsequent requests to the app to be rejected if the total length of the cookie was too long.
The report
When we visit the https://livechat.shopify.com/customer/chats/new page the ref and ssid URL parameters are used to set cookie values the way as follows:
var getURLParameter = function(name) { return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search)||[,""])[1].replace(/+/g, '%20'))||null; }
var brandedKeyword = function(ref) { var match1 = new RegExp("((google|yahoo|bing)(.)&?q=([^&])shopify)", "gi").test(ref); return (match1); }
var ref = getURLParameter('ref'); var ssid = getURLParameter('ssid');
if (ref && !brandedKeyword(document.referrer)) { var days = 30; var expire = new Date(today + days1000606024); setCookieWithExpiration('source', ref , expire); if (ssid) { setCookieWithExpiration('ssid', ssid , expire); } }
var setCookieWithExpiration = function(key, value, expire) { var match = document.location.hostname.match(/shopify..*/) var domain if(match){ domain = '.' + match[0] } else { domain = '.shopify.com' } document.cookie = key + "=" + escape(value) + ";path=/" +";expires=" + expire.toUTCString() + ';domain=' + domain; };
As we can see, the values lengths are not taken into consideration:
document.cookie = key + "=" + escape(value) + ";path=/" +";expires=" + expire.toUTCString() + ';domain=' + domain;
Furthermore, the escape function is used, which means a value consisting of special symbols will become three times longer. For example ,,, will turn into %2C. That means an attacker can create a valid link of proper length accepted both by the browser and the server, which however will make the cookie too long, so after his victim visits this link, https://livechat.shopify.com will stop working for him for 30 days (and the other shopify pages as well, cause these cookies are set for the .shopify.com domain).
PoC:
- Go to https://livechat.shopify.com/customer/chats/new?ref=,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,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,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
- Go to https://livechat.shopify.com/customer/chats/new — result: 400 error
- Go to https://www.shopify.com/ — result: 400 error
- Go to https://app.shopify.com/services/partners/auth/login — result: 400 error
Tested with Firefox 42.0.
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
Impact
After a victim visits the crafted link, livechat.shopify.com and other Shopify pages could stop working for them for 30 days due to oversized cookies.
What the attacker needed
Victim clicks a crafted link
How it was found
- Visit the customer chats new page with very long ref and ssid parameters.
- Visit the customer chats new page again and observe a 400 error.
- Visit the main Shopify website and observe a 400 error.
- Visit the Shopify partners login page and observe a 400 error.
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 stores in your browser. This site took a value from the web address and saved it as a cookie without limiting how long it could be. By making that value very long, an attacker could fill up the cookie jar so much that the site would refuse to load for the victim.
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.