Stored XSS in comments on https://www.starbucks.co.uk/blog/*
The author parameter in blog comments was not correctly encoded, allowing an attacker to inject arbitrary HTML. A WAF blocked common script tags and on* handlers, but a bypass using less common event handlers allowed script execution in Firefox.
- Triaged in 10 days
- Fixed in 3 months
- Paid in 10 days
- Disclosed after 3 months
Hi,
there are a lot of published blog post under https://www.starbucks.co.uk/blog/*. You can find plenty of them using this google dork site:www.starbucks.co.uk inurl:blog/. Notice the comments functionality at the bottom at the page.
When a comment is sent the following request is made:
POST /blog/addcomment HTTP/1.1
Host: www.starbucks.co.uk
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0
Accept: text/html, */*; q=0.01
Accept-Language: en-US,en;q=0.5
X-NewRelic-ID: VQUHVlNSARACV1JSBAIGVA==
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With: XMLHttpRequest
Referer: https://www.starbucks.co.uk/blog/setting-the-record-straight-on-starbucks-uk-taxes-and-profitability
Content-Length: 321
Cookie: [redacted]
Connection: close
Body=Nice&ParentId=0&PostID=1241&author=ope67164%40disaq.com
The values of the Body and author parameters will be rendered into the page as a new comment. The value from the author parameter is not correctly encoded. This allows to inject arbitrary valid HTML.
You seem to be using a WAF which will block request (500) containing <script></script> and various input matching on*=. However, I managed to find a bypass:
</li></ul></li></ul></div></div></div></div><test/onbeforescriptexecute=confirm`h1poc`>
This will work on latest FF as can be seen here: https://www.starbucks.co.uk/blog/setting-the-record-straight-on-starbucks-uk-taxes-and-profitability
Note that the closing tags are just to make the script execute (I'm sorry for the multiple payloads on that site, once the above comment was sent, all previous attempts started to work. Would be great if you could clean up the comments at the end).
Here is a list of all potential on*= events I could find, that will bypass your WAF an can be used to create cross-browser payloads:
onsearch
onwebkitanimationiteration
onwebkitanimationstart
onanimationiteration
onwebkitanimationend
onanimationstart
ondataavailable
ontransitionend
onanimationend
onreceived
onpopstate
To fix this issue make sure the author value is correctly encoded. It could be also taken from the current user's session instead of the POST data. Also I recommend adding the aforementioned events to your WAF blacklist.
Please let me know in case you need any more information from my 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 author parameter was not correctly encoded before being rendered into the page, allowing HTML injection.
Impact
An attacker could execute JavaScript in the browser via the comment author field. The WAF blocked some payloads but was bypassed with less common event handlers.
What the attacker needed
Ability to post a comment; victim views the comment
The fix
The author value should be correctly encoded, and could be taken from the session instead of POST data; also add the listed events to the WAF blacklist.
How it was found
- Find a blog post with a comment form.
- Submit a comment with a crafted author value containing HTML and an event handler.
- The comment is rendered and the script executes in the browser.
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.
When you post a comment, your name is shown on the page. The site didn't clean up the name properly, so someone could put special code in the name field that makes the browser run a script.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.