Skip to content
Access control Write-up Intermediate

Exploiting Two Endpoints to get Account Takeover

A group privilege system used a user hash to identify the acting admin, and swapping the admin's hash for a member's hash caused the application to treat the member as the admin, letting an attacker create a group with a victim and grant manipulated privileges that led to full account takeover. A second flaw let any group member with the add/remove privilege also change the group's privileges through the API.

Hritik Sharma Follow

Published on medium.com

Hritik Sharma

Hritik Sharma, 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 was a website, referred to here as example.com, in a private bug bounty program. The feature in scope was group creation. A group has a Group Admin and Group Members, and the admin can grant members a set of privileges. Those privileges included changing the admin's profile data such as name and email, adding users to the group, deleting users from the group, and changing the current privileges of the group, along with some other privileges. The author notes that the permission set was unusual, but it existed and was the surface that was tested.

Setup

The researcher had been invited to the private program. No tooling, versions or specific accounts are described beyond the roles involved: a Group Admin (referred to as A) and a Group Member (referred to as B). The work was done by intercepting requests made by the application while adding members and privileges to a group.

Finding it

While adding a member to the group, the researcher noticed an interesting parameter in the response. The parameter name is changed in the write-up, but its shape was:

Text
hash:A12B32…

The hash was a combination of letters and numbers belonging to the user who was being added to the group. When a privilege was then added to the group, the same hash parameter appeared in the request, but this time it belonged to the Admin of the group. The same hash parameter appeared in the privilege request, but this time it belonged to the Admin of the group.

Exploitation

Step 1: Capture the member hash

Add a member to the group and observe the response. The response contains the member's hash:

Text
hash:A12B32…

This value identifies the user being added, and it is the value that will later be substituted into a privilege request.

Step 2: Observe the privilege request

When any of the privileges described above is added to the group, the request carries the same hash parameter, but with the Admin's hash rather than the member's. The application therefore ties a privilege to a user through this hash.

Step 3: Swap the hash

Intercept the request that adds a privilege to the group and replace the admin's hash with the hash of a group member. The privilege is still added, but the application now interprets it as if the Group Member (B), whose hash was used, is the admin of the group. Concretely, if the privilege was to edit Admin A's profile, the manipulated privilege now enables the actual group admin A to edit that group member B's profile.

Step 4: Turn it into account takeover

Because the privilege set is broad, an attacker who creates a group and adds the victim to it can add these manipulated privileges to the group and thereby take over the victim's account completely. The author reports this as a P1.

Root cause

The privilege request carries a hash parameter, and swapping the admin's hash for a member's hash changed how the application interpreted the privilege. Swapping the admin's hash for a member's hash makes the server treat the member as the admin for the purposes of that privilege, inverting the direction of the permission. The write-up does not describe any server-side check on the hash; it only reports that the substituted request was accepted. The exact code path is not shown, so the mechanism is best described as likely: the hash is used as the identity of the privilege holder without being validated against the session.

Impact

With the first bug, an attacker who can create a group and add a victim to it can add manipulated privileges and take over the victim's account completely. The author rates this P1.

The second bug is a functionality flaw in the same program. One privilege allowed any group member to add or remove any group member except the admin. Once that permission was added to the group, any group member could not only add or remove members but also change the privileges of the group itself through the API. This attack requires the attacker to be a member of the group being attacked, and requires the admin to have added the privilege to add or remove group members. Because of those preconditions the author rates it P2, which he considers justified.

Fix

The write-up does not state what was changed.

Variants to test

  1. Look for opaque identifiers (hashes, IDs, UUIDs) in responses when adding a member to a resource, then check whether the same identifier appears in requests that grant permissions. Swap it for another user's identifier and see whether the permission is applied to the wrong party.
  2. On any group or team feature, create a group, add a second account, and try to grant a privilege using the second account's identifier. A positive result is a privilege that lets the second account act on the first account's profile, or vice versa.
  3. Test whether a member-level permission to add or remove members also allows changing group privileges through the API. A positive result is a member being able to modify the group's privilege set.
  4. Check whether the server validates that the identifier in a privilege request belongs to the authenticated admin. A positive result is acceptance of a request where the identifier belongs to a different user.

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

What happened, in plain words

A security researcher was invited to a private bug bounty program, where companies pay people to find security holes in their websites. One of the targets, a site we will call example.com, had a feature for creating groups. Each group has an admin (the person in charge) and members (the people who join). The admin can give members special permissions, called privileges. These privileges included things like changing the admin's name and email, adding or removing members, and changing what privileges the group has. The researcher thought this was an odd set of permissions, but it was there, so he tested it.

He found two separate bugs. The first let an attacker take over another person's account completely. The second let a group member do something they should not be able to do: change the group's privileges. This article explains both, step by step, for someone who has never done security testing before.

Background: what you need to know

Before we dive in, let's cover a few basic ideas.

  • Website feature: A group feature is like a club on a website. One person creates the club and becomes the admin. Others join as members. The admin can give members certain abilities, such as the ability to edit the admin's profile or to invite others.
  • Request and response: When you click something on a website, your browser sends a message to the website's server (a request) and the server sends back a message (a response). Think of it like ordering food: you tell the waiter what you want (request), and the waiter brings your food (response).
  • API: An API (Application Programming Interface) is a way for software to talk to other software. In a website, your browser uses APIs behind the scenes to fetch data and perform actions. When you click a button, your browser might send an API request to the server. The server then does something and sends back a response. APIs often use formats like JSON to structure data.
  • Parameter: A parameter is a piece of information included in a request or response. For example, when you search for something, the search term is a parameter. In the group feature, parameters might include the user's ID, the group ID, and so on.
  • Hash: In this context, a hash is a short string of letters and numbers that identifies a user. It's like a username but harder to guess. The website uses it to refer to a specific user without exposing their real ID. It's not a cryptographic hash in the security sense; it's just an identifier.
  • Intercepting a request: This means catching a request before it reaches the server, so you can look at it and change it. Security researchers use tools like browser developer tools or proxy software (e.g. Burp Suite) to do this. You don't need to know how to use them to understand the article; just know that it lets you see and modify the messages between your browser and the server.
  • Privilege escalation: This is when someone gains access or abilities they shouldn't have. For example, a normal member acting like an admin. It's like a regular employee finding a way to use the boss's computer.
  • Account takeover: This is when an attacker gains full control of someone else's account. They can read messages, change settings, or do anything the real owner could do. It's like someone stealing your house keys and having full access to your home.
  • P1 and P2: These are priority levels used in bug bounty programs. P1 is the highest priority (most severe), and P2 is the next level down. They indicate how serious the bug is and how quickly it should be fixed.

The setup

The researcher was taking part in a private bug bounty program. That means he was invited to test a specific set of websites, and the details are not public. The website in question, example.com, had a group creation feature. A group has an admin (let's call him A) and members (one of them we'll call B). The admin can assign privileges to members. The privileges included:

  • Changing the admin's profile data (name and email)
  • Adding users to the group
  • Deleting users from the group
  • Changing the current privileges of the group
  • Some other privileges

The researcher found this set of permissions unusual, but it existed, so he decided to test it for privilege escalation.

Finding the first bug

Step 1: Notice the hash when adding a member

The researcher started by adding a member to the group. When he did that, he looked at the response from the server. In the response, he saw a parameter that looked like this (the name is changed for anonymity):

Text
hash:A12B32…

This hash is a combination of letters and numbers that belongs to the user who was being added to the group. In other words, the server tells you the new member's identifier. That's interesting because it gives you a way to refer to that user in later requests.

Step 2: See the same hash in privilege requests

Next, the researcher added a privilege to the group. When he intercepted that request, he saw that the same hash parameter was used, but this time it was the hash of the admin (A), not the member. So the application uses this hash to say who the privilege is for. In a normal flow, when the admin grants a privilege, the request includes the admin's hash, meaning "I, the admin, am giving this privilege."

Step 3: Swap the hash

The researcher then intercepted the request to add a privilege and replaced the admin's hash with the hash of a group member (B). He sent the modified request. The server accepted it and added the privilege. But something unexpected happened: the application now treated the privilege as if the member (B) were the admin. For example, if the privilege was "edit admin's profile", after the swap, the actual admin (A) could edit the member's (B) profile. In other words, the direction of the permission was reversed: instead of the admin being able to edit the member, the member could edit the admin. That's a privilege escalation.

Step 4: Turn it into account takeover

Because the set of privileges was broad, the researcher realised he could take over an account completely. Here's how: an attacker creates a group and adds the victim to it. Then the attacker uses the manipulated privileges (by swapping hashes) to edit the victim's profile, including changing the victim's email. That would let the attacker log in as the victim and take over the account. The researcher reported this as a P1 (high severity).

The second bug

While exploring the same program, the researcher found another bug, this time a logic flaw. One of the privileges allowed any group member to add or remove other group members, except the admin. That seems fine: a member can manage the member list but cannot touch the admin. However, the implementation was flawed. Once that permission was added to the group, any group member could not only add or remove members but also change the privileges of the group itself through the API. That means a member could give themselves more privileges, or remove privileges from others, which they should not be able to do.

This attack requires two things: the attacker must be a member of the group, and the admin must have added the privilege to add or remove members. Because of these preconditions, the researcher rated it P2 (medium severity), which he considered fair.

Why it worked

The first bug worked because the server trusted the hash supplied by the client (the browser) to decide whose privilege it was. The server accepted the swapped hash, so the application treated the member as the admin for that privilege. So by swapping the hash, the attacker could make the server think a member was the admin. In security terms, this is a broken authorization vulnerability: the server fails to verify that the user is allowed to perform the action.

The second bug was a functionality bug: once the permission to add or remove members was added, any group member could also change the group's privileges through the API. This is also a form of privilege escalation, but it requires the attacker to already be a member and the admin to have granted that specific permission.

How to fix it

The write-up does not say what the company did to fix the bugs. But the implied fix for the first bug is to stop trusting the client-supplied hash. Instead, the server should determine the acting user from the authenticated session (for example, from a session cookie or token) and use that to decide whose privileges are being changed. That way, a member's hash cannot be used to impersonate the admin.

What you can learn

The researcher's main takeaway: even if you find a high-severity bug, keep looking. You might find another one. Also, always test whether the server trusts data that comes from the client. If it does, you can often manipulate that data to do things you shouldn't.

Glossary

  • API: A set of rules that lets different software talk to each other. In a website, it's how your browser communicates with the server behind the scenes.
  • Account takeover: When an attacker gains full control of someone else's account, often by changing their password or email.
  • Broken authorization: A security flaw where the server does not properly check whether a user is allowed to perform an action.
  • Bug bounty program: A program where organisations reward security researchers for finding and reporting vulnerabilities in their systems.
  • Group admin: The person who manages a group and can assign privileges to members.
  • Group member: A person who belongs to a group but has limited permissions.
  • Hash: In this context, a short string of letters and numbers that identifies a user. It's like a user ID but less predictable.
  • Intercept: To capture a request or response between the browser and server, often to inspect or modify it.
  • P1/P2: Priority levels for vulnerabilities. P1 is the highest severity, P2 is medium.
  • Parameter: A piece of data sent in a request or response, like a name or an ID.
  • Privilege: A permission to perform a specific action, such as editing a profile or adding members.
  • Privilege escalation: Gaining access or abilities that you are not supposed to have, such as a member acting like an admin.
  • Request: A message sent from a client (like a browser) to a server asking for something.
  • Response: A message sent from a server back to a client, often containing the requested data or a confirmation.
  • Session: A period of interaction between a user and a website, often tracked by a cookie or token so the server remembers who you are.
  • Token: A piece of data (like a string) that proves your identity or grants access, often used in authentication.

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.