Skip to content
Access control Write-up Intermediate

Privilege Escalation Leads to making authenticated actions (payment processing, creating invoices.. etc)

A newly registered user awaiting account approval could still obtain API keys from an endpoint, and those keys allowed full authenticated actions such as payment processing and invoice creation. The approval gate was not enforced on the API key endpoint.

X-Vector Follow

Published on x-vector.medium.com

Security

X-Vector, on x-vector.medium.com

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.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 4 min read.

Context

The target is a commerce platform reachable at target.com, with a sandbox environment at target.com/commerce. The researcher notes that the program was public and that the vulnerability was still unfixed at the time of writing, so the real domain is replaced with target.com. The program owners stated that the sandbox had the same functionality needed for testing.

The feature at the centre of the report is account approval. A newly registered user is placed in an acceptance period of 2 to 3 days, during which the account is neither approved nor rejected. In that state the user should not be able to perform authenticated actions such as payment processing or creating invoices. The report shows that this restriction does not apply to API keys obtained from the API key endpoint, which lets an unapproved user perform those actions through the API.

Setup

  • A public bug bounty program with a sandbox at target.com/commerce.
  • A newly registered account on the commerce platform, awaiting approval or rejection.
  • Burp Suite, used to inspect the requests the dashboard makes.
  • The platform's own API documentation, used to work out which operations the API keys allow.

No specific versions, roles beyond the unapproved user, or additional tooling are described.

Finding it

When the user registers a new account on target.com/commerce, they wait a few days for approval or rejection. On login, the user is redirected through this chain:

Text
target.com/commerce/login/auth -> target.com/commerce/login/dashboard -> target.com/commerce/login/denied

The researcher tried logging in again and stopped at target.com/commerce/login/dashboard. At that point the user could access the dashboard and was authorised to view their account, customer, payment and Settings pages, but could not perform any action: the pages were view-only.

Inspecting the requests in Burp revealed an API key endpoint tied to the user's account:

HTTP
commerce/apiKeys?appkey=false&source=Ecomerce

The endpoint is related to the user's account. The researcher notes that the user cannot access the API without logging in, since the account was neither approved nor rejected. The problem is that the API keys are still issued to an account in that pending state.

Exploitation

Step 1: Register and observe the pending state

Register a new account on target.com/commerce. The account enters the acceptance period of 2 to 3 days. Logging in redirects through target.com/commerce/login/auth, target.com/commerce/login/dashboard and finally target.com/commerce/login/denied.

Step 2: Stop at the dashboard

Log in again and stop at target.com/commerce/login/dashboard. The user can reach the dashboard and view account, customer, payment and Settings pages, but every action is blocked. Only viewing is possible.

Step 3: Capture the API key request

In Burp, look at the requests the dashboard sends. One of them is the API key endpoint:

HTTP
commerce/apiKeys?appkey=false&source=Ecomerce

This endpoint is tied to the user's account, and the researcher obtained API keys from it while the account was pending.

Step 4: Use the keys against the API

With the API keys in hand, the researcher went to the platform's API documentation to see how to create, list, update, delete and find payments, plans, invoices and similar objects. All of these functions worked with the keys obtained from the pending account. The report states that this was the result, without reproducing individual API calls or responses.

Root cause

On the web dashboard, an unapproved user could view pages but could not perform actions. The API key endpoint sits outside that gate: it issues keys to an account that is still in the acceptance period, and the API then accepts those keys for state-changing operations. The API accepted keys issued to an account that was still pending approval. The report does not describe the server-side code, so the exact implementation is not known; the design flaw is that key issuance and API authorisation do not check the account's approval status.

Impact

An unauthenticated user, meaning one who has registered but has not been approved, can obtain API keys and use them to perform authenticated actions: payment processing, creating invoices, and creating, listing, updating, deleting and finding payments, plans and invoices. The report does not quantify the financial or data impact, and it does not say whether the keys outlive a later rejection of the account.

Fix

The vulnerability was submitted in April 2021 and, according to the researcher, was not fixed at the time of writing. A fix would need to stop issuing API keys to unapproved accounts and have the API check approval status.

Variants to test

  1. Key issuance during onboarding. Register an account that is pending approval and request the API key endpoint directly. A positive result is a key returned before approval.
  2. Other credential endpoints. Look for endpoints that mint tokens, personal access keys or app credentials for a pending account. A positive result is any credential usable against the API.
  3. Approval state changes. After obtaining keys, have the account rejected and retry the API calls. A positive result is that the keys keep working after rejection.
  4. UI-only restrictions. Compare what the dashboard blocks with what the API allows for the same account state. A positive result is an action blocked in the UI but accepted by the API.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 9 min read.

What happened, in plain words

A company runs an online shop platform. People sign up for an account, and before they are allowed to do anything serious, a human (or a process) has to approve them. That approval takes two or three days. During that waiting period the account is in limbo: not approved, not rejected.

The whole point of that waiting period is that a brand new, unvetted account should not be able to do things that matter, like processing payments or creating invoices. The website itself respects this: when you log in while waiting, you can look at your dashboard but cannot perform any action.

The researcher found that the website's API keys, the secret codes that let a program talk to the platform on your behalf, are handed out anyway, even to an account that is still waiting for approval. And once you have those keys, the platform's API accepted them for functions such as creating, listing, updating, deleting and finding payments, plans and invoices. So the waiting period can be skipped entirely by going around the website and talking to the API directly.

The report was submitted in April 2021 and, according to the researcher, was still not fixed when the write-up was published in September 2022.

Background you need first

What an API is

Think of a restaurant. The dining room is the website: menus, tables, waiters, a nice experience designed for humans. The kitchen is the API: a set of instructions the kitchen understands, like "table 4, one soup". You normally never walk into the kitchen yourself, but the waiter carries your order there.

In computing, an API (Application Programming Interface) is the set of addresses and rules a program uses to ask a service to do something. A website's pages are built for people clicking around; the API underneath is built for programs exchanging data. When you click "create invoice" on a web page, the page itself usually sends an API request behind the scenes to actually create it.

What an API key is

An API key is a long secret string that identifies who is making an API request. It works like a membership card at a gym: you show it at the door, and the staff let you in without asking your name again. Anyone who holds the card gets the access that comes with it, so keys must be kept secret and only given to people who are entitled to them.

What a sandbox is

A sandbox is a copy of a system set aside for testing, so that experiments do not touch real customers or real money. The program owners told researchers that the sandbox had the same functionality needed for testing, which is why findings there were considered meaningful.

What Burp Suite is

Burp Suite is a tool that sits between your browser and a website and records every request and response. It is like a security camera in the corridor between the dining room and the kitchen: you see exactly what the browser asked for and exactly what came back. Researchers use it to spot requests that the normal interface hides from view.

What the vulnerability class means

Privilege escalation means getting more power than you are supposed to have. Here it is not about hacking someone else's account; it is about an account that should be powerless (because it is not approved yet) managing to do powerful things anyway.

Broken authorisation is the underlying category: the system checks who you are (authentication) but fails to properly check what you are allowed to do (authorisation). A useful comparison is a hotel that checks your name at reception but never checks whether your key card opens the penthouse door.

The setup

The researcher worked against a public bug bounty program. Because the vulnerability was still unfixed at the time of writing, the real domain is replaced with target.com throughout the report. The commerce part of the platform lives at target.com/commerce.

The ingredients were:

  1. A newly registered account on the commerce platform, waiting for approval or rejection.
  2. Burp Suite, to watch the requests the dashboard makes.
  3. The platform's own API documentation, to learn which operations the API keys allow.

Finding it

Step 1: Register and watch the redirect chain

A new user registers on target.com/commerce and then waits a few days for approval or rejection. When that user logs in, the browser is bounced through a chain of addresses:

Text
target.com/commerce/login/auth -> target.com/commerce/login/dashboard -> target.com/commerce/login/denied

Read this left to right as a journey. First the login is processed at login/auth. Then the browser is sent to login/dashboard, the account's home page. Finally it is pushed to login/denied, the page that says you are not allowed in yet. The arrows simply mean "then the browser is sent to".

This chain is what the researcher observed for a pending account: login, then the dashboard, then the denied page.

Step 2: Stop at the dashboard

The researcher logged in again and stopped the journey at target.com/commerce/login/dashboard. At that point the user could reach the dashboard and was allowed to view the account, customer, payment and Settings pages. But no action could be performed: the pages were view-only.

Why try this? Because the redirect chain shows that the dashboard page exists and is reachable before the denial. If the server only blocks actions on the pages it redirects you away from, it is worth checking what happens when you stay on the page it does not redirect you away from. This suggested the restriction might not apply to the API.

Step 3: Capture the API key request

With Burp recording traffic, the researcher looked at the requests the dashboard sends. One of them was the API key endpoint:

HTTP
commerce/apiKeys?appkey=false&source=Ecomerce

Line by line, in plain words:

  • commerce/apiKeys is the address of a feature that deals with API keys. The name suggests it returns the keys belonging to the account.
  • ? starts the query string, the part of a web address that carries extra settings.
  • appkey=false is one setting with the name appkey and the value false.
  • & separates one setting from the next.
  • source=Ecomerce is a second setting named source with the value Ecomerce (spelled that way in the request).

This endpoint is tied to the user's account. The researcher notes that the user cannot access the API without logging in, since the account was neither approved nor rejected. The problem is that the API keys are still issued to an account in that pending state. In other words, the door to the API is locked, but the key to it is handed out at the reception desk before anyone checks whether you are allowed to have one.

Step 4: Use the keys against the API

With the API keys in hand, the researcher went to the platform's API documentation to see how to create, list, update, delete and find payments, plans, invoices and similar objects. All of these functions worked with the keys obtained from the pending account.

The report states that this was the result, without reproducing the individual API calls or responses. The point is the pattern: a credential issued to an unapproved account was accepted by the API for state-changing operations, which is exactly what the approval period is meant to prevent.

Why it works

The approval gate is enforced on the web dashboard. There, an unapproved user can view pages but cannot perform actions. The API key endpoint sits outside that gate: it issues keys to an account that is still in the acceptance period, and the API then accepts those keys for operations that change things.

Put simply, the authorisation check is applied to the browser session and the interface, rather than to the credential that the API actually trusts. The report does not describe the server-side code, so the exact implementation is not known. The design flaw is that key issuance and API authorisation do not check the account's approval status.

A comparison: a building where the receptionist stops you at the lift, but the service entrance is unlocked and the staff inside never ask for your badge.

What an attacker could do

An unauthenticated user, meaning one who has registered but has not been approved, can obtain API keys and use them to perform authenticated actions: payment processing, creating invoices, and creating, listing, updating, deleting and finding payments, plans and invoices.

The report does not quantify the financial or data impact, and it does not say whether the keys outlive a later rejection of the account.

How to fix it

The vulnerability was submitted in April 2021 and, according to the researcher, was not fixed at the time of writing.

A fix would need to stop issuing API keys to unapproved accounts and have the API check approval status. In the restaurant comparison: do not hand out kitchen passes to people still waiting for a table, and have the kitchen check the pass against the booking list every time an order arrives.

Things worth testing on a similar target

  1. Key issuance during onboarding. Register an account that is pending approval and request the API key endpoint directly. A positive result is a key returned before approval.
  2. Other credential endpoints. Look for endpoints that mint tokens, personal access keys or app credentials for a pending account. A positive result is any credential usable against the API.
  3. Approval state changes. After obtaining keys, have the account rejected and retry the API calls. A positive result is that the keys keep working after rejection.
  4. UI-only restrictions. Compare what the dashboard blocks with what the API allows for the same account state. A positive result is an action blocked in the UI but accepted by the API.

Glossary

  • API: the set of addresses and rules a program uses to ask a service to do something, as opposed to the pages a person clicks.
  • API key: a secret string that identifies who is making an API request and carries the access granted to that identity.
  • Authentication: proving who you are, for example by logging in.
  • Authorisation: deciding what a proven identity is allowed to do.
  • Broken authorisation: a flaw where the system fails to properly check what a user is allowed to do.
  • Burp Suite: a tool that records and lets you inspect the requests and responses between a browser and a website.
  • Endpoint: a specific address on a service that performs a particular function, such as commerce/apiKeys.
  • Privilege escalation: gaining more power or access than you are supposed to have.
  • Query string: the part of a web address after ? that carries extra settings, separated by &.
  • Redirect: an instruction from a server telling the browser to go to a different address.
  • Sandbox: a copy of a system set aside for testing, so experiments do not affect real users or data.
  • Session: the state of being logged in, usually represented by a cookie the browser sends with each request.
  • Token: a piece of data, often secret, that stands in for an identity or permission.
  • Unauthenticated user: in this report, someone who has registered but has not been approved, so is not entitled to act as a full user.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

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.