H1514 Simple phishing using auto-created modal with weak URL-pattern check in incontext_app_link
The incontext_app_link parameter was checked server-side to only allow shopifycloud.com URLs, but userdata containing two backslashes could make browsers load a different domain before the @. An attacker could then show a fake Shopify login modal to an admin and steal their credentials.
Frans Rosén Follow with avlidienbrunn
Originally disclosed on HackerOne
- Triaged in 3 days
- Fixed in 4 months
- Paid in 3 days
- Disclosed after 6 months
Summary by the program
@fransrosen and @avlidienbrunn found that it was possible to inject arbitrary content from other domains into the products page in admin via the incontext_app_link parameter. This content was intended to be limited to the domains of installed apps, but this bug would have allowed any URL to load content in a modal inside Shopify admin.
The report
Hi,
This is unrelated to the Twine-template issue reported earlier as this would still be an issue if the template escape would be fixed.
Background
The incontext_app_link is checked server-side if it's a correct shopifycloud.com-URL. The problem however is that userdata inside the URL is allowed. By utilizing two backslashes \\ in the userdata, we're able to make all browsers except Safari load the URL before the @ instead of the domain after. This means that since the API.modal.open triggers directly when the victim accesses the page, we can fake a login page on this URL to make the admin think they need to reauthorize in Shopify. However, the link is actually loaded from a different domain and the credentials will be stolen whenever the admins uses the form.
The same thing applies here as to the Twine-report, the attacker needs to use a product-ID that exists for the merchant. But since these IDs are publicly available in the webstore, this should be no issue.
PoC
PoC-link (use your own store, and also replace 1557454323768 with a working Product ID inside your store):
/admin/products/1557454323768?incontext_app_link=https%3A%2F%2F████████%5C%5C%40google-shopping.shopifycloud.com
The following HTML is loaded from ██████:
<center>
<form onsubmit="alert('your login is: ' + document.getElementById('u').value + ':' + document.getElementById('p').value); return false">
<input id="u" placeholder="Email address" style=" position: absolute; top: 140px; left: 80px; font-size: 20px; height: 50px; border: 0; width: 400px;">
<input id="p" placeholder="Password" type="password" style="position: absolute; font-size: 20px; height: 50px; border: 0; width: 400px; left: 80px; top: 210px;">
<button type="submit" style="position: absolute; left: 80px; height: 50px; top: 280px; width: 480px; background: transparent; border: 0;"></button></form>
{{media:0}}</center>
<script>parent.postMessage('{"message":"Shopify.API.Modal.setHeight","data":{"height":500,"width":"940"}}','*')</script>
Here's a video showing the scenario of the attacker sending a link to an admin:
Regards, Frans and Mathias
Impact
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
Likely the server-side URL check only validated the hostname suffix and did not reject userdata containing backslashes, which browsers parse differently.
Impact
An attacker could steal Shopify admin credentials by tricking the admin into submitting a fake login form, though the attack did not work in Safari.
What the attacker needed
Victim is a Shopify admin; victim clicks a crafted link; attacker knows a valid product ID; browser other than Safari
How it was found
- Find a product ID that exists for the target merchant.
- Craft an incontext_app_link URL with two backslashes in the userdata pointing to an attacker-controlled domain.
- Send the crafted admin product page link to the victim admin.
- The modal opens automatically and loads the attacker's fake login form.
- The admin enters credentials into the fake form and they are captured.
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.
A web address can contain a username part before an @ sign. The site checked the address was a correct shopifycloud.com URL, but a crafted address with two backslashes made all browsers except Safari treat the part before the @ as the real site, loading a fake login page inside the admin panel.
What is Open redirect?
A trusted site forwards users to any address an attacker picks; rarely paid alone, often the missing link in a chain.