Undocumented `fileCopy` GraphQL API
An undocumented GraphQL mutation called fileCopy let a staff account with no file permissions copy a file from a store they controlled into the store where they were staff. This bypassed the permission restriction that should have stopped them uploading files.
- Disclosed after 39 days
Impact
A malicious staff account with no permissions can copy other store file assets to current store, which they have no access to.
Details
So the story as follow
A malicious staff member (jack_mccracken) on storeA.myshopify.com wants to upload a file on the store but could not, due to permissions restrictions. So jack_mccracken decided to find a way to bypass the restriction so he created a new store called storeB.myshopify.com and uploaded a file on storeB.
jack_mccracken is a skilled attacker he found an undocumented GraphQL API called fileCopy, he used this API to try to copy a file from his store StorB to StoreA (where he is a staff member).
He login into StoreA (as staff member) and send the following request:
POST /admin/internal/web/graphql/core HTTP/1.1
Cookie: [REDACTED]
accept: application/json
X-CSRF-Token: [REDACTED]
Content-Type: application/json
User-Agent: PostmanRuntime/7.26.5
Postman-Token: a02c5039-29f0-4280-9084-cfe12703ff60
Host: storeA.myshopify.com
Accept-Encoding: gzip, deflate
Connection: close
Content-Length: 485
{"query":"\r\nmutation fileCopy ($key:String!,$absoluteKey:String!,$path:String!){fileCopy (key:$key,path:$path,absoluteKey:$absoluteKey) {\r\nfile{\r\n \r\n path\r\n}\r\n userErrors {\r\n field\r\n message\r\n}\r\n }\r\n}","variables":{
"absoluteKey": "s/files/1/d/0864/0471/6006/6199/files/1.jpg",
"key": "files/1.jpg",
"path": "https://cdn.shopify.com/s/files/1/0471/6006/6199/files/1.jpg?6"
}
}
the variables absoluteKey key and pathvalues are the values of the file he uploaded in his store storeB
THE END
Impact
A malicious staff account with no permissions can copy other store file assets to current store, which they have no access to.
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 fileCopy GraphQL mutation did not check the caller's file permissions before copying an asset into the store.
Impact
A staff account with no file permissions could copy file assets into a store, bypassing the intended access restriction.
What the attacker needed
A staff account with no file permissions; a second store the attacker controls
How it was found
- Create a second store and upload a file there.
- Log in to the target store as a staff member without file permissions.
- Send a fileCopy GraphQL mutation using the key, absolute key and path of the file from the second store.
- The file is copied into the target store despite the missing permissions.
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 store has staff accounts with limited permissions, and this one was not allowed to upload files. The attacker made their own separate store, uploaded a file there, then used a hidden feature of the store's programming interface to copy that file into the store where they worked. The hidden feature did not check whether the person was allowed to add files, so the restriction was bypassed.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.