# Undocumented `fileCopy` GraphQL API

A no-permission staff account used an undocumented fileCopy GraphQL mutation to copy file assets from an attacker-controlled store into a store they lacked upload rights on.

- Payout: $2,000
- Severity: medium
- Program: Shopify
- Found by: ash_nz
- Disclosed: 2020-10-22
- Write-up quality: 6/10
- Original: https://hackerone.com/reports/981472
- Library page: https://bugbountylibrary.com/r/h1%3A981472
- Tags: area:web domain:api domain:web impact:integrity kind:bounty platform:hackerone sev:medium tech:graphql technique:legacy-endpoint technique:recon vuln:access-control

**Target:** Shopify Admin internal GraphQL endpoint /admin/internal/web/graphql/core, fileCopy mutation
**Root cause:** The undocumented fileCopy mutation accepted an absoluteKey/path referencing a file from another store without verifying the caller had file-upload permission on the destination store, bypassing staff permission restrictions.
**Steps:**
1. Create attacker-owned storeB.myshopify.com and upload a file; note its absoluteKey, key, and CDN path.
2. Log into victim storeA.myshopify.com as a staff account with no file permissions.
3. Send `POST /admin/internal/web/graphql/core` with mutation `fileCopy(key:$key,path:$path,absoluteKey:$absoluteKey)` and variables `{"absoluteKey":"s/files/1/.../files/1.jpg","key":"files/1.jpg","path":"https://cdn.shopify.com/s/files/1/.../1.jpg?6"}`.
4. Observe the file is copied into storeA despite lacking upload permission.
**How found:** Attacker wanted to upload a file to a store where staff permissions blocked it; rather than attacking permissions directly, they set up their own store to host a file, then hunted for an undocumented API (fileCopy) that could move files across stores.
**Exploitation:** Attacker with a zero-permission staff account on the target store creates a second store they control, uploads a file there, then invokes the undocumented fileCopy mutation on the target store's admin GraphQL endpoint using the source file's absoluteKey/key/path, causing the file to be copied into the target store without authorization.
**Insight:** When permission checks block a write, look for undocumented internal GraphQL mutations (e.g. copy/clone/import operations) that take a source reference from another tenant and may only validate the source, not the caller's write permission on the destination.

## Proof of concept (copied exactly from the original report)

**GraphQL fileCopy mutation copying cross-store file**

```
{"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"
}
}
```

