Skip to content
IDOR Write-up Beginner

How a Simple IDOR Led to Full Account Takeover

The registration form accepted a client-supplied user identifier and updated the account it referred to without checking that the authenticated user owned it. An attacker could change another user's password and take over their account.

medium.com

Published on medium.com

Cybersecurity

Adem_Zayani, 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

While testing a Vodafone application, the author found an interesting request in the registration flow. The request is the one that completes the registration form. The request carries the user identifier in a uid parameter, alongside a display name and password fields.

From the original on medium.com

Setup

The researcher used two accounts created for the test:

  • Account A: the attacker account
  • Account B: a second victim test account

Requests were intercepted and modified with Burp Suite. The only precondition for the attack, as described, is a valid authenticated session plus knowledge of the target user's ID.

Finding it

During registration into Account A, the registration request was intercepted. One parameter stood out immediately: uid. The value was being sent directly from the client, which raised the question of what would happen if it were changed. The request looked roughly like this:

From the original on medium.com
Text
action=complete_registration_form &form=uid=41320 &display_name=FromAttacker &password=... &password-confirm=...

The request carries uid, display_name, password and password-confirm, and the uid was being sent directly from the client. Because the identifier comes from the client rather than from the session, it is a candidate for an insecure direct object reference.

Exploitation

Step 1: Change the uid and resend

The researcher changed uid from their own user ID to the ID of the second victim test account and changed nothing else, then sent the request.

Step 2: Observe the server response

The server accepted the request. The response came back with:

From the original on medium.com
JSON
{  "success": true,  "type": "success_updated_user",  "message": "User updated with success",  "data": {    "user_id": "TARGET_ID"  }}

The response came back with success: true and the type success_updated_user. The application had accepted a request from one authenticated user and updated an account belonging to a different user, which is an IDOR / Broken Access Control issue.

Step 3: Set a new password on the victim account

The request did not only change harmless profile information: it also allowed the caller to supply a new password. The researcher set a new password for the second victim test account.

Step 4: Log in as the victim

The researcher then logged into the victim test account using the new password. It worked, turning the IDOR into a full account takeover: IDOR, then password change, then account takeover.

Root cause

The problem was the way the server handled the uid parameter. The application knew the caller was authenticated, but it did not properly check whether that caller was authorised to modify the user represented by the supplied uid. The server was effectively trusting something like:

Text
uid=12345

instead of checking:

Text
Is the authenticated user allowed to modify user 12345?

That missing authorisation check was the core of the vulnerability. Authentication was enforced, but the check that the caller was allowed to modify the supplied uid was missing.

Attack flow

The whole attack was surprisingly simple:

Text
register as a normal user        ↓Intercept the registration request        ↓Change the uid        ↓Send the request        ↓Server updates the target account        ↓Set a new password        ↓Login using the target account        ↓Full Account Takeover

Impact

The vulnerability allowed an authenticated attacker to modify accounts they did not own. Because the password could also be changed, the impact included:

  • Full Account Takeover
  • Unauthorised access to the victim's account
  • Modification of account information
  • Access to information available inside the account
  • Potential compromise of multiple accounts if automated

The most important part was that the attack did not require knowing the victim's password. The attacker only needed a valid authenticated session and the target user's ID.

Fix

The report states that the issue was addressed by the security team after review and validation, but it does not describe the change that was made.

Disclosure

The vulnerability was reported to Vodafone through HackerOne. After the report was reviewed and validated, the issue was addressed by the security team and the report was marked as resolved.

From the original on medium.com

Variants to test

  • Other client-supplied identifiers in registration and profile flows. Look for parameters such as uid, user_id or account_id sent in the body of form submissions. A positive result is a response confirming an update to an ID other than your own, as in the success_updated_user response above.
  • Password fields in update requests. Check whether requests that update profile data also accept password and password-confirm. A positive result is a successful login to the target account with the password you supplied.
  • Automation of the same request. Because the only inputs are a session and a target ID, replaying the request across a range of IDs tests whether multiple accounts can be modified. A positive result is a sequence of successful updates for IDs you do not own.
  • Authorisation checks on other object references. Apply the same question, whether the authenticated user is allowed to modify the referenced object, to any endpoint that takes an object identifier from the client. A positive result is any state change on an object belonging to another 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. 10 min read.

What happened, in plain words

A security researcher was testing an application belonging to Vodafone. While going through the sign-up process, they noticed that one of the requests sent by the browser contained a number identifying the user account. That number was called uid. The browser was sending it, which meant the person using the browser could change it before it reached the server.

The researcher changed that number to point at a different account, one they had created for testing, and sent the request again. The server accepted it and updated the other account. Because the same request also carried a password field, the researcher could set a new password on that other account and then log in as its owner. That is a full account takeover: one user ends up in control of another user's account without ever knowing the original password.

The weakness has a name: IDOR, short for Insecure Direct Object Reference. It belongs to a wider family called Broken Access Control. The rest of this article walks through the same steps the researcher took, explaining each idea from scratch.

From the original on medium.com

Some background before we start

A few everyday ideas will make the rest easier to follow.

What an application like this is. A Vodafone application here means a piece of software that lets people register, sign in and manage their account. Behind the screens sits a server: a computer that stores the accounts and answers the requests the app sends.

What a request is. When you fill in a form on a website and press a button, your browser packages up what you typed and sends it to the server. That package is a request. The server reads it, does something, and sends back a reply, called a response. Think of it as posting a form to an office: the envelope is the request, the reply letter is the response.

What an API is. An API is the set of rules and addresses a program uses to talk to a server. It is like a restaurant menu: it lists what you can ask for and how to ask for it. The app on your phone does not talk to the database directly; it asks the API, and the API does the work.

What a parameter is. A parameter is one named piece of information inside a request, like a field on a paper form. uid=41320 means the parameter named uid has the value 41320. Parameters are separated by & symbols in the request body.

What a session and a cookie or token are. After you log in, the server needs a way to recognise you on the next request, because the web does not remember you by itself. It gives your browser a small piece of data, a cookie or a token, which your browser sends back with every request. It works like a wristband at an event: the door staff check the wristband, not your face. A valid session means the server knows who you are.

What authentication and authorisation mean. Authentication answers the question "who are you?" Authorisation answers a different question: "are you allowed to do this?" Logging in is authentication. Being allowed to edit only your own account is authorisation. Many real bugs come from doing the first and forgetting the second.

What an IDOR is. An IDOR happens when a server takes an identifier from the user, such as an account number, and acts on whatever object that identifier points to, without checking that the user is allowed to touch that object. Imagine a hotel where you tell the receptionist your room number and they hand you the key to that room, no questions asked. If you say "room 12" instead of "room 7", you get into someone else's room. The number is the direct reference, and the missing check is what makes it insecure.

What Burp Suite is. Burp Suite is a tool used by security testers. It sits between your browser and the server and lets you pause a request, look at it, change it, and send it on. It is like opening the envelope before posting it and swapping the contents.

Setting up the test

The researcher created two accounts for the test:

  • Account A: the attacker account, the one the researcher controls and uses to send the malicious request.
  • Account B: a second victim test account, the one that will be attacked.

Using two accounts you own is the standard way to test this kind of bug safely: you can prove that one account can affect another without touching a real customer.

All requests were intercepted and modified with Burp Suite. The only things the attack needs, as described, are a valid logged-in session and the target user's ID. No password for the victim is required.

Finding the problem

The researcher registered into Account A and paused the registration request with Burp Suite. One parameter stood out straight away: uid. The value was coming directly from the client, meaning the browser, rather than being looked up by the server from the session. That raised an obvious question: what happens if it is changed?

The request looked roughly like this:

From the original on medium.com
Text
action=complete_registration_form &form=uid=41320 &display_name=FromAttacker &password=... &password-confirm=...

Line by line, in plain words:

  • action=complete_registration_form tells the server which job to do. Here it selects the handler that finishes a registration.
  • form is the container that carries the form data, the fields the user filled in.
  • uid=41320 is the user identifier supplied by the client. This is the number that decides which account gets updated.
  • display_name=FromAttacker is the display name sent in the request.
  • password=... and password-confirm=... are the credential fields: the new password and a repeat of it for confirmation.

Because the identifier comes from the client and not from the session, it is a candidate for an insecure direct object reference. The server is being asked to trust a number the user can edit.

Carrying out the attack

Step 1: Change the uid and resend

The researcher changed uid from their own user ID to the ID of the second victim test account, Account B, and changed nothing else. Then they sent the request.

Why only change one thing? Because if the request succeeds, you know exactly what caused it. Changing several fields at once would leave you guessing which change mattered.

Step 2: Watch the server's answer

The server accepted the request. The response came back with:

From the original on medium.com
JSON
{  "success": true,  "type": "success_updated_user",  "message": "User updated with success",  "data": {    "user_id": "TARGET_ID"  }}

This is JSON, a common format for data exchanged between programs. Reading it field by field:

  • "success": true says the operation worked.
  • "type": "success_updated_user" says what kind of operation it was: a user record was updated.
  • "message": "User updated with success" is a human-readable confirmation.
  • "data" holds the details, and inside it "user_id": "TARGET_ID" names the account that was changed. That is the victim's account, not the attacker's.

So the application had accepted a request from one logged-in user and updated an account belonging to a different user. That is an IDOR, and more broadly a Broken Access Control issue: the server checked that the caller was logged in, but not that the caller was allowed to edit that particular account.

Step 3: Set a new password on the victim account

The request was not limited to harmless profile details. It also let the caller supply a new password. The researcher set a new password for the second victim test account.

This is the step that turns a nuisance into something serious. Changing a display name is annoying; changing the password is taking over the account.

Step 4: Log in as the victim

The researcher then logged into the victim test account using the new password. It worked. The chain is: IDOR, then password change, then account takeover.

Why was this possible?

The problem was how the server handled the uid parameter. The application knew the caller was logged in, but it did not properly check whether that caller was allowed to modify the user named by the supplied uid. The server was effectively trusting something like:

Text
uid=12345

instead of asking:

Text
Is the authenticated user allowed to modify user 12345?

That missing authorisation check was the core of the vulnerability. Authentication was enforced, but the check that the caller was allowed to modify the supplied uid was missing. Going back to the hotel comparison: the receptionist checked that you were a guest, but never checked that the room number you gave was yours.

The attack flow

The whole attack was surprisingly simple:

Text
register as a normal user        ↓Intercept the registration request        ↓Change the uid        ↓Send the request        ↓Server updates the target account        ↓Set a new password        ↓Login using the target account        ↓Full Account Takeover

Each arrow is one action. Register normally so you have a valid session. Pause the request so you can edit it. Change the identifier so it points at the victim. Send it. The server updates the victim's record. Because the request carries a password, you set a new one. Then you log in with it. The account is now yours.

Impact

The vulnerability allowed a logged-in attacker to modify accounts they did not own. Because the password could also be changed, the impact included:

  • Full Account Takeover
  • Unauthorised access to the victim's account
  • Modification of account information
  • Access to information available inside the account
  • Potential compromise of multiple accounts if automated

The most important part was that the attack did not require knowing the victim's password. The attacker only needed a valid session and the target user's ID. Automation matters here because a script could try a range of IDs one after another; the report notes this as a potential consequence rather than something that was carried out.

The fix

The report says the issue was addressed by the security team after review and validation, but it does not describe the change that was made.

Disclosure

The vulnerability was reported to Vodafone through HackerOne, a platform where security researchers submit findings to companies. After the report was reviewed and validated, the issue was addressed by the security team and the report was marked as resolved.

From the original on medium.com

Other places to look for the same mistake

  • Other client-supplied identifiers in registration and profile flows. Look for parameters such as uid, user_id or account_id sent in the body of form submissions. A positive result is a response confirming an update to an ID other than your own, as in the success_updated_user response above.
  • Password fields in update requests. Check whether requests that update profile data also accept password and password-confirm. A positive result is a successful login to the target account with the password you supplied.
  • Automation of the same request. Because the only inputs are a session and a target ID, replaying the request across a range of IDs tests whether multiple accounts can be modified. A positive result is a sequence of successful updates for IDs you do not own.
  • Authorisation checks on other object references. Apply the same question, whether the logged-in user is allowed to modify the referenced object, to any endpoint that takes an object identifier from the client. A positive result is any state change on an object belonging to another user.

Glossary

  • API: the set of rules and addresses a program uses to talk to a server, like a menu of what you can ask for.
  • Authentication: proving who you are, usually by logging in.
  • Authorisation: the check that you are allowed to perform a particular action on a particular thing.
  • Broken Access Control: a class of bug where the server fails to enforce who may do what; IDOR is one example.
  • Burp Suite: a tool that sits between browser and server so requests can be paused, inspected and modified.
  • Client: the program on your side, such as your browser or the app on your phone.
  • Cookie: a small piece of data a site stores in your browser, often used to recognise your session.
  • Endpoint: a specific address on a server that accepts requests, such as the one that completes a registration.
  • HackerOne: a platform where researchers report vulnerabilities to companies.
  • IDOR (Insecure Direct Object Reference): a bug where the server acts on an identifier supplied by the user without checking that the user is allowed to access that object.
  • JSON: a text format for structured data, made of names and values in curly braces.
  • Parameter: one named piece of information in a request, like a field on a form.
  • Request: the message your browser or app sends to a server.
  • Response: the server's reply to a request.
  • Server: the computer that stores data and answers requests.
  • Session: the server's record that you are logged in, kept alive by a cookie or token sent with each request.
  • Token: a piece of data, similar to a cookie, that proves your session to the server.
  • uid: the parameter name used here for the user identifier, the number that says which account is being acted on.

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.