The Cache That Trusted Too Much
An API gateway cached its authorisation decision keyed only on the caller's token, not on the resource being requested. After one legitimate call on a token, the same token could read another tenant's private account data.
Published on lolidkmyname.medium.com
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
The target was a multi-tenant SaaS product, and an API Gateway sat in front of the application. In front of the application sits a small authorizer that decides, for each incoming request, whether the caller is allowed to proceed. To save time, the gateway caches that decision rather than re-running the authorizer on every call.
The endpoint at the centre of the report is /accounts, which takes an account_id parameter. The authorizer's job is to answer one question: is this caller allowed to see this resource? The application logic behind it was, in the researcher's assessment, correct. What was wrong was the caching of the authorizer's answer.
Setup
The researcher used two accounts, both their own:
- A: the attacker account.
- B: the victim tenant.
There was no shared access between the two accounts. Any authenticated user, including a free signup, could carry out the attack. No elevated role and no interaction from the victim were needed.
Finding it
The starting observation is the one every tester makes first: a cold request for another tenant's account is refused.
1. Cold, A GET /accounts?account_id=<B> → 403 ✓ correct

On its own, that 403 looks like a clean result. The researcher's insight was that the authorizer's cache key was built from (who you are) alone, and omitted (what you asked for). The safe key is the pair of identity and resource id; this gateway keyed on identity only. The first decision made for a token was therefore replayed for every subsequent request made with that token, regardless of which account was requested.
Exploitation
Step 1: arm the token with a legitimate call
Using a fresh token, the researcher first asked for the attacker's own account:
2. Fresh token, ask for A's OWN account first: GET /accounts?account_id=<A> → 200 (legitimately allowed — this "arms" the token)

This request is entirely legitimate and returns 200. Its side effect is the vulnerability: the gateway caches the authorizer's ALLOW decision against the token, without recording that the decision applied to account A.
Step 2: read the foreign account with the same token
With the same token, the researcher then requested the victim tenant's account:
3. Same token, now ask for B: GET /accounts?account_id=<B> → 200 ← B's private data leaks

The cached ALLOW is served for account B, and B's private data is returned.
Step 3: the mirror test
To show the result comes from the cache and not from luck, the researcher reversed the order with a fresh token. Asking for the forbidden resource first produces the expected refusal:
4. Fresh token, ask for B FIRST: GET /accounts?account_id=<B> → 403 (cached DENY on the token)
Step 4: the same token is then refused its own data
5. Same token, ask for its OWN account: GET /accounts?account_id=<A> → 403 ← refused its OWN data
A token refused its own account, purely because it had asked for a forbidden one first. Same identity, same permissions; the only difference between the two sequences is which resource each token asked for first. That is the proof that the decision is cached on the token and ignores the resource id.
Root cause
The authorizer's cache key was (who you are) rather than (who you are + what you asked for). The first decision on a token, whether ALLOW or DENY, was replayed for everything that followed on that token.
The authorization logic itself was correct: a cold request for a foreign resource was refused. The mistake was in caching the decision without the resource id, so the gateway's cache became the effective authorization check. The fix recommends authorizing the resource in the app handler independently, so the gateway is never the only check.
Impact
Any authenticated user, including a free signup, could read other tenants' account records. The exposed fields named in the report are:
- business name;
- credit and plan data, described as commercial intelligence on another customer;
- parent company.
No elevated role was required and there was no victim interaction: one arming call and one foreign read. The resource id was a small integer, so the reachable population was large. The researcher notes that only two self-owned accounts were ever queried and the id space was never walked.
Fix
The recommendation is twofold:
- Put the resource id into the authorizer's cache key, or disable caching on parameter-dependent routes.
- Authorize the resource in the app handler independently, so the gateway is never the only check.
The report does not say which of these was implemented.
Variants to test
- Order-dependent authorization on any parameterised endpoint. Send a cold request for a foreign resource and confirm the refusal, then repeat with a fresh token: call your own resource first, then the foreign one. A positive result is a
200with foreign data after the arming call, where the cold request returned403. - The mirror test. With a fresh token, request the forbidden resource first and then your own. A positive result is a
403on your own resource, which shows the decision is cached per token rather than per resource. - Other cache keys that omit a dimension. Look for authorizers or gateways that key on identity alone, or on identity plus path but not query parameters. A positive result is a decision that stays fixed while the resource identifier in the query string changes.
- Cached DENY as well as cached ALLOW. The report shows an ALLOW replayed onto a foreign resource and a cached DENY on a token that first asked for a forbidden resource. Test both, since a cached DENY can also mask or reveal behaviour.
- Small integer identifiers. Where resource ids are sequential or small, the reachable population is large; Where resource ids are sequential or small, the reachable population is large; the report notes the id space was never walked.
Lesson
A cold 403 is not a clean bill of health. Re-test the same endpoint after a legitimate call on the same token. Order-dependent authorization is invisible to single-shot testing, and caching layers are part of the attack surface.
What happened, in plain words
A company ran a multi-tenant SaaS product. "Multi-tenant" means one service is shared by many separate customers, and each customer's data is supposed to be walled off from the others. An API Gateway sat in front of the real application and handled incoming requests. In front of the application, the gateway runs a small authorizer: a component whose only job is to answer one question for each incoming request, "is this caller allowed to do this?"
To save time, the gateway does not re-run the authorizer on every single call. It remembers the answer and reuses it, which is called caching. Caching is like a receptionist who checks your badge once at the door and then waves you through the rest of the building without looking again. That is fine as long as the receptionist remembers exactly what the badge was checked for. Here, the gateway remembered only who you were, not what you had asked for.
The endpoint at the centre of the report is /accounts. An endpoint is a specific address on a server that accepts requests, a bit like a particular counter in a bank. This one takes an account_id parameter. A parameter is a piece of information attached to a request, here the id of the account you want. The application logic behind the authorizer was, in the researcher's assessment, correct. What was wrong was the caching of the authorizer's answer.
The idea, simply
Before your request reaches the app, the authorizer decides "is this caller allowed?" To save time, the gateway caches that answer. The safe cache key is (who you are + what you asked for). This gateway keyed on (who you are) alone, so it forgot the resource id. The first decision on your token got replayed for everything after it, no matter which account you asked for.
A cache key is the label under which a remembered answer is stored. If you file a note under "Alice" only, then later ask "what did we decide for Alice about account B?", the file cannot tell you, because it never recorded the account. The safe label is the pair: the identity plus the resource. This gateway used the identity alone.
Setup
The researcher used two accounts, both their own:
- A: the attacker account.
- B: the victim tenant.
There was no shared access between the two accounts. Any authenticated user, including a free signup, could carry out the attack. No elevated role and no interaction from the victim were needed.
A token is a short string that a server hands you after you log in, and that you send back with every later request so the server knows who you are. Think of it as a cloakroom ticket: it proves you own the coat without the attendant needing to know your name. "Authenticated" simply means the server has already checked that the token belongs to a real, logged-in user. "Elevated role" means special administrator rights; the researcher did not need any.
Finding it
The starting observation is the one every tester makes first: a cold request for another tenant's account is refused.
1. Cold, A GET /accounts?account_id=<B> → 403 ✓ correct

Line by line:
GETis the type of request, the one a browser makes when it simply wants to read something./accountsis the endpoint being called.?account_id=<B>is the parameter, here asking for the account whose id is B, the other tenant.→ 403is the server's answer. A status code is a three-digit number summarising the result.403means "forbidden": the server understood the request and refused it.Coldmeans this was the first request made with that token, so nothing had been cached yet.
On its own, that 403 looks like a clean result. The researcher's insight was that the authorizer's cache key was built from (who you are) alone, and omitted (what you asked for). The safe key is the pair of identity and resource id; this gateway keyed on identity only. The first decision made for a token was therefore replayed for every subsequent request made with that token, regardless of which account was requested.
Exploitation
Step 1: arm the token with a legitimate call
Using a fresh token, the researcher first asked for the attacker's own account:
2. Fresh token, ask for A's OWN account first: GET /accounts?account_id=<A> → 200 (legitimately allowed — this "arms" the token)

Line by line:
Fresh tokenmeans a newly obtained token, so the cache holds no earlier decision for it.GET /accounts?account_id=<A>asks for the attacker's own account, which they are genuinely entitled to see.→ 200means "OK": the request succeeded and the data came back.arms the tokenis the researcher's phrase for the side effect: this allowed request is what plants the remembered answer in the cache.
This request is entirely legitimate and returns 200. Its side effect is the vulnerability: the gateway caches the authorizer's ALLOW decision against the token, without recording that the decision applied to account A. ALLOW and DENY are the two possible answers from the authorizer: yes, you may proceed, or no, you may not.
Step 2: read the foreign account with the same token
With the same token, the researcher then requested the victim tenant's account:
3. Same token, now ask for B: GET /accounts?account_id=<B> → 200 ← B's private data leaks

Line by line:
Same tokenmeans no new login and no new token: the cache still holds the ALLOW from step 2.account_id=<B>now asks for the other tenant's account, the one that was refused in step 1.→ 200means the request succeeded this time.B's private data leaksmeans the response contained the other tenant's account record, which the caller was never entitled to see.
The cached ALLOW is served for account B, and B's private data is returned.
Step 3: the mirror test
To show the result comes from the cache and not from luck, the researcher reversed the order with a fresh token. Asking for the forbidden resource first produces the expected refusal:
4. Fresh token, ask for B FIRST: GET /accounts?account_id=<B> → 403 (cached DENY on the token)
Line by line:
Fresh tokenagain means a clean slate, with nothing remembered for this token.account_id=<B>asks for the forbidden account first, before any allowed call.→ 403is the correct refusal, exactly as in step 1.cached DENYmeans the gateway now remembers "no" for this token, and will reuse that "no" for whatever comes next.
Step 4: the same token is then refused its own data
5. Same token, ask for its OWN account: GET /accounts?account_id=<A> → 403 ← refused its OWN data
Line by line:
Same tokenmeans the token that was just refused for B.account_id=<A>asks for the caller's own account, which they are entitled to see.→ 403means the server refuses it anyway.refused its OWN datais the striking part: the caller is denied something that is theirs.
A token refused its own account, purely because it had asked for a forbidden one first. Same identity, same permissions; the only difference between the two sequences is which resource each token asked for first. That is the proof that the decision is cached on the token and ignores the resource id.
Root cause
The authorizer's cache key was (who you are) rather than (who you are + what you asked for). The first decision on a token, whether ALLOW or DENY, was replayed for everything that followed on that token.
The authorization logic itself was correct: a cold request for a foreign resource was refused. The mistake was in caching the decision without the resource id, so the gateway's cache became the effective authorization check. The fix recommends authorizing the resource in the app handler independently, so the gateway is never the only check.
Impact
Any authenticated user, including a free signup, could read other tenants' account records. The exposed fields named in the report are:
- business name;
- credit and plan data, described as commercial intelligence on another customer;
- parent company.
No elevated role was required and there was no victim interaction: one arming call and one foreign read. The resource id was a small integer, so the reachable population was large. The researcher notes that only two self-owned accounts were ever queried and the id space was never walked.
"Small integer" means the ids are short numbers like 1, 2, 3 rather than long random strings, so guessing other tenants' ids is easy. "Walking the id space" means systematically trying every number in turn; the researcher deliberately did not do that, and only ever queried the two accounts they owned.
Fix
The recommendation is twofold:
- Put the resource id into the authorizer's cache key, or disable caching on parameter-dependent routes.
- Authorize the resource in the app handler independently, so the gateway is never the only check.
In plain words: either file the remembered answer under both the identity and the resource, or stop remembering answers on routes where the answer depends on a parameter. And add a second check inside the application itself, so that if the front door gets it wrong, the room behind it still asks for your badge. The report does not say which of these was implemented.
Variants to test
- Order-dependent authorization on any parameterised endpoint. Send a cold request for a foreign resource and confirm the refusal, then repeat with a fresh token: call your own resource first, then the foreign one. A positive result is a
200with foreign data after the arming call, where the cold request returned403. - The mirror test. With a fresh token, request the forbidden resource first and then your own. A positive result is a
403on your own resource, which shows the decision is cached per token rather than per resource. - Other cache keys that omit a dimension. Look for authorizers or gateways that key on identity alone, or on identity plus path but not query parameters. A positive result is a decision that stays fixed while the resource identifier in the query string changes.
- Cached DENY as well as cached ALLOW. The report shows an ALLOW replayed onto a foreign resource and a cached DENY on a token that first asked for a forbidden resource. Test both, since a cached DENY can also mask or reveal behaviour.
- Small integer identifiers. Where resource ids are sequential or small, the reachable population is large; Where resource ids are sequential or small, the reachable population is large; the report notes the id space was never walked.
Lesson
A cold 403 is not a clean bill of health. Re-test the same endpoint after a legitimate call on the same token. Order-dependent authorization is invisible to single-shot testing, and caching layers are part of the attack surface.
Glossary
- API: a defined set of addresses and rules that one piece of software uses to talk to another, like a service counter with fixed forms to fill in.
- API Gateway: software that sits in front of an application and handles every incoming request before it reaches the app.
- Authorizer: the component that decides whether a given caller may perform a given request.
- Cache: a store of remembered answers, kept so the same work does not have to be done twice.
- Cache key: the label under which a remembered answer is filed; if the label leaves out a detail, answers get reused for the wrong thing.
- Caching: the act of storing an answer for reuse.
- Cold request: a request made with a token for which nothing has been cached yet.
- Endpoint: a specific address on a server that accepts requests, such as
/accounts. - Parameter: extra information attached to a request, such as
account_id=<B>. - Token: a string issued at login and sent with later requests to prove who you are.
- Authenticated: having already proved to the server that you are a logged-in user.
- Multi-tenant: one shared service used by many separate customers whose data must stay separated.
- Tenant: one customer in a multi-tenant service.
- ALLOW / DENY: the two possible answers from an authorizer, yes you may proceed or no you may not.
- Status code: a three-digit number in a response summarising the result, such as
200for OK or403for forbidden. - 403: the status code meaning forbidden, the server understood and refused.
- 200: the status code meaning OK, the request succeeded.
- Elevated role: special administrator rights beyond those of an ordinary user.
- Order-dependent authorization: a flaw where the answer depends on the order in which requests were made, not just on who is asking and what they ask for.
- Attack surface: everything an attacker can interact with, including caching layers.
- Walking the id space: systematically trying every possible identifier in turn to find valid ones.