Bypass GraphQL rate limit by abusing negative cost queries
The GraphQL API's rate limit uses a cost bucket that can be manipulated by negative pagination arguments, allowing an attacker to replenish the bucket and bypass rate limiting. This enables indefinite querying without hitting the intended limit.
- Triaged in 2 hours
- Fixed in 7 days
- Disclosed after 7 days
Hi security team,
While looking into the graphql app I noticed an interesting implementation where each app has a bucket of query cost they are allowed to used in a given time with a certain refresh rate associated with it.
The details can be found at https://help.shopify.com/en/api/graphql-admin-api/call-limit
Now Using the app I noticed by calling something like first(-100) will give you a negative cost

This doesn't give you more than the maximum amount however you can deplete your resources down to 50 and then use a negative query to fill it back up to a maximum of 1000 to keep querying indefinitely.
In order to reproduce I used a high cost query like:
{
appInstallations(first: 10) {
edges {
node {
id
uninstallUrl
accessScopes {
description
handle
}
accessScopes {
description
handle
}
accessScopes {
description
handle
}
accessScopes {
description
handle
}
launchUrl
app {
pricingDetailsSummary
apiKey
banner {
altText
metafields(first: 2) {
edges {
node {
description
value
namespace
id
}
}
}
}
handle
features
pricingDetails
published
feedback {
messages {
message
}
link {
url
}
}
}
}
}
}
}
And hit sent 10-15 times at https://emitrani.myshopify.com/admin/apps/shopify-graphiql-app
After that change one of the first parameters into (first: -1000) and try a regular query again and you will see it succeeds as the pool will be back up to full.
Impact
It is possible to leverage the logic error to bypass GraphQL rate limiting.
Best, Eray
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 rate-limiting logic does not validate that the cost of a query is positive, so negative costs are subtracted from the used quota, effectively increasing the remaining allowance.
Impact
An attacker could bypass GraphQL rate limiting and keep querying indefinitely.
What the attacker needed
Access to a Shopify store admin; GraphiQL app installed
How it was found
- Send a high-cost query multiple times to deplete the rate limit bucket.
- Change a pagination argument to a negative value (e.g., first: -1000) and send the query.
- Observe that the bucket is replenished and subsequent queries succeed.
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.
GraphQL APIs often limit how many queries you can make by tracking a 'cost' that decreases with each query. The report found that by asking for a negative number of items, the cost becomes negative, which actually adds to your available queries instead of subtracting. This lets someone keep making requests without ever running out.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.