Web Cache Deception: How A GraphQL Query in the Archives Led Me to Cached Profile Data
A GraphQL endpoint accepted GET requests with the query in the URL, and appending a .pdf suffix to the operation path made the user-specific JSON profile response eligible for shared caching. The researcher could retrieve their own cached profile without a session cookie, but could not show a realistic way for an attacker to make a victim's response get cached.
Bug Bounty
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
This is an account of a web cache deception investigation against a GraphQL API. The target, routes, operation names and identifying details in the write-up have been replaced with illustrative examples, so the host example.com and the operation names below are placeholders rather than the real ones.
The feature at the centre of it is a GraphQL endpoint that the frontend normally drives with POST requests. The application also exposes a route that accepts a GraphQL query and its variables in the query string, and that route turned out to be reachable with GET. The question the researcher pursued was whether an authenticated GraphQL operation served over GET could be pulled into a shared cache and then read back without a session.
Setup
- A test account was registered and signed in, so that authenticated GraphQL operations could be exercised.
- The account's own profile was the object under test: a GraphQL operation returning profile information for a given user identifier.
- The researcher had access to web archives, which is where the unusual request was first spotted.
- No specific tools or versions are named in the report.
Finding it
Recon showed that every GraphQL request observed in normal traffic used POST. In the web archives, however, there was a URL carrying a GraphQL query in its query string. That archived request was the starting point for the investigation.
Exploitation
Step 1: replay the archived GET request
The archived URL looked roughly like this:
GET /api/query/publicContent?query=...&variables=...Host: example.com
Replaying it, the server accepted the request. The response contained public information, so nothing sensitive was exposed at this stage. What it did show was that although the frontend sent GraphQL requests through POST, the server also accepted queries through GET. The natural next question was whether that behaviour extended to authenticated operations.
Step 2: identify an authenticated operation
After registering and signing into the test account, the researcher found a GraphQL operation that returned the account's own profile information. A simplified version of the request looked like this:
POST /api/query/accountProfile HTTP/1.1Host: example.comContent-Type: application/jsonCookie: [redacted]
{ "query": "query AccountProfile($userId: String!) { accountProfile(userId: $userId) { fullName email phoneNumber } }", "variables": { "userId": "TEST_ACCOUNT_ID" }}
The operation takes a userId variable and returns fullName, email and phoneNumber in the simplified form shown. The actual response included additional personal information, including address and date-of-birth fields.
Access control appeared to work during testing: changing the identifier did not simply let the researcher retrieve another account's profile.
Step 3: move the query into the URL and switch to GET
The GraphQL query and variables were moved into the URL and POST was changed to GET. The server still returned the authenticated profile. On its own that was not a vulnerability; the open question was whether the response could enter a shared cache.
Step 4: append a file extension
A .pdf suffix was appended to the operation path:
https://example.com/api/query/accountProfile.pdf?query=...&variables=...
The endpoint continued returning profile data. On the first request there was a cache miss; repeating the request produced a cache hit.
Step 5: request the URL without the session cookie
The important check came afterwards: requesting the same URL without the session cookie returned the cached profile response. This suggested a mismatch between how the application handled the modified route and how the caching layer treated it. The application still processed a dynamic GraphQL request, while the response appeared eligible for shared caching. The .pdf suffix had not turned the response into a document; it was still user-specific JSON.
Step 6: the reproduction limitation
The initial report described retrieving the cached response through a private browser window. During triage, that browser reproduction stopped working consistently. Further testing required a crafted command-line request containing an Origin header, and populating the cache with authenticated profile data also required a valid session cookie.
The documented sequence was:
- Send the modified GET request with the test account's authentication cookie and the required header.
- Observe the profile response being cached.
- Request the same URL without the authentication cookie.
- Retrieve the cached profile data.
That distinction mattered. The behaviour had been demonstrated using the researcher's own authenticated session, but no reliable way had been established for an attacker to trigger it through an ordinary link click by another user. The documented victim scenario required someone to execute a crafted command containing their session cookie, which is a substantial practical limitation.
Root cause
The report describes the problem as a mismatch between how the application handled the modified route and how the caching layer treated it: the application still processed a dynamic GraphQL request, while the response appeared eligible for shared caching. The report does not describe the specific cache configuration or headers that produced this behaviour.
Impact
A cached authenticated profile response could be retrieved without a session cookie, exposing the personal information the operation returns, including address and date-of-birth fields in the actual response. In the demonstrated form, however, the researcher only showed this with their own authenticated session. No reliable way was established for an attacker to cause another user's response to be cached through an ordinary link click; the documented victim scenario required the victim to execute a crafted command containing their session cookie.
The report was closed as Informative under a policy excluding issues that required unlikely user interaction.


Fix
The report does not state what was changed. Based on the described behaviour, the caching layer should not treat responses from dynamic GraphQL routes as cacheable static resources, regardless of a file extension appended to the path, and authenticated responses should not be stored in a shared cache.
Variants to test
- GET acceptance on GraphQL endpoints. Send a GraphQL query and variables in the query string with GET where the frontend only uses POST. A positive result is a valid response to the GET request.
- Extension suffix on dynamic routes. Append a static-looking extension such as
.pdf,.cssor.jsto an authenticated operation path. A positive result is the endpoint still returning the same dynamic data. - Cache behaviour on the modified URL. Repeat the request and compare responses for cache miss and cache hit indicators. A positive result is a cache hit on a response containing user-specific data.
- Unauthenticated retrieval. Request the same URL without the session cookie. A positive result is the cached authenticated response being returned.
- Victim-triggering conditions. Establish early whether a victim can be made to populate the cache through an ordinary interaction, and document exactly which headers, cookies and browser behaviours are required. A positive result is a realistic path that does not depend on the victim running a crafted command with their session cookie.
What happened, in plain words
A security researcher was looking at a website's API, the behind-the-scenes service that a website's pages talk to in order to fetch and save data. While browsing an online archive of old web requests, they spotted something unusual: a request that carried a search-style query in its web address, rather than in the body of the request as the site's own pages normally did.
They replayed that request and the server accepted it. That led them to ask a bigger question: if the server accepts this kind of request through the address bar, could it also hand back private profile information that way, and could a shared cache (a middle layer that stores copies of responses to serve them faster to everyone) end up storing that private data and giving it to anyone who asks?
They found that by adding .pdf to the end of the address, the server still returned the profile data; the first request was a cache miss and repeating it produced a cache hit. Asking for the same address without being logged in returned the stored profile.
However, the browser reproduction stopped working consistently during triage, and further testing required a crafted command-line request containing an Origin header and a valid session cookie. They could not show a realistic way for an attacker to make another person's browser do this just by clicking a link. The report was closed as Informative under a policy excluding issues that required unlikely user interaction.
Below, we walk through the same investigation step by step, explaining every term as it comes up.
The background you need first
Before the steps, a few everyday ideas.
- API: think of a restaurant. The menu and the dining room are the website you see. The kitchen is the server where the real data lives. The API is the waiter: it takes your order from the page and carries it to the kitchen, then brings the food back. Websites rarely talk to their database directly; they ask the API.
- GraphQL: a way of asking an API for exactly the fields you want. Instead of the waiter bringing a fixed set meal, you write a small order slip saying "I would like the name, the email and the phone number of this user". That slip is called a query. The API reads it and returns just those fields.
- POST and GET: two ways a browser can send a request. POST puts the details in the body of the request, like handing a sealed envelope to the waiter. GET puts the details in the web address itself, like shouting your order across the room so anyone nearby can hear it. GET requests are the ones you see in your browser's address bar and the ones that get bookmarked and shared.
- Query string: the part of a web address after the
?sign. Inexample.com/search?q=cats, the query string isq=cats. It is a list of name and value pairs. - Cookie: a small piece of text your browser stores for a website and sends back with every request to that site. A session cookie is a cookie that proves you are logged in. Think of it as a wristband at a festival: show it at the gate and staff know you have already paid. If someone else copies your wristband, they can get in as you.
- Header: extra information attached to a request, separate from the address and the body. Headers say things like what type of data you are sending (
Content-Type) or which site the request came from (Origin). - Cache: a storage layer that keeps copies of responses so the same answer does not have to be computed again. A shared cache is one cache used for many visitors, like a photocopier in a lobby that keeps the last document it copied. If a private document lands in that tray, the next person can pick it up.
- Cache miss and cache hit: a miss means the cache did not have the answer, so the server produced it fresh. A hit means the cache already had a copy and handed it back without asking the server.
- Web cache deception: the vulnerability class in this story. The attacker tricks a cache into storing a private response by making the address look like a public, static file (for example by adding
.pdf), then retrieves that stored copy. The name comes from the cache being deceived about what kind of content it is holding. - Recon: short for reconnaissance, the early phase of looking around a target to see how it behaves, before trying anything clever.
- Web archive: a service that keeps old copies of web pages and requests, like a library of the internet's past. It can show behaviour the live site no longer displays in normal use.
One more note before we start: the researcher replaced the real website, addresses and operation names with made-up examples. So example.com and names like accountProfile are placeholders, not the real target.
Setup
To test logged-in features, the researcher needed an account of their own.
- They registered a test account and signed in. This gave them a valid session cookie, the wristband that proves they are logged in.
- They chose their own profile as the thing to test: a GraphQL operation that returns profile information for a given user identifier.
- They had access to web archives, which is where the unusual request first appeared.
The report does not name any specific tools or versions.
Finding it
While looking at the site's normal traffic, every GraphQL request the researcher saw used POST. That makes sense: POST keeps the query out of the address bar, which is tidier and less likely to be logged or shared by accident.
But in the web archives there was a URL that carried a GraphQL query in its query string. That is the equivalent of finding an old receipt showing the kitchen once accepted orders shouted through the window, even though today it only takes sealed envelopes. That archived request became the starting point.
Step 1: replay the archived GET request
The archived URL looked roughly like this:
GET /api/query/publicContent?query=...&variables=...Host: example.com
Line by line:
GETis the method: the request is asking to fetch something, with details in the address./api/query/publicContentis the path, the part of the address that points at a particular feature on the server. Here it is a route that serves public content.?query=...&variables=...is the query string.queryholds the GraphQL order slip, andvariablesholds the values that fill in the blanks in that slip. The...stands for content the researcher has shortened.Host: example.comis a header saying which website the request is for. On a real request this would be on its own line; here it is shown run together with the address.
The researcher replayed it, and the server accepted it. The response contained public information, so nothing sensitive was exposed at this stage. But it revealed something useful: although the frontend sent GraphQL requests through POST, the server also accepted queries through GET.
Why does that matter? Because GET requests put everything in the address. Addresses end up in browser history, in server logs, in bookmarks, and in caches. If a private query can travel that way, it may be stored in places a private query should never be. The natural next question was whether that behaviour extended to authenticated operations, the ones that need a login.
Step 2: identify an authenticated operation
After registering and signing into the test account, the researcher found a GraphQL operation that returned the account's own profile information. A simplified version of the request looked like this:
POST /api/query/accountProfile HTTP/1.1Host: example.comContent-Type: application/jsonCookie: [redacted]
Line by line:
POST /api/query/accountProfile HTTP/1.1is the request line.POSTmeans the details are in the body, not the address./api/query/accountProfileis the path to the profile feature.HTTP/1.1is the version of the web protocol being used.Host: example.comsays which site the request is for.Content-Type: application/jsontells the server the body is formatted as JSON, a common text format for structured data.Cookie: [redacted] carries the session cookie.REDACTED` stands in for the real value, which is a secret: anyone holding it is effectively logged in as that user.
The body of the request was:
{ "query": "query AccountProfile($userId: String!) { accountProfile(userId: $userId) { fullName email phoneNumber } }", "variables": { "userId": "TEST_ACCOUNT_ID" }}
Line by line:
- The outer
{ ... }is a JSON object, a set of named values. "query"holds the GraphQL order slip. Inside it,query AccountProfile($userId: String!)names the operation and declares that it needs a value calleduserId, which must be text (a string) and must be supplied (the!means required).accountProfile(userId: $userId) { fullName email phoneNumber }asks for the profile of that user and lists the fields wanted: full name, email and phone number."variables"supplies the actual value foruserId.TEST_ACCOUNT_IDis a placeholder for the researcher's own account identifier.
The actual response included additional personal information, including address and date-of-birth fields. So this operation returns quite a lot of private data.
Access control appeared to work during testing: changing the identifier did not simply let the researcher retrieve another account's profile. In plain terms, the server checked that the person asking was allowed to see the profile being asked for. That is good behaviour, and it is why the next steps focus on the cache rather than on simply swapping in someone else's ID.
Step 3: move the query into the URL and switch to GET
The researcher moved the GraphQL query and variables into the URL and changed POST to GET. The server still returned the authenticated profile.
Why try this? Because Step 1 showed the server accepts GET for GraphQL. If the same is true for a private operation, the private response now travels in a form that caches and logs are much more likely to handle. On its own, though, this was not a vulnerability: the researcher was still logged in and still receiving their own data. The open question was whether the response could enter a shared cache, the lobby photocopier that serves everyone.
Step 4: append a file extension
A .pdf suffix was appended to the operation path:
https://example.com/api/query/accountProfile.pdf?query=...&variables=...
Line by line:
https://example.comis the site, using HTTPS, the encrypted version of the web protocol./api/query/accountProfile.pdfis the same profile path as before, with.pdfstuck on the end. To a human this looks like a document. To the application, the path still routes to the profile feature.?query=...&variables=...is the same GraphQL query and variables as before, now in the address.
The endpoint continued returning profile data. On the first request there was a cache miss; repeating the request produced a cache hit.
Why does the extension matter? Caches are built to store things that look static and public, such as images, stylesheets and PDFs, because those are the same for everyone and rarely change. A path ending in .pdf looks exactly like that kind of file. The cache therefore treats the response as safe to keep and share. But the application ignores the extension and still runs the private GraphQL query. The two layers disagree about what the address means, and that disagreement is the heart of web cache deception.
Step 5: request the URL without the session cookie
The important check came afterwards: requesting the same URL without the session cookie returned the cached profile response.
This is the moment the problem becomes real. Without the wristband, the researcher was still handed the private profile, because the cache had kept a copy and did not know or care who was asking. This suggested a mismatch between how the application handled the modified route and how the caching layer treated it. The application still processed a dynamic GraphQL request, while the response appeared eligible for shared caching. The .pdf suffix had not turned the response into a document; it was still user-specific JSON.
In everyday terms: the lobby photocopier had copied a private letter because the envelope said "leaflet", and now anyone walking past could pick up a copy.
Step 6: the reproduction limitation
The initial report described retrieving the cached response through a private browser window. A private window is a browser mode that starts without your usual cookies, so it is a simple way to pretend to be a stranger. During triage, the process of the site's team reviewing the report, that browser reproduction stopped working consistently.
Further testing required a crafted command-line request containing an Origin header, and populating the cache with authenticated profile data also required a valid session cookie. The Origin header tells the server which site a request came from; browsers set it automatically, and a command-line tool lets you set it by hand.
The documented sequence was:
- Send the modified GET request with the test account's authentication cookie and the required header.
- Observe the profile response being cached.
- Request the same URL without the authentication cookie.
- Retrieve the cached profile data.
That distinction mattered. The behaviour had been demonstrated using the researcher's own authenticated session, but no reliable way had been established for an attacker to trigger it through an ordinary link click by another user. The documented victim scenario required someone to execute a crafted command containing their session cookie, which is a substantial practical limitation.
Put simply: the researcher had proved the photocopier would copy a private letter if you fed it one yourself. They had not proved that a stranger could trick you into feeding it your letter just by getting you to click a link.
Root cause
The report describes the problem as a mismatch between how the application handled the modified route and how the caching layer treated it: the application still processed a dynamic GraphQL request, while the response appeared eligible for shared caching. The report does not describe the specific cache configuration or headers that produced this behaviour.
Impact
A cached authenticated profile response could be retrieved without a session cookie, exposing the personal information the operation returns, including address and date-of-birth fields in the actual response. In the demonstrated form, however, the researcher only showed this with their own authenticated session. No reliable way was established for an attacker to cause another user's response to be cached through an ordinary link click; the documented victim scenario required the victim to execute a crafted command containing their session cookie.


Fix
Based on the described behaviour, the caching layer should not treat responses from dynamic GraphQL routes as cacheable static resources, regardless of a file extension appended to the path, and authenticated responses should not be stored in a shared cache.
Variants to test
If you want to look for similar behaviour on a site you are allowed to test, these are the checks that follow from the investigation. Each one is a small experiment with a clear pass or fail.
- GET acceptance on GraphQL endpoints. Send a GraphQL query and variables in the query string with GET where the frontend only uses POST. A positive result is a valid response to the GET request. In plain words: does the kitchen still take orders shouted through the window?
- Extension suffix on dynamic routes. Append a static-looking extension such as
.pdf,.cssor.jsto an authenticated operation path. A positive result is the endpoint still returning the same dynamic data. In plain words: does adding a fake file ending change how the server behaves? - Cache behaviour on the modified URL. Repeat the request and compare responses for cache miss and cache hit indicators. A positive result is a cache hit on a response containing user-specific data. In plain words: did the photocopier keep a copy of something private?
- Unauthenticated retrieval. Request the same URL without the session cookie. A positive result is the cached authenticated response being returned. In plain words: can a stranger pick up the copy?
- Victim-triggering conditions. Establish early whether a victim can be made to populate the cache through an ordinary interaction, and document exactly which headers, cookies and browser behaviours are required. A positive result is a realistic path that does not depend on the victim running a crafted command with their session cookie. In plain words: can you get a real person to feed the photocopier without them doing anything unusual?
What the researcher took away
The strongest lead came from comparing archived behaviour with the application's current traffic. The frontend used POST. An archived URL showed that GET was also accepted. Testing that behaviour against an authenticated operation then exposed an unexpected interaction with the cache.
For future investigations, the researcher would establish the victim-triggering conditions earlier and document exactly which headers, cookies and browser behaviours are necessary. They would also keep the demonstrated impact focused on the profile data actually reproduced, rather than extending the claim to other sensitive operations without equivalent evidence.
A cache hit is a clue. Retrieving another session's response is stronger evidence. A realistic way to cause that response to be cached is what completes the attack story.
Glossary
- API: the behind-the-scenes service a website uses to fetch and save data, like a waiter carrying orders between the page and the server.
- Access control: the server's check that the person making a request is allowed to see or change the thing they are asking for.
- Authenticated: proven to be logged in, usually by presenting a valid session cookie.
- Cache: a storage layer that keeps copies of responses so they can be served again quickly.
- Cache hit: a request answered from a stored copy without asking the server to produce it again.
- Cache miss: a request the cache could not answer, so the server produced a fresh response.
- Cookie: a small piece of text a browser stores for a site and sends back with each request to it.
- Content-Type: a header saying what format the body of a request or response is in, such as JSON.
- GET: a request method that puts details in the web address, used for fetching things.
- GraphQL: a way of asking an API for exactly the fields you want, using a query written as an order slip.
- Header: extra information attached to a request or response, separate from the address and body.
- Host: a header naming which website a request is for.
- HTTPS: the encrypted version of the web protocol, so traffic cannot be read in transit.
- Informative: a report outcome meaning the issue was noted but not accepted as a valid, payable finding.
- JSON: a common text format for structured data, built from names and values in curly braces.
- Origin: a header telling the server which site a request came from.
- POST: a request method that puts details in the body of the request rather than the address.
- Query string: the part of a web address after the
?, made of name and value pairs. - Recon: short for reconnaissance, the early phase of looking around a target to see how it behaves.
- Session cookie: a cookie that proves you are logged in, like a festival wristband.
- Shared cache: a cache used for many visitors at once, so a stored response can be handed to anyone.
- Static resource: content that is the same for everyone and rarely changes, such as an image or a PDF, and is therefore safe to cache.
- Triage: the process by which a site's team reviews and assesses a submitted report.
- Variable: a named value supplied separately from a GraphQL query, filling in the blanks in the order slip.
- Web archive: a service that keeps old copies of web pages and requests.
- Web cache deception: a vulnerability where a cache is tricked into storing a private response by making the address look like a public static file, then handing that copy to anyone who asks.