Skip to content
IDOR Write-up Intermediate

Duplicate but still cool

An IDOR in the resend invitation endpoint let an attacker enumerate invitation IDs and see the invited email addresses of other companies. By registering an account with one of those emails and changing the resend_invitation path to join in the invitation link, the attacker could join the inviting company, leading to account takeover.

Plenum Follow

Published on medium.com

{{media:0}}

Plenum, 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. 5 min read.

Context

This is a story about a private program on HackerOne. The company, referred to here as redacted.com, provided CRM services. Users could sign up as an organisation and then invite team members, either with an admin role or a basic user role. The invitation flow itself looked solid at first: the invitation link carried a 32-byte alphanumeric token, which the researcher judged impossible to brute force, and the CSRF token was checked properly. The bugs came from elsewhere in the invitation management features.

Plenum
Plenum From the original on medium.com

The write-up was published on 5 November 2018 and describes a chain that starts as a low-impact information disclosure and ends in account takeover. The report was closed as a duplicate.

Setup

The researcher worked against a private HackerOne program, so the real hostnames and identifiers are replaced with placeholders such as bugbounty.redacted.com and redacted.com. The testing involved:

  1. An organisation account on redacted.com, with the admin role needed to view and resend pending invitations.
  2. The ability to create multiple invitations, which was used to observe how invitation identifiers behave.
  3. An intercepting proxy and an Intruder-style tool to increment and decrement the invitation id.
  4. A separate signup on redacted.com, used to reach the page shown to a freshly registered user who has been invited.

No versions or specific tooling beyond that are given.

Finding it

The invitation process was checked and appeared correct: the invitation link contained a 32-byte alphanumeric token, and the CSRF token was validated. The first weakness was found in the resend invitation feature. An admin could view pending invitations and resend them. The resend request looked like this:

HTTP
POST /invitations/363484/resend HTTP/1.1
Host: bugbounty.redacted.com
Authorization: Bearer base64 token

The JSON response contained the invited email address:

JSON
{"status":"success","email":"[redacted]"}

The problem was the invitation id in the path. Changing it returned the sent invitations of other companies registered to redacted.com. After creating several invites, the researcher noticed that the invitation id increments, which confirmed that no brute force was needed: an Intruder run that increments or decrements the id is enough to disclose invited email addresses belonging to other organisations. On its own this is not very important, because the response exposes nothing beyond the email address.

Exploitation

Step 1: enumerate invitation ids

Using the resend endpoint with a modified id, the researcher walked the id space and collected the email addresses reflected in the JSON responses. The incrementing ids made this a simple sequential enumeration rather than a guessing problem.

Step 2: register with a disclosed email

The researcher took an email address reflected in the response and registered an account on redacted.com with it. After signup, the user was redirected to an HTML page saying:

Text
Company X has invited you to join them, please use the link in the e-mail.
Click on resend invitation to receive the email again

That page contained a resend invitation link of the form:

Text
https://www.redacted.com/resend_invitation/TOKEN

Step 3: compare the two link forms

The email that arrived contained the same link except for the path segment: instead of resend_invitation it used join, so the emailed link looked like:

Text
https://www.redacted.com/join/TOKEN

Step 4: swap the path segment

The researcher went back to the browser tab, replaced resend_invitation with join in the URL, and was let in. The researcher replaced resend_invitation with join in the URL and got in.

Image for post
Image for post From the original on medium.com

Root cause

Two separate mistakes combine here.

  1. The resend endpoint authorises the action on the invitation id alone, without checking that the invitation belongs to the organisation of the authenticated admin. That is a classic IDOR, and because ids are sequential, the whole set of invitations is enumerable.
  2. The page shown to an invited user contained a resend_invitation link, while the emailed link used join with the same token. The token appeared in both the resend_invitation link and the emailed join link.

The defences that did exist, the 32-byte alphanumeric token and the CSRF check, were not the weak points. The token was strong enough that brute force was never an option, and CSRF protection does not help when the attacker is an authenticated user acting on their own session. The missing piece was object-level authorisation on the resend endpoint.

Impact

An attacker could take over arbitrary accounts by chaining the two issues: enumerate invitation ids to harvest invited email addresses, sign up with one of those addresses, then swap resend_invitation for join in the URL and get in. The researcher describes this as account takeover of arbitrary accounts, with the precondition that the target email appears in the JSON response of the resend endpoint and that the attacker can register with it. The first bug alone only discloses invited email addresses of other companies.

Fix

The report does not describe what the vendor changed. Based on the root cause, the resend endpoint should check that the invitation belongs to the authenticated admin's organisation before returning anything, and the invitation token should be bound to a single action.

Variants to test

  1. Sequential object ids on state-changing endpoints. Take any endpoint that acts on an object by id, such as resend, cancel or view, and increment or decrement the id with an authenticated low-privilege account. A positive result is a response containing another organisation's data or a successful action on another organisation's object.
  2. Token reuse across paths. Where an invitation or reset flow exposes a token on one path, try the same token on sibling paths such as join, accept or confirm. A positive result is the action completing on a path it was not issued for.
  3. Email reflection plus open signup. Check whether any endpoint reflects an invited email address, then register with that address and walk the invitation flow. A positive result is reaching the organisation without access to the mailbox.
  4. Role boundaries on admin features. Repeat the resend and view actions with a basic user role. A positive result is a basic user reaching admin-only invitation data.

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 was testing a private bug bounty program on HackerOne. The company behind the program is called redacted.com here, and it sold CRM software. CRM stands for customer relationship management: software a business uses to keep track of its customers, contacts and sales. Think of it as a shared address book and filing cabinet that a whole company logs into.

On redacted.com, a person could sign up and create an organisation, which is like opening a workspace for their company. The person who creates it becomes an admin, meaning they have extra powers, such as managing who else is allowed in. The admin could then invite team members by email, giving each one either the admin role or a basic user role. The invited person receives an email with a link, clicks it, and joins the organisation.

The researcher checked that invitation process and it looked well built. The link in the email contained a long random string of letters and numbers, called a token. A token is like a temporary key: whoever holds it can prove they are the person the email was sent to. This one was 32 bytes of alphanumeric characters, which is far too long to guess. The forms also carried a CSRF token, a hidden value that stops another website from silently submitting forms on your behalf. Both defences were in place.

The bugs were somewhere else: in the screens an admin uses to manage invitations that are still pending. The story starts with a small information leak and ends with an attacker being able to take over other people's accounts. The report was eventually closed as a duplicate, meaning someone else had already reported the same issue, but the researcher still thought it was a cool bug.

Plenum
Plenum From the original on medium.com

The write-up was published on 5 November 2018.

The setup

Because the program was private, the real website names and numbers are hidden behind placeholders. redacted.com stands for the company's real domain, and bugbounty.redacted.com stands for the part of the site where the bug bounty testing happened. A domain is just the name of a website, the part after www. or https://.

To test, the researcher needed:

  1. An organisation account on redacted.com with the admin role, because only an admin can see and resend pending invitations.
  2. The ability to create several invitations, so they could watch how the invitation numbers behave.
  3. A tool that sits between the browser and the website and lets you read and change every request before it is sent. Security testers call this an intercepting proxy. They also used an Intruder-style tool, which is a feature that automatically repeats one request many times while swapping in a different value each time, for example counting the invitation number up or down.
  4. A second signup on redacted.com, to see the page that a brand new user sees when they have been invited.

The report does not name any software versions or specific products beyond that.

Finding the first bug

First, a quick word on how websites talk to browsers. When you click something, your browser sends a request to the website's server, the computer that runs the site. The server sends back a response, often in a format called JSON, which is just structured text that programs can read easily, a bit like a very tidy form with labels and values.

Some requests also carry an authorisation header. A header is extra information attached to a request, like the label on a parcel. Authorization: Bearer ... means "here is my proof of who I am", and the value after it is a token that the server issued when the user logged in. It works like a wristband at an event: show it and you are let in without showing your ID again.

The invitation process looked correct. The invitation link had a 32-byte alphanumeric token, which the researcher judged impossible to brute force. Brute force means trying every possible value until one works; with a token that long, that would take an impractical amount of time. The CSRF token was checked properly too.

The first weakness was in the resend invitation feature. An admin could look at invitations that were still pending and could resend them, which sends the invitation email again. The request to resend looked like this:

HTTP
POST /invitations/363484/resend HTTP/1.1
Host: bugbounty.redacted.com
Authorization: Bearer base64 token

Line by line:

  • POST /invitations/363484/resend HTTP/1.1 is the request line. POST is the method, meaning "I am sending data and asking you to do something". The path /invitations/363484/resend says which invitation to act on: number 363484, and the action is resend. HTTP/1.1 is the version of the web protocol being used.
  • Host: bugbounty.redacted.com tells the server which website the request is for. One server can host many sites, so this is how it knows which one you mean.
  • Authorization: Bearer base64 token is the proof of identity. base64 is a way of encoding data as text so it can travel safely in a header, and token is a placeholder for the real value, which is not shown here.

The server's reply was JSON and contained the email address of the person who had been invited:

JSON
{"status":"success","email":"[redacted]"}

This is a small object with two labels. status says the resend worked, and email gives the address the invitation was sent to. [redacted] is a placeholder address, not a real one.

The problem was the number in the path, 363484. That number is an identifier, or id: a unique label the website gives each invitation so it can tell them apart, like a ticket number. The server used the id to find the invitation but never checked that the invitation belonged to the organisation of the admin making the request. So if you changed the id, the server happily returned invitations sent by other companies that also used redacted.com.

After creating several invitations, the researcher noticed that the ids go up by one each time. That matters a lot. If ids were random, an attacker would have to guess; because they count upwards, an attacker can simply walk through them one by one. The researcher confirmed that no brute force was needed: an Intruder run that increments or decrements the id is enough to reveal invited email addresses belonging to other organisations.

On its own this is not very serious, because the response shows nothing except the email address. But it becomes the first link in a chain.

Turning the leak into a break-in

Step 1: walk through the invitation ids

Using the resend request with a changed id, the researcher moved through the id space and collected the email addresses that came back in the JSON responses. Because the ids increase by one, this is a simple sequential walk rather than a guessing game. Think of it like trying every room number in a hotel corridor instead of guessing which key opens which door.

Step 2: register with a leaked email address

The researcher took one of the email addresses that appeared in a response and signed up for an account on redacted.com using it. After signing up, the new user was sent to an HTML page, a normal web page, that said:

Text
Company X has invited you to join them, please use the link in the e-mail.
Click on resend invitation to receive the email again

This page is shown to someone who has been invited but has not yet joined. It tells them to use the link in their email, and offers a button to resend that email in case it never arrived. That page contained a resend invitation link of this form:

Text
https://www.redacted.com/resend_invitation/TOKEN

Breaking it down: https:// is the secure web protocol, www.redacted.com is the site, /resend_invitation/ is the path that triggers a new invitation email, and TOKEN is the long random string that identifies the invitation. The token is the key; the path is the door it opens.

Step 3: compare the two link forms

The email that arrived contained the same link except for one part of the path. Instead of resend_invitation it used join, so the emailed link looked like this:

Text
https://www.redacted.com/join/TOKEN

So the website had two doors, /resend_invitation/ and /join/, and the same key, the token, was printed on both. The researcher's question was simple: does the join door check that the key was meant for it?

Step 4: swap the path segment

The researcher went back to the browser tab, replaced resend_invitation with join in the URL, and was let in. The researcher replaced resend_invitation with join in the URL and got in.

Image for post
Image for post From the original on medium.com

Why it worked

Two separate mistakes combine here.

  1. The resend endpoint decides whether to act based only on the invitation id. It never checks that the invitation belongs to the organisation of the logged-in admin. This is a classic IDOR, which stands for Insecure Direct Object Reference: the website hands out a reference to an object, here the invitation id, and trusts it without checking whether the person asking is allowed to see that object. It is like a cloakroom that gives you a ticket and then hands over whatever coat the ticket number points to, without checking it is yours. And because the ids are sequential, every invitation can be walked through.
  2. The page shown to an invited user put the invitation token into a resend_invitation link, while the emailed link used join with the same token. The token appeared in both the resend_invitation link and the emailed join link.

The defences that did exist were not the weak points. The 32-byte alphanumeric token was strong enough that brute force was never an option, and CSRF protection does not help when the attacker is a logged-in user acting on their own session. A session is the period during which the website remembers who you are after you log in. The missing piece was object-level authorisation on the resend endpoint, meaning a check that this admin may touch this particular invitation.

What an attacker could do

An attacker could take over arbitrary accounts by chaining the two issues: walk the invitation ids to harvest invited email addresses, sign up with one of those addresses, then swap resend_invitation for join in the URL and get in. The researcher describes this as account takeover of arbitrary accounts. Account takeover means logging in as someone else, or in this case getting into their organisation, without their permission.

There is a precondition: the target email must appear in the JSON response of the resend endpoint, and the attacker must be able to register with it. The first bug alone only reveals invited email addresses of other companies.

How to fix it

The report does not describe what the vendor changed. Based on the root cause, the resend endpoint should check that the invitation belongs to the logged-in admin's organisation before returning anything, and the invitation token should be tied to a single action.

Variants to test

If you want to look for similar bugs yourself, here are four starting points.

  1. Sequential object ids on state-changing endpoints. Take any endpoint that acts on an object by id, such as resend, cancel or view, and increment or decrement the id with a logged-in low-privilege account. A positive result is a response containing another organisation's data, or a successful action on another organisation's object.
  2. Token reuse across paths. Where an invitation or password reset flow shows a token on one path, try the same token on sibling paths such as join, accept or confirm. A positive result is the action completing on a path it was not issued for.
  3. Email reflection plus open signup. Check whether any endpoint reflects an invited email address, then register with that address and walk the invitation flow. A positive result is reaching the organisation without access to the mailbox.
  4. Role boundaries on admin features. Repeat the resend and view actions with a basic user role. A positive result is a basic user reaching admin-only invitation data.

Glossary

  • API: the part of a website that accepts requests and returns data, usually in a structured format, so that programs can talk to it.
  • Account takeover: getting into someone else's account or organisation without their permission.
  • Admin: a user with extra powers, such as managing who can join an organisation.
  • Authorisation header: extra information attached to a request that proves who is making it, usually a token.
  • Base64: a way of encoding data as plain text so it can travel safely inside a header or URL.
  • Brute force: trying every possible value until one works.
  • CRM: customer relationship management software, used by a business to track customers, contacts and sales.
  • CSRF token: a hidden value in a form that stops another website from silently submitting that form on your behalf.
  • Domain: the name of a website, such as redacted.com.
  • Endpoint: a specific address on a website that performs one action, such as resending an invitation.
  • Header: extra information attached to a request or response, like the label on a parcel.
  • HTML: the language web pages are written in.
  • HTTP: the protocol browsers and servers use to exchange requests and responses.
  • IDOR: Insecure Direct Object Reference, where a website hands out a reference to an object, such as an id, and does not check whether the person asking is allowed to see it.
  • Identifier (id): a unique label a website gives each object so it can tell them apart, like a ticket number.
  • Intercepting proxy: a tool that sits between the browser and the website and lets you read and change requests before they are sent.
  • Intruder: a tool feature that repeats one request many times while swapping in a different value each time.
  • JSON: a structured text format for data, made of labels and values.
  • Path: the part of a URL after the domain that points to a particular page or action.
  • POST: an HTTP method meaning "I am sending data and asking you to do something".
  • Request: the message a browser sends to a server asking for something.
  • Response: the message a server sends back.
  • Role: the level of permission a user has, such as admin or basic user.
  • Session: the period during which a website remembers who you are after you log in.
  • Token: a long random string that acts like a temporary key, proving you are the person it was issued to.
  • URL: the full address of a page or action on a website.

More by Plenum

View all

5 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Insecure direct object reference (IDOR)

The lesson behind this report.

One user can read or change another user's data, usually by changing an identifier the server trusts without checking who is asking. One of the most paid bug classes on web programs.