Open Redirect after login at http://ecommerce.shopify.com
The login page accepted a return_to parameter that was used to build the post-login redirect, and a crafted value caused the victim to be sent to a different domain controlled by the attacker. An attacker could use this to send users to a phishing site after they log in.
- Triaged in 6 days
- Fixed in 6 months
- Paid in 6 months
- Disclosed after 6 months
Hi,
The users can be redirected to some other site which is in control of the attacker from http://ecommerce.shopify.com/accounts
Let's say user is attacker asked victim to login from the here : http://ecommerce.shopify.com/accounts?found_email=true&return_to=.mx%2F&user[email][email protected]
When victim enters the password he is redirected to http://ecommerce.shopify.com.mx/ This com.mx can be changed to multiple like .es .tw etc
These can be controlled by the attacker and used in other attacks
What the report shows
The target is the Shopify ecommerce subdomain at http://ecommerce.shopify.com, and the feature in question is the accounts area, which handles login and, after a successful login, sends the user onward to a destination given in the request. The researcher found that this onward destination could be pointed at a host outside Shopify's control.
The claim is that a user can be redirected to another site controlled by an attacker, starting from http://ecommerce.shopify.com/accounts. The scenario the report describes is a victim being asked to log in through a crafted link:
http://ecommerce.shopify.com/accounts?found_email=true&return_to=.mx%2F&user[email]=[redacted]
Here return_to carries the value .mx%2F, which is the URL-encoded form of .mx/. When the victim enters their password, they are redirected to http://ecommerce.shopify.com.mx/. The report notes that the .com.mx ending can be changed to others such as .es or .tw, and that these can be controlled by the attacker and used in other attacks.
The report gives no further detail on the server response, the exact redirect status code, or the fix that was applied.
Root cause
The behaviour is consistent with the return_to value being joined to the site's own hostname rather than validated as a complete, trusted URL, though the report does not state the mechanism. The value .mx/ is not an absolute URL, so a naive check that only looks for the absence of http:// or // would pass it. Concatenating the base host with the supplied value produces ecommerce.shopify.com.mx, which is a different registrable domain from shopify.com. The application then redirects the freshly authenticated user there.
This is a classic suffix-injection variant of an open redirect: the attacker does not supply a full external URL but a fragment that, once joined to the trusted host, resolves to an attacker-owned domain. The report does not state which validation, if any, was present, so the exact code path is inferred from the behaviour.
Impact
The impact is a redirect to an attacker-controlled domain after the victim logs in on the genuine page. The report says the destinations can be controlled by the attacker and used in other attacks. The report does not claim credential theft, session theft or any specific follow-on compromise, and none should be assumed.
How this kind of bug works
An open redirect exists when an application takes a destination from user input and sends the browser there without confirming that the destination is trusted. The destination usually arrives as a query parameter (return_to, next, redirect, url, continue, callback) or as part of a path. The bug appears when the application either forwards the value verbatim or builds a URL by joining a trusted base with the value using string concatenation.
Concatenation is the subtle case. If the base is https://shop.example.com and the value is .evil.com/, the result is https://shop.example.com.evil.com/, which the browser resolves against the attacker's domain. Similar tricks use @ (userinfo), backslashes that some parsers normalise to slashes, encoded characters, and values that begin with // or /\ to switch to a protocol-relative URL. Validation that only checks for a substring like example.com anywhere in the value, or only rejects values starting with http, will miss these.
Defences fall into two groups. The robust approach is to avoid passing raw URLs at all: use an opaque identifier or a relative path that the server maps to a known destination. Where a URL must be accepted, parse it with a proper URL library, compare the resolved host against an allowlist of exact hostnames, and reject anything that does not match. Relative paths should be resolved against the base and then re-checked, not concatenated.
How to test for it
- Map every place the application sends the browser somewhere after an action: login, logout, registration, password reset, email confirmation, OAuth callbacks, payment returns and language or region switches.
- Identify the parameter that carries the destination. Watch the address bar and the
Locationheader during normal use. - Send candidate values one at a time and observe where the browser actually lands, not just what the parameter echoes back. Useful candidates include an absolute external URL, a protocol-relative value, a value beginning with a single slash, a backslash variant, a value with userinfo such as
[redacted], and a suffix such as.attacker.example/when the parameter appears to be appended to the host. - Test both the raw and URL-encoded forms, and test after any client-side normalisation, since some applications sanitise in JavaScript but not on the server.
- A positive result is a response that causes the browser to navigate to a host you control, or a
Locationheader pointing there, after the application has accepted the input.
Common false positives: a parameter that is reflected into the page body but never used for navigation; a redirect that only fires for authenticated users, where you have not completed the flow; a redirect blocked by an interstitial warning page; and a value that is rejected by the server but still echoed in an error message. Confirm the navigation actually happens in a browser before reporting.
How it is fixed
- Replace free-form destination URLs with server-side identifiers or fixed relative paths.
- If URLs must be accepted, parse them and allow only exact, allowlisted hostnames, rejecting anything else.
- Never build a redirect target by concatenating user input onto a hostname; resolve relative paths against the base and re-validate the result.
- Reject values containing userinfo, backslashes, control characters or encoded equivalents before parsing.
- Apply the same check on every entry point, including client-side redirects, so the server is not the only guard.
Hunting notes
Open redirects cluster around authentication and account flows, because those flows need to return the user somewhere sensible. Login, logout, SSO and OAuth callbacks, email verification, invitation acceptance and region or language selection are the usual suspects. Multi-tenant and multi-domain products are especially prone to the suffix trick, since the codebase may already treat many hostnames as related.
Recon signals worth noting: parameters named after destinations in links you see in emails or password-reset messages; redirects that differ between the raw and encoded form of the same value; and applications that accept a bare hostname fragment rather than a full URL. Comparing behaviour across regional subdomains can reveal whether the destination is being joined to the host.
To make a report land, show the full flow from the trusted page to the external destination, ideally with the victim completing the action that triggers the redirect, and explain the realistic abuse: a link that starts on the trusted domain and ends on a lookalike. Keep the claim proportionate to what you demonstrated, and note any preconditions such as authentication.
What happened, in plain words
Shopify runs an online store platform, and ecommerce.shopify.com is one of its web addresses (a subdomain, meaning a named section under the main shopify.com domain). The part of that site in question is the accounts area, which handles logging in. After a successful login, the site sends the user onward to a destination that is supplied in the web address itself.
The researcher found that users could be redirected to another site controlled by the attacker. The scenario in the report is simple: an attacker sends a victim a link to the genuine Shopify login page, the victim logs in there, and the browser then lands on a different site chosen by the attacker.
The crafted link looks like this:
http://ecommerce.shopify.com/accounts?found_email=true&return_to=.mx%2F&user[email]=[redacted]
Reading it piece by piece:
http://ecommerce.shopify.com/accountsis the real Shopify accounts page. Everything before the?is the address of the page itself.- The
?starts the query string, a list of name and value pairs that the page receives. Think of it like the options you tick on a form before handing it in. found_email=trueis one such pair. The report does not explain what it does, only that it is present.return_to=.mx%2Fis the important one.return_tomeans "where to send the user afterwards". Its value is.mx%2F, and%2Fis the URL-encoded form of the slash character/, so the value really reads.mx/.user[email]=[redacted]fills in the email field in advance, so the victim only has to type a password.
When the victim enters their password on that genuine page, the browser is redirected to http://ecommerce.shopify.com.mx/. That address is not Shopify: shopify.com.mx is a different domain, and the report notes the .com.mx ending can be swapped for others such as .es or .tw. The report says these destinations can be controlled by the attacker and used in other attacks.
The victim starts on the genuine Shopify page, types their password there, and is then redirected to the attacker-controlled address.
The report does not describe the server's response, the redirect status code, or the fix that was applied.
In general, how this kind of bug works
This is called an open redirect: the application takes a destination from user input and sends the browser there without checking that the destination is trusted. The destination usually arrives as a query parameter, with names like return_to, next, redirect, url, continue or callback, or as part of the path.
The subtle version, and the one here, comes from building the address by gluing text together. If the site's own address is https://shop.example.com and the supplied value is .evil.com/, joining the two gives https://shop.example.com.evil.com/, which the browser reads as a host called shop.example.com.evil.com, owned by the attacker. A check that only looks for http:// or // in the value would let .mx/ through, because it contains neither. Other tricks use an @ sign, backslashes that some programs treat as slashes, encoded characters, or values starting with // to switch to another host.
Defences come in two groups. The strongest is not to accept addresses at all: use a short identifier or a relative path that the server maps to a known destination. Where an address must be accepted, parse it with a proper URL library, compare the resulting host against a list of exact allowed hostnames, and reject anything else. Relative paths should be resolved against the base and then checked again, never glued on.
How to test for it
- List every place the site sends the browser somewhere after an action: login, logout, registration, password reset, email confirmation, third-party login callbacks, payment returns and language or region switches.
- Find the parameter carrying the destination by watching the address bar and the
Locationresponse header during normal use. TheLocationheader is the instruction a server sends telling the browser to go elsewhere. - Try candidate values one at a time and watch where the browser actually lands, not just what the parameter shows back. Candidates include a full external address, a value starting with
//, a value starting with a single slash, a backslash variant, a value with an@such as[redacted], and a suffix such as.attacker.example/when the value seems to be appended to the host. - Test both the raw and the encoded form, and test after any in-browser cleaning, since some sites sanitise in JavaScript but not on the server.
- A positive result is a response that makes the browser navigate to a host you control, or a
Locationheader pointing there, after the site accepted the input.
Common false positives: a parameter echoed into the page but never used for navigation; a redirect that only fires for logged-in users when you have not finished logging in; a redirect stopped by a warning page; and a value rejected by the server but still shown in an error message. Confirm the navigation really happens in a browser before reporting.
How it is fixed
- Replace free-form destination addresses with server-side identifiers or fixed relative paths.
- If addresses must be accepted, parse them and allow only exact, listed hostnames.
- Never build a redirect target by gluing user input onto a hostname; resolve relative paths against the base and re-check the result.
- Reject values containing an
@, backslashes, control characters or their encoded equivalents before parsing. - Apply the same check at every entry point, including redirects done in the browser, so the server is not the only guard.
Hunting notes
Open redirects cluster around login and account flows, because those flows need to return the user somewhere sensible. Login, logout, single sign-on and third-party login callbacks, email verification, invitation acceptance and region or language selection are the usual suspects. Products that span many domains are especially prone to the suffix trick, since the code may already treat many hostnames as related.
Signals worth noting: parameters named after destinations in links from emails or password-reset messages; redirects that differ between the raw and encoded form of the same value; and sites that accept a bare hostname fragment rather than a full address. Comparing behaviour across regional subdomains can show whether the destination is being joined to the host.
To make a report land, show the full flow from the trusted page to the external destination, ideally with the victim completing the action that triggers the redirect, and explain the realistic abuse: a link that starts on the trusted domain and ends on a lookalike. Keep the claim proportionate to what you demonstrated, and note any preconditions such as being logged in.
Glossary
- Subdomain: a named section under a main domain, such as
ecommerceinecommerce.shopify.com. - Domain: the registered name that identifies a website, such as
shopify.com. - Query string: the part of a web address after
?, made of name and value pairs passed to the page. - Parameter: one name and value pair in a query string, such as
return_to=.mx%2F. - URL encoding: writing special characters in a safe form, for example
%2Ffor/. - Redirect: an instruction that makes the browser leave the current page and load another address.
Locationheader: the part of a server response that tells the browser where to go next.- Open redirect: a bug where a site sends the browser to a destination taken from user input without checking it is trusted.
- Suffix injection: adding a fragment to a trusted hostname so the result points at an attacker-owned domain, as with
.mx/becomingshopify.com.mx. - Host: the part of an address naming the server, such as
ecommerce.shopify.com. - Allowlist: a list of values that are explicitly permitted, with everything else rejected.
- Authentication: proving who you are, usually by logging in with an email and password.
- Session: the state a site keeps about you after you log in, so you do not have to log in on every page.
- Phishing: tricking someone into trusting a link or page so they hand over information or follow the attacker's lead.
- False positive: a result that looks like a bug but is not one in practice.
- CVSS: a standard scoring system for rating the severity of a security flaw.