Skip to content
Access control Write-up Intermediate

Exploiting API with AuthToken

An authentication token found during reconnaissance was accepted by an API endpoint, and once the correct request headers and POST body were supplied, the endpoint returned data belonging to 100 clients. An attacker holding such a token could read other users' records from the API.

Rafi Ahamed Follow

Published on rafi-ahamed.medium.com

Myself, Rafi Ahamed. I am a Cyber Security Researcher from Bangladesh.

Rafi Ahamed (Leonidas D. Ace), on rafi-ahamed.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

This write-up is about exploiting API endpoints with an AuthToken that turns up during reconnaissance. The author, Rafi Ahamed, is explicit that the topic is exploitation, not discovery: many researchers find an AuthToken during recon, but because they cannot demonstrate impact the finding is often rejected, and he says he had been rejected a few times himself before this one worked.

The target was a private program on Bugcrowd. The report does not name the organisation, the product or the API. What it does say is that the program provided no credentials for testing and had no way to sign up, so there was no legitimate account through which to learn how the infrastructure behaved. The asset listed for the write-up itself is the author's Medium page, not the target.

Setup

The preconditions were unusual and are the heart of the story:

  1. A private Bugcrowd program with no test credentials and no sign-up path.
  2. An AuthToken found during recon, written in the code. The author reasoned it could be an alternative to an Authentication Bearer token that an API uses for authentication, so it looked more like an API token than anything else.
  3. No knowledge of how the target's API infrastructure worked, because there was no account to inspect.
  4. Burp Suite, with Repeater used to replay and modify requests.

Because of point 3 the author initially gave up on the token. The breakthrough came later, while testing a different web application, where he observed an API call used when updating user info. That request became the template he would point at the first target.

Finding it

The finding was not a single observation but a chain of inference. The token alone was not reportable: as the author puts it, simply reporting an AuthToken found in recon will in most cases be marked Not Applicable.

From the original on rafi-ahamed.medium.com

The second ingredient was a working API request shape, borrowed from an unrelated application's user-info update call. The author's idea was to take that request, keep its structure, and swap in the host and endpoint belonging to the program where the token had been found. The token supplied the authentication; the borrowed request supplied the syntax.

Exploitation

Step 1: replay the borrowed request against the target host

The user-info update request was sent to Burp Repeater, and the Host and request endpoint were changed to the ones found during recon on the private program. The response came back as shown below.

From the original on rafi-ahamed.medium.com

The result was 403 Forbidden. That is not access, but it is information: the error told the author which headers were missing. The request was reaching something that evaluated it.

Step 2: add the token under the header name the error revealed

The token found in recon was added using the header name that the 403 response indicated. The response changed.

From the original on rafi-ahamed.medium.com

The result was 500 Internal Server Error. The author reads this as confirmation that a connection to the API had been established. The request was a POST request and carried no POST data, which in his explanation is why the application returned a 500.

Step 3: add POST data and read the response

A little more recon produced some POST data that could be used to test the endpoints. The request was sent again with that POST data added.

From the original on rafi-ahamed.medium.com

The response gave access to 100 clients' data. The author describes his reaction as "Boom".

From the original on rafi-ahamed.medium.com

Timeline

The report was submitted to Bugcrowd and triaged as P1, with what the author calls a nice 4-digit bounty.

Event Date
Reported November 10th
Not Applicable November 13th
Triaged November 13th
Resolved November 14th

The Not Applicable and Triaged entries share a date, which is how the author records them.

Root cause

The report does not describe the server-side code, so the mechanism can only be inferred. What the sequence shows is an API endpoint that accepted a token found in code during recon as sufficient authentication, and that returned data belonging to many clients to a caller who had no account on the platform. The author does not analyse why the endpoint behaved this way; the write-up treats the missing account context as the opening, not the flaw itself. The author does not state which defence failed or whether any existed; the write-up treats the missing account context as the opening, not the flaw itself.

Impact

Under the conditions described, an attacker who finds a leaked AuthToken in code during recon can use it, combined with a request shape borrowed from any other application, to reach an API they have no account on and retrieve other clients' data. In this case that meant 100 clients' data. The author does not describe what fields were exposed, whether the data could be modified, or whether the token belonged to a privileged user. The report was triaged as P1 and paid a 4-digit bounty.

Fix

It was resolved the day after triage, but no remediation detail is given.

Variants to test

  1. Token in client-side code. Search JavaScript bundles and other recon output for strings that look like API tokens.
  2. Borrowed request shapes. Take a working API call from any application you can access, such as a user-info update, and replay it against a host you cannot access, changing only the Host and endpoint.
  3. Header discovery through errors. Use the header names an error response mentions to complete the request. A positive result is a change in status code that shows the request is being processed further.
  4. Bodyless POST. Send a POST with no body to an authenticated endpoint.
  5. POST data from recon. Feed parameters discovered elsewhere on the target into the endpoint.

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

What happened, in plain words

A security researcher found a secret string of characters, called an AuthToken, while looking around a company's website. On its own, a found token is usually not enough to report: the company will say "so what, you found a string", and close the report. The researcher had been in that position before. This time he managed to turn the token into something that actually worked: he used it to talk to the company's API, a behind-the-scenes service that applications use to exchange data, and got access to 100 clients' data. He reported it to Bugcrowd, a platform where companies run bug bounty programmes, and it was triaged as P1, with a 4-digit bounty.

This article walks through that chain slowly, for someone who has never done security testing. Every technical word is explained where it first appears, and there is a glossary at the end.

Context

This write-up is about exploiting API endpoints with an AuthToken that turns up during reconnaissance. Reconnaissance, or recon, means the information-gathering phase: looking at a website's pages, its code and its traffic to learn how it is built, before trying anything. The author, Rafi Ahamed, is explicit that the topic is exploitation, not discovery. Many researchers find an AuthToken during recon, but because they cannot demonstrate impact, meaning they cannot show what damage the token allows, the finding is often rejected. He says he had been rejected a few times himself before this one worked.

The target was a private program on Bugcrowd. A private program is one where only invited researchers can take part, and its details are not public. The report does not name the organisation, the product or the API. What it does say is that the program provided no credentials for testing and had no way to sign up. Credentials are a username and password, the things you type to log in. Without them, and with no sign-up form, there was no legitimate account through which to learn how the infrastructure behaved. The asset listed for the write-up itself is the author's Medium page, not the target.

Setup

The preconditions were unusual and are the heart of the story:

  1. A private Bugcrowd program with no test credentials and no sign-up path.
  2. An AuthToken found during recon, written in the code. The author reasoned it could be an alternative to an Authentication Bearer token that an API uses for authentication, so it looked more like an API token than anything else.
  3. No knowledge of how the target's API infrastructure worked, because there was no account to inspect.
  4. Burp Suite, with Repeater used to replay and modify requests.

A few of those need unpacking.

An API (Application Programming Interface) is a software intermediary that lets two applications talk to each other. The author's own comparison: every time you use an app like Facebook, send an instant message, or check the weather on your phone, you are using an API. Think of it as a waiter in a restaurant: you do not walk into the kitchen, you tell the waiter what you want and the waiter brings it back. Your browser is the customer, the API is the waiter, and the company's database is the kitchen.

A token is a short piece of text that acts as proof of identity, a bit like a cloakroom ticket. You hand over the ticket and get your coat; the attendant does not need to know your name. An AuthToken is exactly that for a service: instead of sending a username and password with every request, the application sends the token, and the server trusts it. An Authentication Bearer token is a common style of this: the word "Bearer" means "whoever bears (carries) this token is treated as the owner". That is why a leaked token is dangerous: anyone holding the ticket can collect the coat.

Burp Suite is a tool that sits between your browser and a website and lets you see and edit the requests your browser sends. Repeater is one part of it: you capture a request, and Repeater lets you send it again and again, changing pieces each time, and see the reply. It is like being able to re-post the same letter with edits and read each reply.

Because of point 3, the author initially gave up on the token. The breakthrough came later, while testing a different web application, where he observed an API call used when updating user info. That request became the template he would point at the first target. In other words, he did not know how to talk to the first company's API, so he borrowed the sentence structure from a different company's API and swapped in the first company's address.

Finding it

The finding was not a single observation but a chain of inference. The token alone was not reportable: as the author puts it, simply reporting an AuthToken found in recon will in most cases be marked Not Applicable. "Not Applicable" is the status a programme uses when a report does not describe a real security problem.

From the original on rafi-ahamed.medium.com

The image sits right after that point, illustrating the assumption the rest of the article rests on: you have found a token, and on its own it proves nothing.

The second ingredient was a working API request shape, borrowed from an unrelated application's user-info update call. The author's idea was to take that request, keep its structure, and swap in the host and endpoint belonging to the program where the token had been found. The host is the address of the server, the part of a web address that names the machine, like the street address on an envelope. The endpoint is the specific door on that server, the path that names a particular function, like the flat number. The token supplied the authentication; the borrowed request supplied the syntax.

Exploitation

Step 1: replay the borrowed request against the target host

The user-info update request was sent to Burp Repeater, and the Host and request endpoint were changed to the ones found during recon on the private program. The response came back as shown below.

From the original on rafi-ahamed.medium.com

The result was 403 Forbidden. That is not access, but it is information: the error told the author which headers were missing. A header is a small labelled line that travels with every web request or response, carrying extra instructions, like the "From" and "Subject" lines on a letter. The request was reaching something that evaluated it, and that something was willing to say what it wanted.

Why do this at all? Because the borrowed request was known to work somewhere, so it is a valid sentence. Sending it to a new address tells you whether the new address understands the same language, and the error message tells you what is still missing.

Step 2: add the token under the header name the error revealed

The token found in recon was added using the header name that the 403 response indicated. The response changed.

From the original on rafi-ahamed.medium.com

The result was 500 Internal Server Error. A 500 means the server tried to process the request and something went wrong on its side. The author reads this as confirmation that a connection to the API had been established: the request had got past the front door and into the room. The request was a POST request and carried no POST data, which in his explanation is why the application returned a 500. A POST request is the kind of request a browser sends when you submit a form, carrying data in its body; a GET request is the kind you send when you simply ask for a page. Sending a POST with an empty body is like posting an envelope with no letter inside: the sorting office accepts it, but the clerk who opens it has nothing to work with and complains.

Step 3: add POST data and read the response

A little more recon produced some POST data that could be used to test the endpoints. The request was sent again with that POST data added.

From the original on rafi-ahamed.medium.com

The response gave access to 100 clients' data. The author describes his reaction as "Boom".

From the original on rafi-ahamed.medium.com

That last image is placed where the result lands: the data coming back, and the moment the chain is complete.

Timeline

The report was submitted to Bugcrowd and triaged as P1, with what the author calls a nice 4-digit bounty. Triaged means the programme's staff looked at the report and accepted it as a genuine issue; P1 is their highest severity label. A bounty is the payment a programme makes for a valid report.

Event Date
Reported November 10th
Not Applicable November 13th
Triaged November 13th
Resolved November 14th

The Not Applicable and Triaged entries share a date, which is how the author records them.

Root cause

The report does not describe the server-side code, so the mechanism can only be inferred. What the sequence shows is an API endpoint that accepted a token found in code during recon as sufficient authentication, and that returned data belonging to many clients to a caller who had no account on the platform. Client-side code is the code that runs in your browser, such as the JavaScript files a page loads; anything written there can be read by anyone who visits the page. The author does not analyse why the endpoint behaved this way; the write-up treats the missing account context as the opening, not the flaw itself. A tenant here means one customer's separate slice of a shared system. The author does not state which defence failed or whether any existed; the write-up treats the missing account context as the opening, not the flaw itself.

Impact

Under the conditions described, an attacker who finds a leaked AuthToken in code during recon can use it, combined with a request shape borrowed from any other application, to reach an API they have no account on and retrieve other clients' data. In this case that meant 100 clients' data. The author does not describe what fields were exposed, whether the data could be modified, or whether the token belonged to a privileged user. The report was triaged as P1 and paid a 4-digit bounty.

Fix

It was resolved the day after triage, but no remediation detail is given.

Variants to test

These are the same ideas generalised, so you can try them on programmes you are allowed to test. Always stay inside the programme's rules and scope.

  1. Token in client-side code. Search JavaScript bundles and other recon output for strings that look like API tokens. A 401 means "not authenticated", a 403 means "authenticated but not allowed"; anything else means the server is treating you as someone.
  2. Borrowed request shapes. Take a working API call from any application you can access, such as a user-info update, and replay it against a host you cannot access, changing only the Host and endpoint.
  3. Header discovery through errors. Use the header names an error response mentions to complete the request. A positive result is a change in status code that shows the request is being processed further.
  4. Bodyless POST. Send a POST with no body to an authenticated endpoint. A 400 means the server thought the request itself was malformed.
  5. POST data from recon. Feed parameters discovered elsewhere on the target into the endpoint.

Glossary

  • API: a software intermediary that lets two applications talk to each other, like a waiter carrying orders between you and the kitchen.
  • API endpoint: the specific address and path on a server that names one function of an API, like a flat number on a street.
  • AuthToken: a piece of text used as proof of identity in place of a username and password, like a cloakroom ticket.
  • Authentication Bearer token: a token sent with the word "Bearer", meaning whoever carries it is treated as its owner.
  • Bounty: the payment a bug bounty programme makes for a valid report.
  • Bug bounty programme: a scheme where a company invites researchers to report security problems in exchange for rewards.
  • Bugcrowd: the platform on which the private programme in this story ran.
  • Burp Suite: a tool that sits between your browser and a website so you can see and edit requests.
  • Client-side code: code that runs in your browser, such as JavaScript files, which anyone visiting the page can read.
  • Credentials: a username and password used to log in.
  • Endpoint: see API endpoint.
  • Exploitation: turning a weakness into a demonstrated effect, showing what an attacker could actually do.
  • GET request: the kind of request a browser sends when it simply asks for a page.
  • Header: a small labelled line travelling with a web request or response, carrying extra instructions.
  • Host: the part of a web address that names the server machine.
  • Impact: the real-world consequence of a weakness, such as data being exposed.
  • Not Applicable: the status a programme gives a report that does not describe a real security problem.
  • P1: the highest priority label a programme can give a report.
  • POST data: the data carried in the body of a POST request, such as the contents of a submitted form.
  • POST request: the kind of request a browser sends when submitting a form, carrying data in its body.
  • Private program: a bug bounty programme open only to invited researchers.
  • Reconnaissance (recon): the information-gathering phase before testing, looking at pages, code and traffic to learn how a site is built.
  • Repeater: the part of Burp Suite that lets you resend a captured request with edits and read each reply.
  • Resolved: the status showing the programme has fixed the issue.
  • Root cause: the underlying reason a weakness exists, as opposed to its visible symptom.
  • Tenant: one customer's separate slice of a shared system.
  • Token: a short piece of text used as proof of identity.
  • Triaged: the status showing programme staff have reviewed a report and accepted it as genuine.
  • 401: the status code meaning "not authenticated".
  • 403: the status code meaning "authenticated but not allowed".
  • 500: the status code meaning the server tried to process the request and something went wrong on its side.

More by Rafi Ahamed

View all

3 more disclosed reports, best first.

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.