Skip to content
Account takeover Write-up Intermediate

From API Access Bypass to Campaign Takeover

A separate API subdomain granted API access based only on a victim's email address, and the token endpoint issued an API token from just a username and password without enforcing two-factor authentication. With that token, an attacker could invite their own account as OWNER of a campaign and remove the legitimate user, taking over the campaign.

medium.com

Published on medium.com

Cybersecurity

Udaytrivedi, on 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 web application that does not give users direct API access by default. According to its API documentation, a user first has to request API access, so the researcher initially treated that requirement as a security boundary that would have to be crossed.

While testing the application, the researcher found another subdomain related to the API. That subdomain hosted a flow that granted API access on the basis of the victim's email address alone.

Setup

The report does not describe the accounts, roles, tools or versions used. What it does describe is the sequence of preconditions the chain depends on: knowledge of a victim's email address, knowledge of the victim's username and password, and the ability to receive an invitation email on an account the attacker controls.

Finding it

Two observations drove the work:

  1. The API access request flow on the separate API subdomain only required the victim's email address to hand out API access. The researcher summarised this first link as:
Text
Victim email → API access obtained
  1. After obtaining API access, the researcher examined the authentication flow and found that the API token could be obtained with the victim's username and password, with no second factor required. The expected flow was:
Text
Username + Password → 2FA → API Token

but the observed flow was:

Text
Username + Password → API Token

Both steps looked wrong: the first skipped the documented API access request, and the second issued a token without a 2FA challenge.

Exploitation

Step 1: obtain API access with the victim's email

The researcher used the API-related subdomain, where the access flow accepted the victim's email address and granted API access. The report does not include the request, the endpoint path or the response body for this step.

Step 2: obtain an API token without 2FA

With API access in place, the researcher requested an API token using the victim's username and password. The token was issued without a 2FA challenge. The report does not include the request or the response for this step.

Step 3: find the campaign invitation endpoint

While testing the API with the token, the researcher found a campaign invitation endpoint. Through it, a caller could specify the user's campaign and invite an email address with a specific role. The report does not give the endpoint path, the parameter names or the request body.

Step 4: invite the attacker as OWNER

The researcher tested whether the invitation endpoint would accept the attacker's own account with the OWNER role, and it did.

Step 5: accept the invitation and remove the victim

The researcher accepted the invitation from the attacker's account and then removed the legitimate user from the campaign. The complete chain was:

Text
Victim Email     ↓API Access Bypass     ↓Username + Password     ↓2FA Bypass     ↓API Token     ↓Invite Attacker as OWNER     ↓Remove Victim     ↓Campaign Takeover 🚨
From the original on medium.com

Root cause

Two weaknesses combined, and the report frames them as design or logic mistakes rather than memory-safety or injection bugs:

  • The API access request flow on the separate subdomain trusted an email address as sufficient proof of entitlement to API access.
  • The token issuance flow did not enforce 2FA, so a correct username and password were enough to receive a token.

The invitation endpoint accepted an invitation for the researcher's own account with the OWNER role.

Impact

An attacker who knows a victim's email address, username and password could obtain API access, obtain an API token without passing 2FA, invite their own account into the victim's campaign as OWNER, accept the invitation, and remove the legitimate user. The result is a full campaign takeover.

Fix

Based on the weaknesses described, the controls that should be enforced are: requiring proof of ownership of the email address before granting API access, enforcing 2FA at token issuance as well as at interactive login, and restricting the roles an inviter can assign so that a new invitee cannot be granted OWNER without appropriate authorisation.

Variants to test

  1. Alternate API access request flows. Look for other subdomains or endpoints that grant API credentials on the basis of an email address alone. A positive result is API access being issued without any verification of the address.
  2. Token endpoints that skip 2FA. Compare the interactive login flow with every token-issuing endpoint (API tokens, personal access tokens, refresh flows). A positive result is a token returned after only username and password.
  3. Role assignment on invitation endpoints. Try inviting your own account with each privileged role the product supports. A positive result is an invitation accepted with a role above what the inviter should be able to grant.
  4. Post-invitation actions. After accepting an invitation, test removal or demotion of existing members. A positive result is the legitimate owner being removed by the newly invited account.
  5. Chaining beyond the first bypass. Whenever a control is bypassed, enumerate the privileged actions the resulting session or token can perform, as the researcher did here, rather than stopping at the bypass itself.

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

What happened, in plain words

A security researcher was testing a web application, meaning a website you use through a browser. The application has "campaigns", and users within them have roles, including OWNER. The researcher found a way to take over someone else's campaign without passing that person's second factor, the extra code some sites ask for after your password.

The takeover was not one single bug. It was a chain of small weaknesses, each one handing the researcher a little more power, until the last link let them throw the real owner out of their own campaign. The report is short, and it deliberately hides the target's name and addresses, so several technical details are simply not given. What it does give is the shape of the chain and the lesson the researcher drew from it.

The pieces you need to know first

Before walking through the steps, here are the ideas the report leans on, explained from scratch.

What an API is

A normal website is built for humans: you click buttons and read pages. An API (Application Programming Interface) is the same service built for programs. Instead of a page with buttons, it offers a set of addresses (called endpoints) that a program can call, sending data and getting data back, usually in a machine-friendly format such as JSON. A useful comparison is a restaurant. The dining room with menus and waiters is the website; the kitchen hatch where orders are passed in a fixed format is the API. Both serve the same food, but one is for guests and one is for staff and delivery drivers.

Because an API is meant for programs, it often has its own rules about who may call it. That is exactly where this story starts.

What a token is

When you log in to a website, the server needs a way to remember you on the next request, because the web protocol itself is forgetful: every request arrives as if for the first time. The usual solution is a token (or session cookie): a long random string the server gives you after a successful login, which your browser or program sends back with every following request. It works like a cloakroom ticket. The attendant gives you a numbered ticket; you do not carry your coat around, you just show the ticket and the attendant fetches the coat. Anyone holding the ticket gets the coat, which is why stealing a token is as good as stealing a login.

An API token is the same idea, issued specifically so that a program can call the API without a human sitting there typing a password each time.

What 2FA is

2FA stands for two-factor authentication. Instead of proving who you are with one thing (your password), you prove it with two different kinds: something you know (the password) and something you have (a code from your phone, a hardware key, an app). The point is that a stolen password alone is not enough. Think of a bank safe that needs both a key and a combination: losing the key does not open it.

A 2FA bypass is any flaw that lets someone get past that second check. The most damaging kind is when a part of the system simply forgets to ask for the second factor at all.

What privilege escalation is

Privilege means permission, and privilege escalation means getting permissions you were not supposed to have, usually by moving from a low role to a high one. In a shared workspace, a member can edit things, an owner can also remove people and change settings. If a member can somehow make themselves owner, that is privilege escalation.

What a subdomain is

A subdomain is a prefix on a domain name. If the main site is example.com, then api.example.com and app.example.com are subdomains. They often run different software, maintained by different teams, and, as in this case, they can enforce different rules. A useful comparison is a building with several entrances: the front door may have a guard, while the side door propped open for deliveries does not.

The starting assumption

The application does not hand out API access to just anyone. According to its API documentation, a user first has to request API access. The researcher read that requirement as a security boundary, a wall that would have to be crossed before anything interesting could happen with the API. That is a sensible starting assumption: if the documentation says you must ask, presumably someone checks before saying yes.

Finding the first hole

While testing the application, the researcher found another subdomain related to the API. On that subdomain, the flow that granted API access asked for only one thing: the victim's email address. Knowing an email address is not proof of anything. Email addresses are semi-public: they appear in signatures, on company pages, in mailing list archives. If an email address is enough to be given API access, then API access is effectively open to anyone who can guess or look up an address.

The researcher summarised this first link in the chain as:

Text
Victim email → API access obtained

Read the arrow as "leads to". The line says: supply the victim's email address, and API access comes out the other side. The report says only the victim's email address was required for this step. The report does not include the request, the endpoint path or the response for this step, so we cannot see the exact form the request took.

Why does this matter on its own? The documented rule said access had to be requested, yet this subdomain's flow granted it from an email address. The wall the researcher expected was not a wall.

Finding the second hole

With API access in hand, the researcher turned to the authentication flow, the part of the system that decides whether you are who you claim to be and hands out a token if so. The researcher found that the API token could be obtained using the victim's username and password.

The surprise was what was missing: 2FA was not enforced when getting the token. The flow that should have happened was:

Text
Username + Password → 2FA → API Token

In words: you type your username and password, the system then asks for your second factor, and only after that does it give you a token. The plus signs mean "and", and the arrows mean "then".

What actually happened was:

Text
Username + Password → API Token

In words: you type your username and password, and the token comes straight back, with no second check in between. The 2FA step has vanished from the sequence.

Why is this serious? Because 2FA exists precisely to make a stolen password useless on its own. If one path into the system, here the token-issuing path, does not ask for the second factor, then an attacker with a password can simply use that path instead of the normal login page. The lock is on the front door and the window is open. Passwords leak constantly through reused passwords, phishing and old breaches, so "password only" is a much weaker guarantee than the application's users believe they have.

Both steps looked wrong: the first bypassed the documented API access request, the second issued a token without 2FA.

Following the chain instead of stopping

At this point the researcher had a working 2FA bypass, which is already a reportable finding. The interesting decision in this story is that the researcher did not stop there. A token is only useful for what it lets you do, so the next question was: what can this token actually do?

While testing the API with the token, the researcher found a campaign invitation endpoint. An endpoint, remember, is one address in the API that performs one job. This one's job was to invite someone into a campaign: the caller could specify the user's campaign and invite an email address with a specific role. In everyday terms, it is the "invite a colleague" button of the workspace, except reachable through the API.

Inviting people is a normal feature. The question that matters for security is not whether you can invite someone, but who you are allowed to invite and with what role. If any member can invite a new person as owner, then any member can, in two steps, become the owner of the workspace.

The takeover

The researcher tested whether the invitation endpoint would accept the attacker's own account with the OWNER role. OWNER here is the role the researcher assigned to their own account in the invitation. The endpoint accepted it.

So the researcher accepted the invitation from their own account, which made that account a member of the victim's campaign with owner rights, and then removed the legitimate user from the campaign. The real owner was out, and the attacker was in charge.

The complete chain, as the researcher drew it, was:

Text
Victim Email     ↓API Access Bypass     ↓Username + Password     ↓2FA Bypass     ↓API Token     ↓Invite Attacker as OWNER     ↓Remove Victim     ↓Campaign Takeover 🚨

Read it top to bottom, one arrow at a time:

  1. Victim Email: the only thing needed to start is the victim's email address.
  2. API Access Bypass: that address is enough to be granted API access, skipping the documented request process.
  3. Username + Password: with API access, the attacker supplies the victim's credentials.
  4. 2FA Bypass: the token flow does not ask for the second factor, so the password alone suffices.
  5. API Token: the attacker now holds a token that speaks for the victim.
  6. Invite Attacker as OWNER: using that token, the attacker invites their own account into the victim's campaign with the highest role.
  7. Remove Victim: the attacker accepts the invitation and removes the real user.
  8. Campaign Takeover: the campaign now belongs to the attacker.
From the original on medium.com

The value came from following the access gained and checking which privileged actions it allowed.

Why the researcher found this interesting

The researcher is explicit that the interesting part was not just the 2FA bypass. Had the work stopped after getting the API token, the bigger impact would have been missed. The important thing was following the access gained and checking what privileged actions it made possible.

The advice the researcher offers to other testers is:

Don't stop when you find the bypass. Follow the chain and see where it can actually take you.

In this case, a combination of multiple weaknesses turned an API access issue into a full campaign takeover. Stacked together, they add up to losing control of a workspace.

What was actually wrong

Two weaknesses combined, and the report frames them as design or logic mistakes rather than memory-safety or injection bugs. In plain terms, nobody wrote broken code that crashes; the rules the code follows were simply too permissive.

  • The API access request flow on the separate subdomain trusted an email address as sufficient proof of entitlement to API access.
  • The token issuance flow did not enforce 2FA, so a correct username and password were enough to receive a token.

The invitation endpoint accepted an invitation for the researcher's own account with the OWNER role. The report does not describe the server-side checks behind any of these steps, so the exact code-level cause is not stated.

Who could be hurt, and how badly

An attacker who knows a victim's email address, username and password could obtain API access, obtain an API token without passing 2FA, invite their own account into the victim's campaign as OWNER, accept the invitation, and remove the legitimate user. The result is a full campaign takeover.

The report does not state how many users or campaigns were affected, nor whether the issue was reported through a bounty programme.

What should change

Based on the weaknesses described, the controls that should be enforced are:

  1. Requiring proof of ownership of the email address before granting API access. In practice that means a confirmation step sent to that address, so that knowing an address is not the same as controlling it.
  2. Enforcing 2FA at token issuance as well as at interactive login. Every path that hands out a credential should ask the same questions as the login page.
  3. Restricting the roles an inviter can assign, so that a new invitee cannot be granted OWNER without appropriate authorisation.

Similar things worth testing

These are the variants the technical write-up suggests looking for, explained for someone new.

  1. Alternate API access request flows. Look for other subdomains or endpoints that grant API credentials on the basis of an email address alone. A positive result is API access being issued without any verification of the address. The lesson from this report is that side entrances often have weaker rules than the front door.
  2. Token endpoints that skip 2FA. Compare the interactive login flow with every token-issuing endpoint (API tokens, personal access tokens, refresh flows). A positive result is a token returned after only username and password. If the login page asks for a code and the token endpoint does not, that gap is the bug.
  3. Role assignment on invitation endpoints. Try inviting your own account with each privileged role the product supports. A positive result is an invitation accepted with a role above what the inviter should be able to grant. The question to ask is always: what is the most powerful role this button will let me hand out?
  4. Post-invitation actions. After accepting an invitation, test removal or demotion of existing members. A positive result is the legitimate owner being removed by the newly invited account. Being able to join is one thing; being able to evict the people already there is the takeover.
  5. Chaining beyond the first bypass. Whenever a control is bypassed, enumerate the privileged actions the resulting session or token can perform, as the researcher did here, rather than stopping at the bypass itself. A bypass is a key; the report is about what doors the key opened.

Glossary

  • API (Application Programming Interface): a set of addresses a program can call to use a service, as opposed to pages a human clicks.
  • Endpoint: one specific address in an API that performs one job, such as inviting a user.
  • Subdomain: a prefix on a domain name, like api.example.com under example.com, often running separate software with separate rules.
  • Token: a long random string issued after login that stands in for your credentials on later requests; whoever holds it is treated as you.
  • API token: a token issued specifically so a program can call an API without a human logging in each time.
  • Session cookie: a token stored by the browser and sent automatically with each request to the site.
  • 2FA (two-factor authentication): proving identity with two different kinds of evidence, typically a password plus a code from a device you hold.
  • 2FA bypass: any flaw that lets someone get past the second factor, including a path that never asks for it.
  • Authentication flow: the sequence of steps a system uses to decide who you are and to issue you a credential.
  • Privilege: a permission attached to a role, such as the right to remove members.
  • Privilege escalation: gaining permissions beyond those you were meant to have, usually by moving to a higher role.
  • Role: a named set of permissions in a shared workspace, such as member or OWNER.
  • OWNER: the highest role in a campaign, able to manage the campaign and its people.
  • Campaign: a shared workspace in the application where several users collaborate under assigned roles.
  • Campaign takeover: an attacker gaining control of someone else's campaign, here by joining as OWNER and removing the legitimate user.
  • Security boundary: a control the system relies on to separate what a user may and may not do.
  • Logic flaw: a weakness in the rules the code follows rather than in how the code is written, so nothing crashes but the wrong thing is allowed.
  • Bypass: getting around a control without breaking it, for example using a different path that does not apply the check.
  • Exploitation: the act of turning a weakness into a concrete result, such as a token or a takeover.
  • Impact: the real-world harm a weakness allows.
  • Root cause: the underlying reason a weakness exists.
  • Responsible disclosure: reporting a weakness privately and withholding identifying details, as this report does with the target's details.

Similar reports

View all

Same bug class and techniques, clearest first.

Account takeover

The lesson behind this report.

Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.