Skip to content
Access control Write-up Intermediate

How did I earned 6000$ from tokens and scopes in one day

The application allowed users to assign hidden employee-level scopes to invited users and to API keys by tampering with the scopes parameter in requests. An attacker could escalate their account to employee privileges and access an internal employee operations API.

corraldev Follow

Published on infosecwriteups.com

Bounty$6,000 View original

I don’t do bug bounty quite often because it’s very hard to find something interesting and to be the first reporter… but the other day was different.

Corraldev, on infosecwriteups.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. 5 min read.

Context

This is a private HackerOne program with a deliberately narrow scope: two hosts, api.company.com and app.company.com. The application handles authentication with Auth0, runs on Express.JS for the web layer, and keeps sessions in JWTs. One of its features lets a user invite other users into a group and then change those users' account privileges and scopes. That invitation and privilege-editing flow is the centre of the whole story.

The author does not do bug bounty often, but an invitation to this private program arrived by email and the bounties looked attractive enough to take a look.

Setup

  1. Create an account on the application.
  2. Proxy traffic through Burp and browse the application to see how it is built.
  3. Note the stack: Auth0 for authentication, Express.JS for the web application, JWT for sessions.
  4. Use the group invitation feature, which allows inviting users and then editing their privileges and scopes.

The only precondition for the attack is a normal account on the application and access to the invite and privilege-editing feature.

Finding it

The first idea was the classic JWT alg confusion: change the algorithm to none and impersonate an employee. The server rejected it with an error message saying that none is not a valid algorithm, so that path was closed.

The author then focused on privilege escalation: getting a normal account up to employee level. After reading a large amount of the application's JavaScript, something stood out. The edit-user-privileges menu did not list every scope the application knew about. Two scopes existed that were not exposed in the UI:

  • company:support
  • company:operations

Their names suggested they were reserved for employees. The question was whether the server would accept them if they were sent directly, outside the menu that normally constrains the choice.

Exploitation

Step 1: Spoof the scopes on the invite/privilege-edit request

Using the group feature, invite another user into the group, then intercept the request that changes that user's scopes with Burp and replace the scopes parameter with the employee scopes. The report does not reproduce the raw request, only the technique: intercept, spoof the scopes parameter, send.

The server answered 200 OK. At that point the invited account held employee-level scopes, and the author notes he could have received a bounty there but wanted more. The author kept going to confirm what those scopes actually unlocked.

Step 2: Find the employee-only service

With the escalated account, the application looked the same: no new menus, no admin actions. So it was back to reconnaissance. Inside the JavaScript library there were API references to a service that had not been seen before, and a comment below them described it as something like a service for employees operations.

Step 3: Call the hidden service

The next step was to send a request to that API reference with the escalated account and see whether it returned 200 OK. It did, which confirmed the privilege escalation.

The report was submitted with a CVSS 3.1 score of 9.9 and a bounty of 3000 USD.

Step 4: The same flaw in API key creation

There was a second feature: users can create API keys for their account and assign scopes to those keys. The same trick applied. Intercept the API key generation request, spoof the scopes parameter with the employee scopes, and send it. The author reports that the spoofed request succeeded.

That second finding was also rated 9.9 CVSS 3.1 and paid another 3000 USD, for 6000 USD in total from the two reports.

Root cause

The scopes parameter could be spoofed on two separate requests: the one that edits a group member's privileges, and the one that creates an API key. The UI only offers a subset of scopes, but the server does not validate the submitted scopes against what the caller is allowed to grant. Any authenticated user who can invite and edit users, or who can create API keys, can therefore assign scopes that are meant to be reserved for employees, such as company:support and company:operations.

The JWT alg: none attempt was correctly rejected, so the token handling itself held up. The weakness is authorisation on the scope-assignment parameters, not token forgery. A request to the hidden employee service with the escalated account returned 200 OK.

Impact

An authenticated low-privilege user can grant employee-level scopes to an account they control, or to an invited user, and then reach an internal service intended for employees operations. The same user can mint API keys carrying those employee scopes. In both cases the result is privilege escalation from a normal account to employee capabilities. Both reports were scored 9.9 CVSS 3.1. The report does not describe what actions the employee service exposes beyond confirming that requests to it returned 200 OK.

Fix

The report does not say what the program changed. The fix implied by the findings is server-side authorisation on the scopes parameter in both the privilege-editing request and the API key creation request: reject any scope the caller is not entitled to grant, rather than relying on the UI to limit the choices. The hidden employee service should also verify the caller's entitlement independently of the scopes stored on the account or key.

Variants to test

  1. Scope parameters on other endpoints. Look for any request that carries a scopes, permissions or roles field, such as invitations, team management, OAuth client registration or token exchange. A positive result is a 200 OK where the response or a follow-up request shows the elevated scope in effect.
  2. Hidden scopes in client-side code. Grep the JavaScript bundles for scope strings and API references that are not in the UI, especially ones with comments describing internal or employee use. A positive result is a scope name the UI never offers plus an endpoint that accepts it.
  3. API key creation with arbitrary scopes. Create a key with scopes above your level and use it against a privileged endpoint. A positive result is the privileged endpoint returning 200 OK with the key.
  4. Invite-and-edit flows. Invite a second account, then edit its privileges with tampered values. A positive result is the invited account gaining capabilities the inviter does not have.
  5. JWT algorithm handling. Try alg: none and algorithm confusion as a baseline check. A positive result is a token accepted without a valid signature, though in this program that path was correctly blocked.

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. 10 min read.

What happened, in plain words

A security researcher received an email inviting them to a private bug bounty program on HackerOne. A bug bounty program is a deal offered by a company: if you find a security problem in their systems and report it responsibly, they pay you a reward (the bounty). A private program means only invited researchers can take part.

The researcher created a normal user account on the company's application, watched the traffic their browser sent and received, and found a way to give their own account the powers of a company employee. They then found a second, very similar way to do the same thing through a different feature. Each finding was rated 9.9 CVSS 3.1 and paid 3000 USD, for 6000 USD in total.

This article walks through the same steps in the same order, explaining every term from scratch. You only need to be comfortable using a browser.

The setup: what the application is made of

The program's scope (the list of systems you are allowed to test) was deliberately small, just two hosts:

api.company.com

app.company.com

A host is simply a named computer on the internet. app.company.com is the web application people log into with a browser. api.company.com is an API. An API (Application Programming Interface) is the part of a service that other software talks to, rather than a human clicking buttons. Think of a restaurant: the dining room where you sit and order is the web app, and the kitchen door where orders are passed through is the API. Both belong to the same restaurant, but they are reached differently.

The researcher created an account, then set up Burp. Burp Suite is a tool that sits between your browser and the website like a postal inspector: every request your browser sends and every response the server sends back passes through it, and you can read, pause and edit them. This is called proxying traffic.

Watching the traffic revealed three building blocks:

  • Auth0 handles authentication. Authentication means proving who you are, like showing your passport at a border. Auth0 is a company that provides this login service so other companies do not have to build it themselves.
  • Express.JS is the web framework, the toolkit the developers used to build the server side of the application.
  • JWT (JSON Web Token) is used for sessions. A session is the server's memory of you being logged in. A JWT is a small signed piece of text the server gives your browser after login; your browser sends it back with every request so the server knows it is still you. Think of a cloakroom ticket: it proves the coat is yours, and it is hard to forge because the cloakroom checks its own stamp.

One feature of the application matters for everything that follows: you can invite users to a group and then change their account's privileges/scopes. A scope is a named permission, a label that says what an account is allowed to do, such as read:files or write:comments. Privileges are the same idea in general language: what you are allowed to do.

First attempt: breaking the token

The first idea was a classic JWT trick. A JWT is signed with an algorithm, a mathematical recipe the server uses to prove the token was not tampered with. One of the possible values for that algorithm field is none, meaning no signature at all. If a server accepts none, an attacker can write their own token claiming to be anyone, and the server will believe it.

The researcher tried changing the algorithm of the JWT to none and impersonating an employee. The server refused, with an error message saying that none is not a valid algorithm. That door was closed, and correctly so: the token handling itself was sound.

Reading the code and spotting hidden scopes

The researcher then focused on privilege escalation, which means getting a normal account up to a higher level, here employee level. After reading a large amount of the application's JavaScript, something stood out. JavaScript is the code that runs in your browser to make a web page interactive; it is delivered to every visitor, so anyone can read it.

The menu for editing a user's privileges did not list every scope the application knew about. Two scopes existed that were not offered in the interface:

  • company:support
  • company:operations

Their names suggested they were reserved for employees. The question was whether the server would accept them if they were sent directly, outside the menu that normally limits the choice. This is a common theme in security: the menu is a convenience for honest users, but the real decision must be made by the server, because an attacker can bypass the menu entirely.

Step 1: Sending the employee scopes by hand

Using the group feature, the researcher invited another user into the group, then intercepted the request that changes that user's scopes with Burp and replaced the scopes parameter with the employee scopes. A parameter is a named value inside a request, like a field on a form. Intercepting means pausing the request in Burp before it reaches the server, so you can edit it.

The report does not reproduce the raw request, only the technique: intercept, spoof the scopes parameter, send. Spoofing means sending a value the application did not intend you to send.

The server answered 200 OK. 200 OK is the standard HTTP status code meaning the request succeeded. At that point the invited account held employee-level scopes, and the author notes he could have received a bounty there but wanted more. The researcher kept going to confirm what those scopes actually unlocked.

Step 2: Finding the employee-only service

With the escalated account, the application looked the same: no new menus, no admin actions. So it was back to reconnaissance, the phase of gathering information about how a system is built. Inside the JavaScript library there were API references to a service that had not been seen before, and a comment below them described it as something like a service for employees operations.

An API reference here means a URL written in the code that the application can call. Finding one that the interface never uses is a strong hint that it is meant for internal or privileged users.

Step 3: Calling the hidden service

The next step was to send a request to that API reference with the escalated account and see whether it returned 200 OK. It did. That confirmed the privilege escalation. A backend service is software running on the server that does the real work behind the scenes.

The report was submitted with a CVSS 3.1 score of 9.9 and a bounty of 3000 USD. CVSS is a standard scoring system for the severity of a security flaw; 9.9 out of 10 is critical.

Step 4: The same flaw in API key creation

There was a second feature: users can create API keys for their account and assign scopes to those keys. An API key is a long secret string that software uses instead of a username and password, like a key card for a building. The same trick applied. The researcher intercepted the API key generation request, spoofed the scopes parameter with the employee scopes, and sent it. The author reports that the spoofed request succeeded.

That second finding was also rated 9.9 CVSS 3.1 and paid another 3000 USD, for 6000 USD in total from the two reports.

Why it worked

The scopes parameter could be spoofed on two separate requests: the one that edits a group member's privileges, and the one that creates an API key. An endpoint is one specific address on a server that performs one specific action. Client-controlled means the value comes from the user's browser, and the browser can be edited freely with a tool like Burp.

The interface only offers a subset of scopes, but the server does not check the submitted scopes against what the caller is allowed to grant. Any logged-in user who can invite and edit users, or who can create API keys, can therefore assign scopes meant to be reserved for employees, such as company:support and company:operations.

The JWT alg: none attempt was correctly rejected, so the token handling itself held up. The weakness is authorisation on the scope-assignment parameters, not token forgery. Authorisation means deciding what an authenticated user is allowed to do, as opposed to authentication, which is deciding who they are. A request to the hidden employee service with the escalated account returned 200 OK.

What an attacker could do

A logged-in low-privilege user can grant employee-level scopes to an account they control, or to an invited user, and then reach an internal service intended for employees operations. The same user can create API keys carrying those employee scopes. In both cases the result is privilege escalation from a normal account to employee capabilities. Both reports were scored 9.9 CVSS 3.1. The report does not describe what actions the employee service exposes beyond confirming that requests to it returned 200 OK.

How to fix it

The report does not say what the program changed. The fix implied by the findings is server-side authorisation on the scopes parameter in both the privilege-editing request and the API key creation request: reject any scope the caller is not entitled to grant, rather than relying on the interface to limit the choices. The hidden employee service should also verify the caller's entitlement independently of the scopes stored on the account or key.

Similar things to test

  1. Scope parameters on other endpoints. Look for any request that carries a scopes, permissions or roles field, such as invitations, team management, OAuth client registration or token exchange. A positive result is a 200 OK where the response or a follow-up request shows the elevated scope in effect.
  2. Hidden scopes in client-side code. Search the JavaScript bundles for scope strings and API references that are not in the interface, especially ones with comments describing internal or employee use. A positive result is a scope name the interface never offers plus an endpoint that accepts it.
  3. API key creation with arbitrary scopes. Create a key with scopes above your level and use it against a privileged endpoint. A positive result is the privileged endpoint returning 200 OK with the key.
  4. Invite-and-edit flows. Invite a second account, then edit its privileges with tampered values. A positive result is the invited account gaining capabilities the inviter does not have.
  5. JWT algorithm handling. Try alg: none and algorithm confusion as a baseline check. A positive result is a token accepted without a valid signature, though in this program that path was correctly blocked.

Glossary

  • API: the part of a service that software talks to, as opposed to the part a human uses in a browser.
  • API key: a long secret string that software uses to identify itself, like a key card.
  • Authentication: proving who you are, for example by logging in.
  • Authorisation: deciding what an authenticated user is allowed to do.
  • Auth0: a company that provides login and authentication services to other companies.
  • Backend service: software running on the server that does the real work behind the scenes.
  • Bug bounty program: a deal where a company pays researchers for responsibly reported security problems.
  • Burp Suite: a tool that sits between your browser and a website so you can read, pause and edit requests and responses.
  • Client-controlled: a value that comes from the user's browser and can therefore be edited by the user.
  • CVSS: a standard scoring system for the severity of a security flaw, from 0 to 10.
  • Endpoint: one specific address on a server that performs one specific action.
  • Express.JS: a toolkit for building the server side of web applications.
  • Host: a named computer on the internet, such as app.company.com.
  • Intercept: pause a request in a proxy tool before it reaches the server, so it can be edited.
  • JavaScript: the code that runs in your browser to make web pages interactive; every visitor can read it.
  • JWT (JSON Web Token): a small signed piece of text used to prove you are logged in; hard to forge because the server checks its signature.
  • Parameter: a named value inside a request, like a field on a form.
  • Privilege escalation: gaining a higher level of access than you were given.
  • Privileges: what an account is allowed to do.
  • Private program: a bug bounty program open only to invited researchers.
  • Proxy: a tool or server that sits between two parties and passes traffic between them.
  • Reconnaissance: the phase of gathering information about how a system is built.
  • Scope (program): the list of systems a researcher is allowed to test.
  • Scope (permission): a named permission label saying what an account or key may do.
  • Session: the server's memory of you being logged in.
  • Spoofing: sending a value the application did not intend you to send.
  • Status code: a number in an HTTP response saying how the request went; 200 OK means success.
  • alg: none: a JWT setting meaning no signature at all; if a server accepts it, anyone can forge a token.

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.