Norway - store.starbucks.no - CSRF on email change
The email change function on store.starbucks.no lacked CSRF protection, so an attacker could change a logged-in victim's account email if the victim triggered a crafted request.
Originally disclosed on HackerOne
- Triaged in 4 days
- Fixed in 16 days
- Disclosed after 3 months
Summary by the program
moonlight323 discovered a Cross-Site Request Forgery (CSRF) vulnerability on store.starbucks.no. This vulnerability affected the functionality that allows a customer to change the email address associated with their account. By abusing this functionality, an attacker could potentially change the victim's email on the account if they were successfully able to lure the victim to trigger the CSRF payload while they were logged in.
@moonlight323— thank you for reporting this vulnerability and confirming the resolution.
What the report shows
The target is store.starbucks.no, the Norwegian Starbucks storefront, and the feature in question is the one that lets a signed-in customer change the email address associated with their account. The researcher, moonlight323, found that this email-change functionality was vulnerable to Cross-Site Request Forgery.
The report itself is short and is presented as a summary by the program. It does not include the request that performs the email change, the payload used to trigger it, or any reproduction steps. What it does say is the mechanism: an attacker who could lure a logged-in victim into triggering a CSRF payload could potentially change the victim's email address on the account.
The program rated the issue high severity with a CVSS score of 8.3, classified it as Cross-Site Request Forgery (CSRF), and disclosed it on 23 January 2020. No bounty figure is given. The program's note thanks the researcher for the report and for confirming the resolution; the report does not describe what the fix was.
Root cause
The report points to the email-change action accepting a state-changing request without a defence that ties the request to the victim's own session and intent. The report does not name the endpoint, the HTTP method, the parameters or the missing control, so the exact cause is not described.
Impact
Keeping the report's hedge: an attacker who successfully lures a logged-in victim into triggering the payload could potentially change the email address on that victim's account. Changing the account email is a meaningful step because it is usually the address used for password resets and order notifications. The report does not go further than that and does not describe account takeover, so treat the email change itself as the demonstrated impact.
How this kind of bug works
CSRF abuses the fact that browsers attach a site's cookies to requests automatically, regardless of which page caused the request. If a state-changing action is authorised purely by the presence of a valid session cookie, then any other site the victim visits can cause that action to run in the victim's name. The attacker does not need to read the response; they only need the request to be sent.
The classic conditions are: a sensitive action (change email, change password, add a payment method, transfer value), a request that the server accepts based on the cookie alone, and no unpredictable value in the request that the attacker cannot know. GET requests and simple form posts are the easiest to forge; JSON APIs are harder but not immune, since a form can sometimes be crafted to produce a compatible body, and misconfigured CORS can reopen the door.
Defences work by making the request unforgeable or by refusing cross-site requests:
- A per-session, unpredictable anti-CSRF token checked on every state-changing request.
SameSitecookies (LaxorStrict) so the browser does not attach the session cookie to cross-site requests.- Checking the
OriginandRefererheaders against an allowlist. - Requiring re-authentication or a confirmation step for sensitive changes such as email or password.
How to test for it
- Map the state-changing actions while authenticated: profile updates, email and password changes, address book edits, payment methods, API keys, notification settings.
- For each, capture the request and note the method, the parameters, and whether any value looks like a CSRF token.
- Remove the token parameter or header and resend the request. If it still succeeds, the token is not being enforced.
- Change the token to a random value of the same shape and resend. If it still succeeds, the check is cosmetic.
- Test the token's binding: take a token from your own session and use it with a different session, or reuse an old token. A token that is not tied to the session is weak.
- Build a cross-site proof: an HTML page on a different origin that submits the same request automatically, then load it in a browser where you are logged in to the target. A positive result is the action taking effect (the email actually changes) without any interaction beyond visiting the page.
- Check the cookie attributes: if the session cookie is
SameSite=Noneor unset, cross-site requests will carry it;Laxblocks most cross-site POSTs but not top-level GET navigations.
Common false positives: the action appears to succeed but the server silently ignores the change; the endpoint requires a header that a cross-site form cannot set (though check whether CORS or a JSON content type can be bypassed); the token is present but you forgot to remove it from the body; the request only works because you were already on the same site in the test browser. Always confirm the change on the server side, for example by reloading the profile page or checking the confirmation email, not just by looking at the response status.
How it is fixed
- Enforce a per-session anti-CSRF token on all state-changing requests, and reject requests with a missing or mismatched token.
- Set the session cookie with
SameSite=LaxorStrictandSecure. - Validate
Originand, where present,Refereragainst the expected site. - For email and password changes, require the current password or a confirmation link sent to the existing address before the change takes effect.
- Notify the user at the old address when the email is changed, so a silent takeover is visible.
Hunting notes
CSRF tends to hide in older parts of an application, in secondary storefronts and regional sites, in admin panels, and in endpoints added later without the framework's default protections. Look for forms that post directly, endpoints that accept application/x-www-form-urlencoded, and actions that were built before a token middleware was introduced. Recon signals include multiple regional domains sharing a codebase, mixed frameworks, and endpoints that return different behaviour when the token parameter is omitted.
To get a report accepted, show the full chain: the captured request, the cross-site page that triggers it, and evidence that the server-side state actually changed. A short screen recording of the change taking effect after visiting the attacker page is usually enough. If the impact is limited to a low-value setting, say so plainly rather than overstating it; programs respond better to a precise, reproducible demonstration than to a theoretical worst case.
What happened, in plain words
Starbucks runs online stores in many countries. This report is about the Norwegian one, at store.starbucks.no. Like most shops, it lets you create an account so you can order things. An account is tied to an email address, which is where order confirmations and password reset links go.
The store has a feature that lets a signed-in customer change the email address on their account. The researcher, moonlight323, found that this feature could be abused through a technique called Cross-Site Request Forgery, or CSRF for short.
To understand CSRF, you first need to know what a cookie is. When you log in to a website, the site's server sends your browser a small piece of data called a session cookie. Your browser stores it and attaches it to every later request you make to that same site. That is how the site knows it is still you and does not ask for your password on every page. The important part is that the browser attaches the cookie automatically, based on which site the request goes to, not on which page told the browser to make the request.
CSRF abuses exactly that. If another website can make your browser send a request to the store, your browser will attach your store cookie to it, and the store will treat the request as coming from you. The attacker never sees your password or your cookie; they only need your browser to send the request while you are logged in.
The report describes the mechanism in one sentence: an attacker who could lure a logged-in victim into triggering a CSRF payload could potentially change the victim's email address on the account. A payload here means a small piece of content, typically a page or a form, that the attacker prepares and gets the victim to load. Luring means getting the victim to visit that page, for example through a link.
Why does changing an email address matter? Because the email address on an account is usually where password reset links are sent. If an attacker can quietly move the account's email to an address they control, the account's recovery path moves with it. The report stops at the email change itself and does not describe anything beyond it, so the demonstrated impact is the change of address.
The program rated the issue high severity with a CVSS score of 8.3. CVSS is a standard scoring system that turns the characteristics of a vulnerability into a number, so people can compare issues consistently. The report was disclosed on 23 January 2020. No bounty amount is given.
The report is short and is presented as a summary written by the program rather than a detailed technical write-up. It does not include the request that performs the email change, the payload used to trigger it, or step-by-step reproduction instructions. The program's note thanks the researcher for the report and for confirming the resolution, though the report does not say what the fix was.
In general, how this kind of bug works
CSRF is not specific to this store. It is a general weakness that appears wherever a website changes something important based on a request that the browser can be tricked into sending.
Think of a cloakroom. You hand in your coat and get a ticket. The ticket is your session cookie: whoever holds it can collect the coat. Now imagine the cloakroom accepts any ticket handed over at the counter, without checking who is handing it in. Someone else could take your ticket number, write it on a slip, and hand that slip to the counter. The cloakroom would give them your coat. CSRF is the web version: the attacker cannot steal your ticket, but they can make your browser present it.
Three conditions usually have to line up for a CSRF attack to work:
- A sensitive action exists, such as changing an email address, changing a password, adding a payment method or moving money.
- The server accepts that action based on the session cookie alone, without any other proof that the request came from its own pages.
- The request contains nothing unpredictable that the attacker could not guess or copy.
Simple form submissions and GET requests are the easiest to forge. Requests that expect a JSON body are harder, but not automatically safe, because a form can sometimes be shaped to produce a compatible body, and a misconfigured CORS setup can reopen the door. CORS is a browser rule that controls whether a page from one site may read responses from another; when it is set too loosely, protections that relied on the browser blocking reads can fall apart.
Defences work in two broad ways: making the request unforgeable, or refusing requests that come from elsewhere.
- A per-session, unpredictable anti-CSRF token. The server puts a random value in the store's own pages, and the page must send it back with the action. Another site cannot know the value, so it cannot build a valid request.
SameSitecookies, set toLaxorStrict, so the browser does not attach the session cookie to requests coming from other sites.- Checking the
OriginandRefererheaders, which describe where a request came from, against a list of allowed sites. - Requiring re-authentication or a confirmation step for sensitive changes such as email or password.
If you want to look for this kind of bug yourself, the general approach is:
- While logged in, list the actions that change something: profile updates, email and password changes, address book edits, payment methods, notification settings.
- For each one, capture the request and note the method, the parameters, and whether any value looks like a CSRF token.
- Remove the token and resend. If the action still succeeds, the token is not being enforced.
- Replace the token with a random value of the same shape and resend. If it still succeeds, the check is cosmetic.
- Test whether the token is tied to your session: use a token from one session with another, or reuse an old one. A token that is not bound to the session is weak.
- Build a cross-site proof: a page on a different site that submits the same request automatically, then open it in a browser where you are logged in to the target. A positive result is the action actually taking effect with no interaction beyond visiting the page.
- Check the cookie attributes. If the session cookie is
SameSite=Noneor unset, cross-site requests will carry it.Laxblocks most cross-site POSTs but not top-level GET navigations.
Watch out for false positives. The action may appear to succeed while the server silently ignores the change. The endpoint may require a header that a cross-site form cannot set, though CORS or a JSON content type may sometimes be bypassed. You may have forgotten to remove the token from the body. The request may only work because you were already on the same site in your test browser. Always confirm the change on the server side, for example by reloading the profile page or checking the confirmation email, not just by looking at the response status.
Fixes follow the defences above: enforce a per-session anti-CSRF token on all state-changing requests and reject missing or mismatched tokens; set the session cookie with SameSite=Lax or Strict and Secure; validate Origin and, where present, Referer against the expected site; require the current password or a confirmation link sent to the existing address before an email or password change takes effect; and notify the user at the old address when the email is changed, so a silent change is visible.
CSRF tends to hide in older parts of an application, in secondary storefronts and regional sites, in admin panels, and in endpoints added later without the framework's default protections. Look for forms that post directly, endpoints that accept application/x-www-form-urlencoded, and actions built before a token check was introduced. Signals worth noticing include several regional domains sharing a codebase, mixed frameworks, and endpoints that behave differently when the token parameter is omitted.
To get a report accepted, show the full chain: the captured request, the cross-site page that triggers it, and evidence that the server-side state actually changed. A short screen recording of the change taking effect after visiting the attacker page is usually enough. If the impact is limited to a low-value setting, say so plainly rather than overstating it; programs respond better to a precise, reproducible demonstration than to a theoretical worst case.
Glossary
- CSRF (Cross-Site Request Forgery): a weakness where another website can make your browser send a request to a site you are logged in to, and the site treats it as your own action.
- Session cookie: a small piece of data your browser stores after you log in and attaches automatically to requests to that site, so the site recognises you.
- Payload: the content an attacker prepares, such as a page or form, that causes the unwanted request when the victim loads it.
- Endpoint: the specific address on a server that handles a particular action.
- CVSS: a standard scoring system that turns a vulnerability's characteristics into a number for comparison.
- Anti-CSRF token: a random, unpredictable value placed in a site's own pages that must be sent back with an action, which another site cannot know.
SameSite: a cookie setting that controls whether the browser attaches the cookie to requests coming from other sites.OriginandRefererheaders: pieces of a request that describe where the request came from.- CORS: a browser rule that controls whether a page from one site may read responses from another.
- GET and POST: two kinds of HTTP request; GET is typically used to fetch a page, POST to submit data.
application/x-www-form-urlencoded: a common format for form data sent in a request body.- False positive: a test result that looks like a vulnerability but is not one in reality.
- Account takeover: an attacker gaining control of someone else's account.