Skip to content
IDOR Write-up Beginner

All About Getting First Bounty with IDOR

The application allowed a user to mention only the author of a post, but by changing the user ID in the request, any user could be mentioned and notified. In a group join feature, changing the access code allowed joining any group and seeing its name, description, and owner details.

Mukul Trivedi Follow

Published on medium.com

{{media:0}}

Mukul Trivedi (M0hn1sh), 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. 6 min read.

Context

In April 2020 I started reading about and practising IDOR (Insecure Direct Object Reference). For the first few days it looked hard to find, so I went back to practice labs to get a wider idea of the vulnerability and the ways it can be exploited. I practised on DVWA, bWAPP and Portswigger Academy.

The definition I worked from is OWASP's:

"Insecure Direct Object References occur when an application provides direct access to objects based on user-supplied input. As a result of this vulnerability attackers can bypass authorization and access resources in the system directly, for example database records or files. Insecure Direct Object References allow attackers to bypass authorization and access resources directly by modifying the value of a parameter used to directly point to an object. Such resources can be database entries belonging to other users, files in the system, and more."

This write-up covers a few scenarios I reported to a program. The program is not named, and the report does not give the site, the endpoints or the versions of anything involved. What it does give is the shape of each request and the reasoning behind each change.

Mukul Trivedi (M0hn1sh)
Mukul Trivedi (M0hn1sh) From the original on medium.com

Setup

I created three users on the website, User_1, User_2 and User_3, all with the same role and permission. That is the whole precondition: three ordinary accounts at the same privilege level, and a proxy to capture and edit requests. The report does not name the proxy, but the requests were captured in Burp.

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

Finding it

Both bugs came out of ordinary features that reference objects by an identifier the client sends back. In the first, a comment can mention the author of the post; in the second, a group can be joined with a code. In each case the identifier in the request was sent by the client, and changing it changed which object the server acted on.

Exploitation

Scenario 1: mentioning any user in a comment

The functionality: a user creates a post, and other users can like, comment on and share that post on their profile. While checking it I noticed that a user can only mention the author of the post in a comment, and the mentioned person receives a notification of it.

  1. User_1 created a post.
  2. When User_2 commented on that post, I noticed I could mention only the author of the post, which in this case is User_1.
  3. I captured the comment request (the comment being Please check @User_1) in Burp. The JSON data was passing like this:
JSON
{"text":"Please check @[User_1 name]","mentions":[{"uid":"random 9 digits","key":"User_1 name"}],"message_id":random 9 digits}
  1. In that JSON, uid is the identifier of User_1. By visiting the profile of User_3 and doing "inspect element" on the profile picture of User_3, I could get the uid of User_3.
  2. So in the JSON data I changed the User_1 name to the User_3 name in both values, and replaced the uid of User_1 with the uid of User_3.
  3. Finally I was able to mention any other user in that post, and the mentioned user received the notification of it.

The program rewarded me for this bug, and it was my first ever bounty.

Scenario 2: joining any group with a guessed code

The functionality: a user can either join a group or create a group. After creating a group, the user gets a group_code which they can share with other users, and a referred user is added to the group without approval of the owner of the group.

  1. User_1 selected "Create a group". After giving a name and adding a description to the group, User_1 got a refer_code for the group, a random 6 words, for example pgytsd.
  2. User_2 selected "Join a group" and entered pgytsd in the code, and I captured this request.
  3. In the "Join a group" request the JSON data was passing like below:
JSON
{"membership":{"access_code":"pgytsd"}}
  1. I just needed to change or bruteforce the access_code.
  2. After changing the group code I was getting added into any user's group. In the Burp response, User_2 was also able to see the name and description of that group, and the name and uid of the owner of that group.

Another IDOR, and again I was rewarded for this bug.

Root cause

The server took the object reference straight from the request body and acted on it without checking that the caller was entitled to that object. In the comment feature, the mentions array carries a uid and a display key; the client is trusted to send the right pair, and the server notifies whatever uid it receives. The UI restriction, that only the post author can be mentioned, exists only in the client, so editing the JSON removes it.

In the group feature, access_code is the only thing that decides which group a user joins. The example code is six characters, and changing it added User_2 to another user's group. The response then leaks the group name, description and the owner's name and uid.

In both cases the missing control is an authorisation check on the server side, tying the requested object to the authenticated user.

Impact

With the comment bug, an attacker can mention any user in a comment on a post, and the mentioned user receives a notification. The attacker can mention any other user in the post, and the mentioned user receives a notification.

With the group bug, an attacker can join any group whose code they know or guess, without the owner's approval, and learns the group's name and description plus the owner's name and uid.

Fix

The control that should be added is a server-side authorisation check on both requests: verify that the uid in mentions refers to a user the caller is allowed to mention in that context, and verify that the caller is entitled to join the group referenced by access_code, rather than treating a valid code as sufficient. For the group code, a longer, unguessable value and rate limiting on join attempts would reduce the brute-force surface.

Variants to test

  1. Mention and notification fields. On any feature that sends a notification, capture the request and look for an identifier of the recipient. Replace it with the identifier of a second account you control. A positive result is a notification arriving at the second account, or the first account's name appearing in a context it should not.
  2. Identifiers exposed in the page. Inspect profile pages, avatars and other public elements for identifiers in the HTML, then use them in requests where the UI only offers a restricted set of choices. A positive result is the server accepting an identifier the UI never offered.
  3. Join, invite and referral codes. Capture the request that submits a code and try a code belonging to a group you created with a different account, then a modified or guessed one. A positive result is being added to a group you were not invited to, or the response disclosing the group's name, description or owner details.
  4. Short codes. Where a code is short, test a small number of guesses and watch for differences between a valid and invalid code in the response. A positive result is a valid code being found, or the response revealing whether a code exists.

References

The write-ups and mindmap I followed, plus the Burp extensions Autorize and Auto Repeater, are linked in the original post. There is also a video by STÖK explaining how to use Autorize and Auto Repeater. Thanks to Pratyush Anjan Sarangi and Ninad Mathpati for helping and guiding me.

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

In April 2020 I started reading about and practising a class of bug called IDOR, which stands for Insecure Direct Object Reference. For the first few days it looked hard to find. So I went back to practice labs to get a wider idea of the vulnerability and the ways it can be exploited. I practised on DVWA, bWAPP and Portswigger Academy.

Before going further, it helps to know what an IDOR actually is. Most websites store things for you: your posts, your profile, your group memberships. Each of those things has a name inside the system, an identifier, so the site can tell them apart. When your browser asks the site for one of those things, it usually sends that identifier along. An IDOR happens when the site takes the identifier from the request and hands back whatever it points to, without first checking that the person asking is allowed to have it. It is like a hotel reception that gives out a room key to anyone who says a room number, without checking whether the person is a guest of that room.

The definition I worked from is OWASP's:

"Insecure Direct Object References occur when an application provides direct access to objects based on user-supplied input. As a result of this vulnerability attackers can bypass authorization and access resources in the system directly, for example database records or files. Insecure Direct Object References allow attackers to bypass authorization and access resources directly by modifying the value of a parameter used to directly point to an object. Such resources can be database entries belonging to other users, files in the system, and more."

In plain words: the site trusts a value that the visitor's browser sends, and that value decides which record, file or account the site acts on. Change the value, and you change whose record the site acts on.

This write-up covers a few scenarios I reported to a program. The program is not named, and the report does not give the site, the endpoints or the versions of anything involved. What it does give is the shape of each request and the reasoning behind each change.

Mukul Trivedi (M0hn1sh)
Mukul Trivedi (M0hn1sh) From the original on medium.com

Setup

I created three users on the website, User_1, User_2 and User_3, all with the same role and permission. That is the whole precondition: three ordinary accounts at the same privilege level, and a proxy to capture and edit requests. A proxy here means a tool that sits between your browser and the website, so you can see the exact message the browser sends and change it before it goes out. The report does not name the proxy, but the requests were captured in Burp, a well-known tool of that kind.

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

Finding it

Both bugs came out of ordinary features that reference objects by an identifier the client sends back. In the first, a comment can mention the author of the post; in the second, a group can be joined with a code. In each case the identifier in the request was trusted by the server, and the only thing standing between one user and another user's object was the value the client chose to send.

A word on the request itself. When you fill in a form and press a button, your browser sends a message to the website. Modern sites often send that message as JSON, a text format that looks like a list of labelled values, for example {"name":"value"}. The site reads the labels and acts on the values. If the site does not re-check those values against who you are, you can edit them in the proxy before they arrive.

Exploitation

Scenario 1: mentioning any user in a comment

The functionality: a user creates a post, and other users can like, comment on and share that post on their profile. While checking it I noticed that a user can only mention the author of the post in a comment, and the mentioned person receives a notification of it. A mention is when you type someone's name in a comment and the site turns it into a link to their profile, and a notification is the little alert that person gets telling them they were mentioned.

  1. User_1 created a post.
  2. When User_2 commented on that post, I noticed I could mention only the author of the post, which in this case is User_1.
  3. I captured the comment request (the comment being Please check @User_1) in Burp. The JSON data was passing like this:
JSON
{"text":"Please check @[User_1 name]","mentions":[{"uid":"random 9 digits","key":"User_1 name"}],"message_id":random 9 digits}

Line by line, in plain words:

  • "text" is the visible comment. Please check @[User_1 name] is what the reader sees, with the mention written out.
  • "mentions" is a list (the square brackets) of the people being mentioned. Here the list has one entry.
  • Inside that entry, "uid" is the user identifier, a number the site uses internally to know exactly which account is meant. The report shows it as a random 9 digit value.
  • "key" is the display name, the human-readable label shown next to the mention.
  • "message_id" is the identifier of the comment itself, also shown as a random 9 digit value.

Why this matters: the browser sends both the uid and the key, and the server appears to trust them. The rule that only the post author can be mentioned is enforced by the page you see, not by the server.

  1. In that JSON, uid is the identifier of User_1. By visiting the profile of User_3 and doing "inspect element" on the profile picture of User_3, I could get the uid of User_3.

"Inspect element" is a feature built into every browser: right-click on part of a page and choose it, and the browser shows you the underlying HTML, the code that describes the page. Inspecting the profile picture showed the uid of that user. This is how I learned User_3's identifier without needing any special access.

  1. So in the JSON data I changed the User_1 name to the User_3 name in both values, and replaced the uid of User_1 with the uid of User_3.

  2. Finally I was able to mention any other user in that post, and the mentioned user received the notification of it.

The program rewarded me for this bug, and it was my first ever bounty.

Scenario 2: joining any group with a guessed code

The functionality: a user can either join a group or create a group. After creating a group, the user gets a group_code which they can share with other users, and a referred user is added to the group without approval of the owner of the group. Think of the code as an invitation link in text form: whoever has it can walk in.

  1. User_1 selected "Create a group". After giving a name and adding a description to the group, User_1 got a refer_code for the group, a random 6 words, for example pgytsd.
  2. User_2 selected "Join a group" and entered pgytsd in the code, and I captured this request.
  3. In the "Join a group" request the JSON data was passing like below:
JSON
{"membership":{"access_code":"pgytsd"}}

Line by line:

  • "membership" is the outer label: this request is about a membership, meaning joining a group.
  • Inside it, "access_code" is the code that decides which group you join. Its value here is pgytsd, the code User_1 shared.

There is nothing else in the request that says which group is meant. The code alone is the whole decision.

  1. I just needed to change or bruteforce the access_code.

Bruteforce means trying many values in a row, usually with a tool, until one works. The example code is six characters, and the report says the code could be changed or bruteforced.

  1. After changing the group code I was getting added into any user's group. In the Burp response, User_2 was also able to see the name and description of that group, and the name and uid of the owner of that group.

The response is the message the website sends back. The response also showed the name and description of that group, and the name and uid of its owner.

Another IDOR, and again I was rewarded for this bug.

Root cause

The server took the object reference straight from the request body and acted on it without checking that the caller was entitled to that object. In the comment feature, the mentions array carries a uid and a display key; the client is trusted to send the right pair, and the server notifies whatever uid it receives. The UI restriction, that only the post author can be mentioned, exists only in the client, so editing the JSON removes it.

In the group feature, access_code is the only thing that decides which group a user joins. The example code is six characters, and changing it added User_2 to another user's group. The response then leaks the group name, description and the owner's name and uid.

In both cases the missing control is an authorisation check on the server side, tying the requested object to the authenticated user.

Impact

With the comment bug, an attacker can mention any user in a comment on a post, and the mentioned user receives a notification. The attacker can mention any other user in the post, and the mentioned user receives a notification.

With the group bug, an attacker can join any group whose code they know or guess, without the owner's approval, and learns the group's name and description plus the owner's name and uid.

Fix

The control that should be added is a server-side authorisation check on both requests: verify that the uid in mentions refers to a user the caller is allowed to mention in that context, and verify that the caller is entitled to join the group referenced by access_code, rather than treating a valid code as sufficient. For the group code, a longer, unguessable value and rate limiting on join attempts would reduce the brute-force surface.

Variants to test

  1. Mention and notification fields. On any feature that sends a notification, capture the request and look for an identifier of the recipient. Replace it with the identifier of a second account you control. A positive result is a notification arriving at the second account, or the first account's name appearing in a context it should not.
  2. Identifiers exposed in the page. Inspect profile pages, avatars and other public elements for identifiers in the HTML, then use them in requests where the UI only offers a restricted set of choices. A positive result is the server accepting an identifier the UI never offered.
  3. Join, invite and referral codes. Capture the request that submits a code and try a code belonging to a group you created with a different account, then a modified or guessed one. A positive result is being added to a group you were not invited to, or the response disclosing the group's name, description or owner details.
  4. Short codes. Where a code is short, test a small number of guesses and watch for differences between a valid and invalid code in the response. A positive result is a valid code being found, or the response revealing whether a code exists.

References

The write-ups and mindmap I followed, plus the Burp extensions Autorize and Auto Repeater, are linked in the original post. There is also a video by STÖK explaining how to use Autorize and Auto Repeater. Thanks to Pratyush Anjan Sarangi and Ninad Mathpati for helping and guiding me.

Glossary

  • IDOR (Insecure Direct Object Reference): a bug where a site acts on an identifier sent by the browser without checking that the person asking is allowed to have that object.
  • Object: any record the site keeps, such as a post, a comment, a profile or a group.
  • Identifier (uid): the internal number or string the site uses to point at one specific object or account.
  • JSON: a text format for sending labelled values between a browser and a website, written with curly braces and quotes.
  • Request: the message your browser sends to a website when you click, submit or load something.
  • Response: the message the website sends back.
  • Proxy: a tool that sits between your browser and the site so you can read and edit requests before they are sent.
  • Burp: a widely used proxy tool for capturing and replaying web requests.
  • Endpoint: the specific address on a website that a request is sent to.
  • Parameter: a named value inside a request, such as uid or access_code.
  • Mention: a link to a user written inside a comment, which usually triggers a notification.
  • Notification: the alert a user receives when something involving them happens on the site.
  • Inspect element: a browser feature that shows the HTML behind any part of a page.
  • HTML: the code that describes what a web page contains.
  • Bruteforce: trying many possible values automatically until one is accepted.
  • Rate limiting: a server rule that slows down or blocks repeated attempts, making guessing impractical.
  • Authorisation check: a server-side test that the person making a request is allowed to do what they are asking.
  • Client and server: the client is your browser; the server is the computer that runs the website and answers requests.
  • UI (user interface): the part of the site you see and click, as opposed to what happens behind it.
  • Practice lab: a deliberately vulnerable website built for learning, such as DVWA, bWAPP or Portswigger Academy.
  • Bounty: a reward a company pays to someone who reports a security bug to it.

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.