Reflected XSS on https://www.starbucks.co.uk/shop/paymentmethod/ (bypass for 227486)
A reflected cross-site scripting vulnerability existed on the Starbucks UK website because double quotes in the URL path were not properly encoded when inserted into a canonical link element. An attacker could craft a URL that, when visited by a logged-in user, executed arbitrary JavaScript in the context of the site.
- Triaged in 17 hours
- Fixed in 2.1 years
- Paid in 17 hours
- Disclosed after 2.9 years
Summary by the program
bayotop discovered a reflected XSS on www.starbucks.co.uk due to lack of encoding that was a bypass for report #227486. @bayotop — thank you for reporting this vulnerability and for confirming the resolution.
The report
Hi guys,
I am now able to prove my concerns from #227486 (see my last comment). "s are still not correctly encoded when rendered into the page in the <link rel="canonical" href="current_full_url" /> element on almost any https://starbucks.co.uk/ page.
The WAF is bypassed by encoding "s as %2522 in the URL path. This won't work when the payload is part of the query string.
Description
Take a look on the source code of https://www.starbucks.co.uk/shop/card/egift/anthing%2522. You can see a quote is injected to break the href attribute context.
<link rel="canonical" href="https://www.starbucks.co.uk/shop/card/egift/anthing"" />
Exploitation
Using the same tricks as described in #227486 this injection can be leveraged to achieve arbitrary JS execution on /shop/paymentmethod/. Also note that this is just one example and more ways may exist to achieve JS execution. Steps to reproduce (use Firefox):
- Login at https://www.starbucks.co.uk and add a card into basket on https://www.starbucks.co.uk/shop/card/egift/birthday
- Visit https://www.starbucks.co.uk/shop/paymentmethod/hkjhk%2522onclick=%2522confirm(/-/g+this.ownerDocument.domain)%2522id=%2522checkoutButton
- Click somewhere around the Checkout header.
- An alert showing the current domain pops up.
Recommendation
Again, correctly encode the URL before reflecting it back in the response.
In #227486 the fix was blocking requests containing %u0022 in the query string. This was shown to be bypassable so fixing this issue by blocking %2522 in URL paths could be bypassed again in future.
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 application reflected the URL path into an HTML attribute without properly encoding double quotes, and the previous fix only blocked a specific encoding bypass rather than addressing the underlying lack of output encoding.
Impact
An attacker could execute arbitrary JavaScript in the context of the Starbucks UK site when a logged-in user visited a crafted link; the exploit worked in Firefox and bypassed the WAF by encoding quotes in the URL path.
What the attacker needed
Victim is logged in; victim clicks a crafted link; use Firefox browser
The fix
The URL should be correctly encoded before being reflected in the response, rather than relying on blocking specific encoded characters.
How it was found
- Log in and add a card to the basket.
- Visit a crafted URL containing an encoded double quote and event handler.
- Click near the Checkout header.
- An alert showing the domain appears.
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 a website takes part of the URL and puts it directly into the page without cleaning it, an attacker can include special characters that break out of the intended context. Here, a double quote character was not encoded, so it could close an HTML attribute and add new attributes like an event handler. This let the attacker run their own JavaScript when a victim visited a crafted link.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.