Auditing a Shopify store
Shopify hosts the whole store: catalog, checkout, payments and customer data. The platform is run by Shopify, so the audit focuses on what the merchant configures:
- who gets into the admin, with which permissions and which second factor;
- which apps have access to the data and what code they’ve left in the theme;
- which scripts load on the storefront;
- how the merchant’s own apps verify what Shopify sends them.
Responsibility model
Section titled “Responsibility model”Shopify runs the infrastructure, the checkout and card storage. The merchant decides:
- who has a staff or collaborator account, and with which role;
- whether two-step authentication is required;
- which apps to install, which scopes to grant them and when to remove them;
- what code the theme contains;
- how their own apps validate webhooks and proxy requests.
flowchart LR
P["Staff and collaborators<br/>roles, 2FA"] --> A["Shopify admin"]
A --> T["Theme<br/>theme.liquid, assets"]
A --> AP["Apps<br/>scopes, shpat_ tokens"]
AP -->|"ScriptTags, app embeds"| T
T --> C["Storefront and checkout"]
S["Shopify"] -->|"signed webhook<br/>X-Shopify-Hmac-SHA256"| B["App backend"]
C -->|"app proxy<br/>signature"| B
Accounts: staff, collaborators and 2FA
Section titled “Accounts: staff, collaborators and 2FA”Settings → Users lists every staff and collaborator account, with its role and last access. It’s the first place to review.
- Collaborators. Agencies and developers sign in with a collaborator account from their partner organization. They have the permissions granted to them, often including editing theme code, and they’re sometimes still there years after the job ended.
- Two-step authentication. According to Shopify’s Help Center, it can be required for each staff member from the admin; if it isn’t, each user decides whether to turn it on. On Shopify Plus, a secure sign-in method can be required for every user in the organization. Each user manages their own methods in their account: the merchant can’t see or change the phone number or authenticator app.
- Roles. Minimal permissions per job; access to Themes → Edit code and Apps only for those who need it.
Apps and the code they leave behind
Section titled “Apps and the code they leave behind”- Scopes. Each app requests permissions (
read_orders,write_customers…). Check that they match what it does. - Custom apps. They generate Admin API tokens (
shpat_…) that must be stored as secrets: with one, orders and customers can be read without going through the admin. - Orphaned code. When an app is uninstalled, its code can stay in the theme (snippets in
snippets/,{% include %}intheme.liquid). Apps also inject scripts through Admin API ScriptTags, which don’t appear in the theme files and load via{{ content_for_header }}. - Thank you and Order status pages. Shopify has removed
checkout.liquid, Additional scripts and ScriptTags there: on August 28, 2025 for Plus stores and on August 26, 2026 for the rest. Their replacement, Checkout Extensibility (UI extensions and pixels), runs in a sandbox.
To see which external scripts the store actually loads, look at the served HTML, not just the theme files:
curl -s https://authorized-store.example/ | grep -Eo '<script[^>]+src="[^"]+"' | sort -uEvery domain on the list should map to an installed app or a known service.
Signatures: webhooks and app proxy
Section titled “Signatures: webhooks and app proxy”The merchant’s own apps receive two kinds of requests signed by Shopify:
- Webhooks.
X-Shopify-Hmac-SHA256is a base64 HMAC-SHA256 of the raw body, computed with the app’s client secret. The documentation asks you to verify it before processing and to useX-Shopify-Webhook-Idto detect duplicates. - App proxy (
/apps/...on the store’s domain). Shopify addsshop,logged_in_customer_id,timestampandsignatureto the URL. The signature is a hex HMAC-SHA256 of the parameters, sorted and concatenated with no separators.
Lab: verifying both signatures
Section titled “Lab: verifying both signatures”The two proxy examples are the test vectors published in Shopify’s documentation (secret hush). The webhook uses a made-up secret:
import base64, hashlib, hmac, jsonfrom urllib.parse import parse_qs
# --- 1. App proxy: example vectors from the Shopify documentation ---DOC_SECRET = "hush"EXAMPLES = { "logged-in customer": "extra=1&extra=2&shop=shop-name.myshopify.com&logged_in_customer_id=1&path_prefix=%2Fapps%2Fawesome_reviews×tamp=1317327555&signature=4c68c8624d737112c91818c11017d24d334b524cb5c2b8ba08daa056f7395ddb", "no session": "extra=1&extra=2&shop=shop-name.myshopify.com&logged_in_customer_id=&path_prefix=%2Fapps%2Fawesome_reviews×tamp=1317327555&signature=e072b6d7e6622d85912a5214b860d3100dc1e73d9bc29f43796ac8c9ff8093cb",}
def proxy_valid(query: str, secret: str) -> bool: params = parse_qs(query, keep_blank_values=True) sig = params.pop("signature")[0] message = "".join(sorted(f"{k}={','.join(v)}" for k, v in params.items())) computed = hmac.new(secret.encode(), message.encode(), hashlib.sha256).hexdigest() return hmac.compare_digest(sig, computed)
for name, q in EXAMPLES.items(): print(f"proxy, {name:20}:", proxy_valid(q, DOC_SECRET))tampered = EXAMPLES["logged-in customer"].replace("logged_in_customer_id=1", "logged_in_customer_id=2")print(f"proxy, {'another customer':20}:", proxy_valid(tampered, DOC_SECRET))
# --- 2. Webhook: base64 HMAC-SHA256 over the raw body ---APP_SECRET = "lab_client_secret"body = b'{"id":820982911946154508,"total_price":"49.99","email":"ana@example.test"}'header = base64.b64encode(hmac.new(APP_SECRET.encode(), body, hashlib.sha256).digest()).decode()
def webhook_valid(received_body: bytes, hmac_header: str) -> bool: computed = base64.b64encode(hmac.new(APP_SECRET.encode(), received_body, hashlib.sha256).digest()).decode() return hmac.compare_digest(computed, hmac_header)
print("webhook, raw body :", webhook_valid(body, header))print("webhook, price changed :", webhook_valid(body.replace(b"49.99", b"0.01"), header))print("webhook, re-serialized JSON :", webhook_valid(json.dumps(json.loads(body)).encode(), header))Real output:
proxy, logged-in customer : Trueproxy, no session : Trueproxy, another customer : Falsewebhook, raw body : Truewebhook, price changed : Falsewebhook, re-serialized JSON : FalseTwo takeaways for the audit:
- The vectors’
timestampis from 2011 and the signature is still valid. The signature doesn’t expire on its own: if the app doesn’t check thattimestampis recent, a captured signed URL can be reused. - The signature proves the request went through Shopify, not that the requested data belongs to that customer. The app must check that what it returns belongs to
logged_in_customer_id; if it takes the identifier from another parameter, there’s an IDOR even with a valid signature.
Real cases
Section titled “Real cases”- Support employees (2020). Shopify reported that two members of its support team obtained customer transaction records from fewer than 200 merchants. The company clarified it wasn’t due to a technical vulnerability and referred it to law enforcement. It’s a reminder that privileged third-party access, including the provider’s own, is part of the threat model.
- Malicious code via a collaborator. On the Shopify Community forum, an agency explains that Shopify notified it of malicious code inserted into
layout/theme.liquidand two stylesheets of a client’s store, linked to its collaborator account. The agency didn’t know whether the account had been compromised. - Scripts from uninstalled apps. Community threads about stores that redirect to external sites or load unknown scripts tend to end in the same place: a snippet left by an old app, or a ScriptTag that isn’t in the theme.
Checklist
Section titled “Checklist”- Staff and collaborators reviewed; unused access removed
- Two-step authentication required for all staff (and at organization level on Plus)
- Minimal roles; Edit code and app management only for those who need it
- Apps with scopes matching their function; unused apps uninstalled and their code removed from the theme
- Storefront ScriptTags and script domains inventoried
- Custom app
shpat_tokens stored as secrets and rotated - Webhooks verified with the raw body and deduplicated by
X-Shopify-Webhook-Id - App proxy: signature,
timestampfreshness, and data ownership againstlogged_in_customer_id - Theme under version control
References
Section titled “References”- Shopify Help Center: Two-step authentication for users
- Shopify Help Center: Managing users and permissions
- Shopify.dev: Verify webhook deliveries
- Shopify.dev: Authenticate app proxies
- Shopify.dev: ScriptTag
- Shopify.dev: Apps in checkout
- Shopify Community: Malicious code injected via collaborator account
- Infosecurity Magazine: Shopify Insiders Attempted to Steal Customer Transactional Records (2020)