IDOR to information disclosure + Admin Account Takeover
The profile endpoint accepted a user-supplied identifier and returned other users' personal data, and the password reset function trusted the same identifier, allowing an attacker to reset any user's password, including an admin's.
adityashende17.medium.com
Published on adityashende17.medium.com
Bug Bounty
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.
Context
This is a write-up by Aditya Shende (Kong), a bounty hunter and researcher from India, published on Medium on 13 July 2021. It describes a chained vulnerability on a web application: an insecure direct object reference (IDOR) that first disclosed user information and then, through the password reset function on the profile section, allowed an account takeover of an admin account.
The author defines IDOR in the article as follows: entity names are used to identify application-controlled resources that are supplied in URLs or request parameters in a Direct Object Reference web application design method.

The feature at the centre of the finding is the profile function, specifically the POST /Profile endpoint and the password reset function available in the profile section.
Setup
The author tested the application as a normal user, exercising every function available to that role: update, delete, download, make post public and private, and so on. No specific tools, versions or additional accounts are described in the report. The author tested the application as a normal user and replaced parameters in a POST request before forwarding it.
Finding it
While testing the normal-user functions, the author found many bugs, but focused on this one. The viewing profile function was the first target, and the POST parameters were the second. The endpoint involved is:
POST /Profile

The response disclosed enough information to be interesting, so the author tried it on their own account first. The next step was to manipulate the username parameter: by supplying another user's username, the response returned that user's information, including home address, role, number and access level.

At this point the author had a way to read other users' details, including home address, role, number and access level. The report marks the _id parameter as the important one: it leads to account takeover.
Exploitation
Step 1: information disclosure through the username parameter
The author sent a request to POST /Profile and changed the username parameter to another user's username. The response returned that user's information, including home address, role, number and access level. This gave the author a way to read other users' details.
Step 2: abusing the password reset function
The profile section contained a reset password function. The author's reasoning was that if the _id of any user is known, the password of that user can be reset. The reset request is a POST request containing _id and password:
POST /Profile
The report describes the request as containing _id and password; the exact body is not shown in the text. The author replaced their own id with another user's encrypted id and forwarded the request.

Step 3: confirming the reset
After forwarding the modified request, the response was 200 OK. The author notes that JSON context parameters have default responses such as true, verified, error and success. In this case the response came back with true.

Step 4: logging in as the victim
The author then tried to access the victim's account using the victim's username and the password that had just been set. The login worked, which led to an account takeover of an admin account. The author notes having multiple privileges that a normal user cannot access.

With access to the admin account, the author found multiple different functions to test. On that site the author reports finding more than 20 vulnerabilities in total.
Root cause
The password reset request accepted an _id supplied by the client, and replacing it with another user's id changed that user's password. The profile request returned another user's details when the username parameter was changed. The _id is described as encrypted, but replacing it with another user's encrypted id still reset that user's password.
Impact
An authenticated normal user can read other users' profile information, including home address, role, number and access level, by changing the username parameter. Using the disclosed _id, the same user can reset another account's password and log in as that user. In this case the victim was an admin, so the attacker obtained admin privileges and access to functions a normal user cannot reach. The report does not state how many accounts were affected or whether the issue was reported and fixed.
Fix
The report does not describe a fix. Based on the behaviour shown, the reset endpoint should derive the target account from the authenticated session rather than from a client-supplied _id, and the profile endpoint should only return the record belonging to the authenticated user, or enforce an authorisation check on the requested username. Object identifiers should be validated server-side against the current user's ownership before any read or write.
Variants to test
- Change the
usernameparameter on profile-style endpoints to another known username and look for a response containing that user's details (address, role, number, access level). - Take the
_iddisclosed by a profile response and submit it in a password reset or password change request, then attempt to log in with the new password. A200 OKwith atrue-style JSON body followed by a successful login confirms the issue. - Try the same object substitution on update, delete and download functions, which the author tested as a normal user.
- Where identifiers are described as encrypted, check whether the encoded value is returned elsewhere in responses and whether it is accepted unchanged by privileged endpoints.
What happened, in plain words
A security researcher signed up for a normal account on a website and poked around the features every ordinary user can reach: updating a profile, deleting things, downloading files, making a post public or private. While doing that, he found a way to make the site hand him other people's personal details just by changing one value in a request. Those details included a hidden identifier for each account. He then used that identifier in the site's password reset feature to set a new password on someone else's account, and that someone turned out to be an administrator. He logged in with the password he had just set and had admin powers.
The write-up was published by Aditya Shende (Kong), a bounty hunter and researcher from India, on Medium on 13 July 2021.
Before going further, a few words on the vocabulary you will meet.
- A web application is a program that runs on a company's server and that you use through your browser. Your online banking, a social network, a shop: all web applications.
- An endpoint is one specific address inside that application that accepts a particular kind of request. Think of a large office building: the building is the application, and each counter (reception, accounts, complaints) is an endpoint.
POST /Profileis one such counter. - A request is the message your browser sends to the server. A response is the message the server sends back.
- POST is one of the verbs a request can use. When you fill in a form and press submit, your browser usually sends a POST request carrying the values you typed. A GET request is what happens when you simply open a page by its address.
- A parameter is one of those values you type into a form, or that the application attaches to a request. In
username=alice,usernameis the parameter name andaliceis its value. - JSON is a text format for structured data, used by most web applications to send results back. It looks like
{"success": true}: a name in quotes, a colon, then a value. - An API is the part of a web application that answers requests like these, as opposed to the pages you see. If the website is a restaurant, the API is the kitchen door where orders go in and plates come out.
- A session is how the site remembers that you are logged in. After you sign in, the server gives your browser a small piece of data (a cookie or a token) that your browser sends with every later request, like a wristband at an event that proves you paid.
- Authentication means proving who you are (logging in). Authorisation means deciding what you are allowed to do once you are known.
- IDOR, insecure direct object reference, is the bug class at the heart of this story. The application lets you name the object you want (a profile, an invoice, a photo) by an identifier in the request, and it does not check that the object belongs to you. It is like a hotel where the receptionist hands over any room key you ask for, as long as you ask by room number.
What IDOR means
The author gives his own definition in the article: entity names are used to identify application-controlled resources that are supplied in URLs or request parameters in a Direct Object Reference web application design method.
In plainer words: the application stores things (users, posts, files) and gives each one a name or number. When you ask for one of those things, you tell the application which one you want by putting that name or number in the address or in a form value. If the application trusts your choice without checking that the thing is yours, you can ask for someone else's.

The feature at the centre of the finding is the profile function: the POST /Profile endpoint, and the password reset function that lives in the profile section.
Getting set up
The author tested the application as a normal user, exercising every function available to that role: update, delete, download, make post public and private, and so on. The report does not describe any specific tools, versions or extra accounts. The author tested the application as a normal user and replaced values in a POST request before forwarding it.
Finding it
While testing the normal-user functions, the author found many bugs, but focused on this one. The viewing profile function was the first target, and the POST parameters were the second. The endpoint involved is:
POST /Profile
Read that line as: send a POST request to the address /Profile on the site. The line does not show the body of the request, that is, the values being submitted; the report only names the endpoint.

The response disclosed enough information to be interesting, so the author tried it on their own account first. That is a sensible habit: confirm the feature behaves normally for you before changing anything, so you know what a correct answer looks like.
The next step was to manipulate the username parameter. By supplying another user's username, the response returned that user's information, including home address, role, number and access level.

At this point the author had a way to look up details of other users. The report marks the _id parameter as the important one: it leads to account takeover.
Exploitation
Step 1: information disclosure through the username parameter
The author sent a request to POST /Profile and changed the username parameter to another user's username. The response returned that user's information, including home address, role, number and access level. This gave the author a way to read other users' details.
Why this step matters: the profile endpoint was supposed to answer the question "what are my details?" It answered "what are the details of whoever you name?" instead. The application returned another user's record when the username in the request was changed.
Step 2: abusing the password reset function
The profile section contained a reset password function. The author's reasoning was that if the _id of any user is known, the password of that user can be reset. The reset request is a POST request containing _id and password:
POST /Profile
The report describes the request as containing _id and password; the exact body is not shown. The author replaced their own id with another user's encrypted id and forwarded the request.

In plain words: the request carries two values, an _id and a password. The author changed the _id from their own to the victim's, kept the password value they had chosen, and sent it on. "Encrypted" here means the identifier is not a plain number but an encoded string; the report shows that replacing it with another user's encrypted id still reset that user's password.
Step 3: confirming the reset
After forwarding the modified request, the response was 200 OK. The author notes that JSON context parameters have default responses such as true, verified, error and success. In this case the response came back with true.

200 OK is the standard status code a web server uses to say "the request was handled without an error". It says nothing about whether the action was allowed, only that it was processed. The body of the response, the JSON, is where the application puts its own verdict. A value of true in that JSON is the application saying the password change succeeded.
Step 4: logging in as the victim
The author then tried to access the victim's account using the victim's username and the password that had just been set. The login worked, which led to an account takeover of an admin account. The author notes having multiple privileges that a normal user cannot access.

An account takeover means logging in as someone else and acting with their rights. Here the victim was an administrator, so the attacker gained the administrator's powers: the extra functions and data that ordinary users cannot reach.
With access to the admin account, the author found multiple different functions to test. On that site the author reports finding more than 20 vulnerabilities in total.
Why it worked
The password reset request accepted an _id supplied by the client, and replacing it with another user's id changed that user's password. The profile request returned another user's details when the username parameter was changed. The _id is described as encrypted, but replacing it with another user's encrypted id still reset that user's password.
A useful comparison: a bank teller who processes a withdrawal form without checking the signature is doing exactly this. The form looks official, the fields are filled in, the system accepts it. The missing step is the check that the person asking is entitled to ask.
Impact
An authenticated normal user can read other users' profile information, including home address, role, number and access level, by changing the username parameter. Using the disclosed _id, the same user can reset another account's password and log in as that user. In this case the victim was an admin, so the attacker obtained admin privileges and access to functions a normal user cannot reach. The report does not state how many accounts were affected or whether the issue was reported and fixed.
Fix
Based on the behaviour shown, the reset endpoint should derive the target account from the authenticated session rather than from a client-supplied _id, and the profile endpoint should only return the record belonging to the authenticated user, or enforce an authorisation check on the requested username. Object identifiers should be validated server-side against the current user's ownership before any read or write.
In everyday terms: the wristband at the door should decide which room key you get, not the room number you write on the form.
Variants to test
- Change the
usernameparameter on profile-style endpoints to another known username and look for a response containing that user's details (address, role, number, access level). - Take the
_iddisclosed by a profile response and submit it in a password reset or password change request, then attempt to log in with the new password. A200 OKwith atrue-style JSON body followed by a successful login confirms the issue. - Try the same object substitution on update, delete and download functions, which the author tested as a normal user.
- Where identifiers are described as encrypted, check whether the encoded value is returned elsewhere in responses and whether it is accepted unchanged by privileged endpoints.
Glossary
- Account takeover (ATO): logging in as another person and acting with their rights, usually after obtaining or resetting their password.
- Admin / administrator: a user account with extra powers that ordinary users do not have.
- API: the part of a web application that answers requests with data, as opposed to the pages you see in the browser.
- Authentication: proving who you are, for example by logging in with a username and password.
- Authorisation: deciding what an already identified user is allowed to do or see.
- Cookie: a small piece of data a site stores in your browser and your browser sends back with later requests, often used to keep you logged in.
- Endpoint: one specific address in a web application that accepts a particular kind of request, such as
POST /Profile. - GET: a request verb used when you simply open a page or fetch a resource by its address.
- IDOR (insecure direct object reference): a bug where the application lets you name the object you want by an identifier and does not check that the object belongs to you.
- JSON: a text format for structured data, made of names and values, used by most web applications to send results back.
- Parameter: a named value sent in a request, such as
usernameor_id. - POST: a request verb used to submit data to the server, typically from a form.
- Privilege: a permission to use a particular function or see particular data.
- Request: the message your browser sends to a server.
- Response: the message the server sends back.
- Session: the state of being logged in, kept alive by a cookie or token the browser sends with each request.
- Status code: a number in the response saying how the request was handled;
200 OKmeans it was processed without error. - Token: a piece of data, similar in role to a cookie, that proves to the server who you are.
_id: the internal identifier the application assigns to each account, used here to select which account a password reset applies to.username: the name a user is known by, used here to select which profile record is returned.