IDOR in GraphQL Query Leaking Private Photos of a Million $ App
A GraphQL query that fetched a photo by its identifier did not check that the photo belonged to the requesting user. By swapping in another user's photo identifier, an attacker could retrieve private photos belonging to other users' projects that were still in the processing state.
medium.com
Published on medium.com
Bugbounty
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Context
The target was a "million-dollar app" with a project creation feature. Users build a project over 5 to 6 steps, adding a title, a description, photos and payment details. The API in front of this feature is GraphQL, and the write-up is about an IDOR in one of its queries that exposed other users' photos.
The author opens with a short primer on GraphQL: an open-source data query and manipulation language for APIs, plus a runtime for fulfilling queries against existing data. The security-relevant difference from REST is where the identifier lives. In REST the URI says what is fetched:
/api/v1/admin/payments/123456
/api/v1/user/photos/1234
The first is payments data for 123456, the second is photos data for the user with photoid 1234. In GraphQL, most requests are POSTs with the query in the request body, and sometimes GET requests are made. That makes it harder for someone proxying traffic to see at a glance what each request does: you have to open each request and read the body payload, which carries the different queries.

The author also notes that GraphQL provides no authorisation functionality inbuilt, so developers have to design their own authentication and authorisation. That is inconvenient for developers and, in the author's words, the best case for hackers testing IDOR and access control bugs.
Setup
The author changed IDs from their own account to another account, or to some other account the tester did not control. Burp Suite was used as the proxy, with the InQL and GraphQL Raider extensions to make GraphQL traffic easier to read. The author's personal recommendation for testing GraphQL APIs is the Altair GraphQL Client.
No versions, endpoint hostnames or account details are given.
Finding it
The author walked through every step of the project creation flow, swapping IDs between accounts. For a long stretch nothing worked: the responses were Not Authorized, Cannot control this project, 401 and 403.

After 2 to 3 days of testing, one endpoint behaved differently, and the author describes the result as seriously unexpected.
Exploitation
Step 1: upload a photo and read the photo ID
The first request uploads a photo. Its response contains the photo ID, base64 encoded, as "Photo-3788374".

Step 2: query the photo by ID
The second request queries a photo by PhotoId. It carries a PhotoId, but a changed one: in the normal case it would hold the same PhotoId returned by Request 1.

Step 3: swap the ID
The bug is the swap itself. Changing the PhotoId to another value, encoding it to Base64, and querying with that changed PhotoId returned other users' project photos, in the PROCESSING state.
The author does not publish the raw request or response bodies for either request, so the exact query, the parameter names and the response shape are not shown. What the write-up establishes is the mechanism: a base64-encoded photo identifier taken from the upload response, substituted with a different identifier, and accepted by the query without an ownership check.
Root cause
The query returned another user's photo when the PhotoId was changed, so ownership of the photo was not enforced on this query. The identifier is base64 encoded, which is an encoding, not a protection: anyone who has seen one valid value can decode it, change the numeric part and re-encode it. Because GraphQL has no inbuilt authorisation, developers must add their own checks; here this query returned foreign photos even though the surrounding project steps rejected cross-account IDs with Not Authorized, Cannot control this project, 401 and 403. The report does not describe the server-side code, so the exact location of the missing check is not stated.
Impact
An attacker who can reach the photo query can read other users' project photos by changing the PhotoId, without controlling the project those photos belong to. The photos returned were in the PROCESSING state. The author frames the impact in terms of scale: the organisation is a million-dollar app holding a lot of user data. No bounty amount, severity rating or CVSS score is given.
Fix
The report does not say what was changed. The obvious remedy would be to check that the requesting user owns the project the photo belongs to before returning it.
Variants to test
- Map every GraphQL query and mutation that takes an object ID, then replay each with an ID from a second account. A positive result is data belonging to the other account coming back instead of an authorisation error.
- Decode base64 identifiers and look for a predictable structure such as a prefix plus a sequential number. A positive result is a decoded value you can increment and re-encode into a valid request.
- Test objects in non-final states, such as photos still PROCESSING, since the report's leak involved a photo in that state. A positive result is another user's in-progress object being returned.
- Compare sibling operations in the same flow: if the project steps return Not Authorized or 403 for a foreign ID but one query returns data, that query is the gap. A positive result is an inconsistent response across operations handling the same object.
Timeline
The report was submitted on 7 July 2022 and triaged on HackerOne on 15 July 2022.

What happened, in plain words
A security researcher was testing a website that lets people build "projects". A project is a page you fill in over several steps: a title, a description, some photos and payment details. The website's own software, the part that talks to the browser behind the scenes, is called an API. The researcher found that one of the API's requests, the one that fetches a photo, would hand back photos belonging to other people's projects if you simply changed the photo's ID number in the request. The website never checked whether the person asking actually owned that photo.
This kind of mistake has a name: IDOR, short for Insecure Direct Object Reference. Think of a cloakroom where the attendant gives you ticket number 42 for your coat, and when you come back and say "number 43, please", they hand you a stranger's coat without looking at who you are. The ticket number is a direct reference to an object, and the attendant failed to check that the object is yours. That is exactly what happened here, with photo IDs instead of cloakroom tickets.
The API in question is a GraphQL API, a particular style of API that we will explain below. The researcher reported the bug on 7 July 2022, and the bug bounty platform HackerOne triaged it (confirmed and passed it on to the company) on 15 July 2022.
Some background: what is an API?
When you use a website, your browser shows you pages. But the page itself often does not contain the data you see; the browser asks a separate server for it. That conversation happens through an API, which is simply a defined set of requests a program can send to a server and the answers it gets back. A useful comparison is a restaurant menu: the menu lists what you can order and how to order it, and the kitchen knows what to do with each order. The API is the menu plus the kitchen's rules.
Two common styles of API are REST and GraphQL. The write-up compares them because the difference matters for finding this bug.
REST versus GraphQL
In a REST API, the address (the URI, the part of the link after the domain name) usually tells you what data you are asking for. The researcher gives two examples:
/api/v1/admin/payments/123456
/api/v1/user/photos/1234
Line by line:
/api/v1/admin/payments/123456is a request for payment data with the number 123456. Reading the address alone, you can guess it is about payments and about record 123456./api/v1/user/photos/1234is a request for the photos of the user whose photo ID is 1234. Again, the address tells you the kind of data and the identifier.
So in REST, if you are watching the traffic flow past (for example through a proxy, a tool that sits between your browser and the server and lets you read and edit every message), you can glance at an address and know roughly what it does.
In GraphQL, most requests are sent as POST requests, and the actual question being asked is written inside the body of the request rather than in the address. A POST request is one where the browser sends data to the server, as opposed to a GET request which just asks for something. Sometimes GraphQL also uses GET requests. The consequence, as the researcher puts it, is that it is harder for someone watching the traffic to see at a glance what each request is: you have to open each request and read the whole body, because the body contains the different queries.

The image illustrates this REST versus GraphQL comparison: in REST the address describes the data, while in GraphQL the query in the request body does.
Why GraphQL matters for security
GraphQL provides no authorisation functionality inbuilt. Authorisation means deciding whether the person making a request is allowed to do what they are asking. Because GraphQL does not do this for you, developers have to design their own authentication (proving who you are) and authorisation (deciding what you may do). The researcher notes this is not a good thing for developers, but it is the best case for hackers testing IDOR and access control bugs, because every place where the developer had to remember to add a check is a place where the check might be missing.
The setup: how the testing was done
The researcher changed IDs from their own account to another account, or to some other account the tester did not control. The method was to change IDs from one account to the other, or to some other account the tester did not control. If a request made with account A's login returns account B's data, something is wrong.
To see and edit the requests, the researcher used Burp Suite, a proxy tool, together with two extensions called InQL and GraphQL Raider that make GraphQL traffic easier to read. The researcher's personal recommendation for testing GraphQL APIs is a program called Altair GraphQL Client.
The image appears at the start of the practical part, before the description of the app's flow.
No versions, endpoint hostnames or account details are given in the write-up.
The flow of the app
The user can make a project. There are many details to add: a title name, a description, photos and payment details, spread over 5 to 6 steps. The researcher tested each and every step, changing IDs from one account to another, or to some other account they did not control.
For a long stretch, nothing worked. Every attempt came back with one of these responses: Not Authorized, Cannot control this project, 401 and 403. A 401 and a 403 are standard HTTP status codes, the numbers a web server uses to say how a request went. 401 means "you are not authenticated", that is, the server does not accept that you are logged in as anyone. 403 means "I know who you are, but you are not allowed to do this". The messages Not Authorized and Cannot control this project are the app's own words for the same idea. In other words, the app was correctly refusing to let one account touch another account's project at these steps.

The image shows the inbox and sign-in prompts of the publishing platform, placed where the write-up describes the failed attempts and the 401 and 403 responses.
After 2 to 3 days of testing, one endpoint behaved differently, and the researcher describes the result as seriously unexpected. An endpoint is one specific address on a server that accepts requests, one entry on the menu.
Exploitation, step by step
Step 1: upload a photo and read the photo ID
The first request uploads a photo. Its response contains the photo ID, base64 encoded, as "Photo-3788374".
Base64 is a way of writing data using only letters, digits and a couple of symbols, so it can travel safely through systems that expect text. It is not encryption: anyone can turn it back into the original with a decoder, and many websites and tools do it for you. The important point is that the ID is not hidden, only written in a different alphabet.

The image is captioned "upload endpoint" and shows this first request, the one that uploads a photo and returns the photo ID.
Step 2: query the photo by ID
The second request queries a photo by PhotoId. It carries a PhotoId, but a changed one: in the normal case it would hold the same PhotoId returned by Request 1.

The image is captioned "vulnerable endpoint" and shows this second request, the one that asks for a photo by its ID.
Why this step: this is the request that fetches a photo. If the server trusts whatever ID the browser sends, then sending a different ID should fetch a different photo, and that is what the researcher tested.
Step 3: swap the ID
The bug is the swap itself. Changing the PhotoId to another value, encoding it to Base64, and querying with that changed PhotoId returned other users' project photos, in the PROCESSING state. PROCESSING means the photo was still being handled by the system, not yet finished.
The write-up does not publish the raw request or response bodies for either request, so the exact query, the parameter names and the shape of the response are not shown. What it does establish is the mechanism: a base64-encoded photo identifier taken from the upload response, substituted with a different identifier, and accepted by the query without an ownership check.
Why it worked
The query returned another user's photo when the PhotoId was changed, so ownership of the photo was not enforced on this query. The base64 encoding gives a false sense of protection: it is an encoding, not a lock. Anyone who has seen one valid value can decode it, change the numeric part and re-encode it. Because GraphQL has no inbuilt authorisation, developers must add their own checks; here this query returned foreign photos, even though the surrounding project steps rejected cross-account IDs with Not Authorized, Cannot control this project, 401 and 403. The report does not describe the server-side code, so the exact location of the missing check is not stated.
What the impact was
An attacker who can reach the photo query can read other users' project photos by changing the PhotoId, without controlling the project those photos belong to. The photos returned were in the PROCESSING state. The researcher frames the impact in terms of scale: the organisation is a million-dollar app holding a lot of user data. No bounty amount, severity rating or CVSS score is given. CVSS is a standard scoring system for how serious a vulnerability is; the report does not use it.
How it should be fixed
The report does not say what was changed. The obvious remedy would be to check that the requesting user owns the project the photo belongs to before returning it.
Things to try on other targets
- Map every GraphQL query and mutation that takes an object ID, then replay each one with an ID from a second account. A mutation is a GraphQL request that changes data rather than just reading it. A positive result is data belonging to the other account coming back instead of an authorisation error.
- Decode base64 identifiers and look for a predictable structure such as a prefix plus a sequential number. A positive result is a decoded value you can increment and re-encode into a valid request.
- Test objects in non-final states, such as photos still PROCESSING, since the report's leak involved a photo in that state. A positive result is another user's in-progress object being returned.
- Compare sibling operations in the same flow: if the project steps return Not Authorized or 403 for a foreign ID but one query returns data, that query is the gap. A positive result is an inconsistent response across operations handling the same object.
Timeline
The report was submitted on 7 July 2022 and triaged on HackerOne on 15 July 2022.

The image appears at the end of the write-up, after the researcher describes celebrating the find.
Glossary
- API: the defined set of requests a program can send to a server and the answers it gets back; the menu and kitchen rules of a website.
- Authentication: proving who you are, for example by logging in.
- Authorisation: deciding whether the person making a request is allowed to do what they are asking.
- Base64: a way of writing data using only letters, digits and a couple of symbols so it can travel as text; it is an encoding, not encryption, and anyone can decode it.
- Bug bounty: a programme where companies pay researchers for reporting security problems.
- Burp Suite: a proxy tool that sits between your browser and a server so you can read and edit every request and response.
- CVSS: a standard scoring system for how serious a vulnerability is.
- Endpoint: one specific address on a server that accepts requests.
- GET request: a request that asks the server for something, without sending data to change it.
- GraphQL: an open-source data query and manipulation language for APIs, plus a runtime for fulfilling queries against existing data; most requests are POSTs with the query in the body.
- HackerOne: a bug bounty platform where reports are submitted and triaged.
- HTTP status code: the number a web server returns to say how a request went; 401 means not authenticated, 403 means not allowed.
- IDOR (Insecure Direct Object Reference): a bug where a request refers to an object by an ID and the server does not check that the caller is allowed to access that object.
- InQL: a Burp Suite extension that makes GraphQL traffic easier to read.
- GraphQL Raider: a Burp Suite extension that makes GraphQL traffic easier to read.
- Altair GraphQL Client: a program the researcher recommends for testing GraphQL APIs.
- Mutation: a GraphQL request that changes data rather than only reading it.
- POST request: a request where the browser sends data to the server, often with the details in the body.
- Processing state: a state where a photo is still being handled by the system and is not yet finished.
- Proxy: a tool that sits between your browser and a server and lets you read and edit the traffic.
- Query: a request that asks for data; in GraphQL, the question written in the request body.
- REST: a style of API where the address (URI) usually describes what data is being fetched.
- Triaged: confirmed and passed on to the company by the bug bounty platform.
- URI: the part of a link that identifies a resource, such as
/api/v1/user/photos/1234.