Skip to content
IDOR Write-up Intermediate

Fuzzing + IDOR = Admin TakeOver

The API endpoints for viewing and updating users were vulnerable to insecure direct object references (IDOR), allowing a low-privilege user to read confidential information about all users and to change their own role to Super Admin. The attacker could escalate privileges by manipulating the role parameter.

Gonzalo Carrasco Follow

Published on medium.com

Hello everyone, this is my first post. I’ve been thinking about writing about my findings for a while, so here we go.

Gonzalo Carrasco, 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 walkthrough of a chained finding on a web application that the author calls example.com. The application has 6 well defined user roles. Two of them matter here: the lowest-privilege account, which the author calls Low Privilege, and the highest, which he calls Super Admin.

The feature at the centre of the report is the application's user API, mounted under /api/. Two endpoints from that API are used: user/users (view user information) and user/updateuser (update a user). The first turns out to leak data about every user in a given role; the second lets the caller change the role value, which is how a Low Privilege account becomes Super Admin.

Setup

  • A registered account on the target with the Low Privilege role.
  • The fuzzing tool ffuf.
  • A proxy to intercept requests and read the Authorization header the front end attaches.
  • No other preconditions are described: the first fuzzing run is done without being logged in.

Finding it

The author starts by fuzzing the API namespace itself, against /api/FUZZ, without logging in. The run returns 4 endpoints. Two of them are the ones that matter:

  • user/users
  • user/updateuser

Requesting one of these endpoints shows that the server only accepts POST. Switching to POST produces a message about a lack of authorization to interact with the resource. That is the expected behaviour for an unauthenticated call, and it is the point where a token becomes necessary.

Exploitation

Step 01: enumerate the API

Fuzzing /api/FUZZ unauthenticated with ffuf surfaces the four endpoints, of which user/users and user/updateuser are kept for the rest of the work.

From the original on medium.com

Step 02: check the accepted method

A request against the discovered endpoint shows that the server only accepts POST.

From the original on medium.com

Step 03: switch to POST

Changing the method to POST returns a message stating a lack of authorization to interact with the endpoint.

From the original on medium.com

Step 04: obtain a token

The author logs in with the Low Privilege account, then intercepts any request the front end makes. The backend attaches an Authorization header carrying a JWT.

From the original on medium.com

Step 05: read the header from a known endpoint

A request to /api/vehicle/getLoggedInUserBookings shows the header in the form Authorization: Bearer [token].

From the original on medium.com

Step 06: replay with the token

The captured header is pasted into the request from Step 03 and sent again. The application now returns a new error message, different from the authorization error.

From the original on medium.com

Step 07: balance the request

The next move is to "balance" the request until the server answers cleanly. That means adjusting headers such as Content Type and Accept, and adding a random parameter in JSON format with a random value, to see how the server reacts to it.

From the original on medium.com

Step 08: reuse parameters from a known-good request

The author's habit with a new API is to save every parameter seen along the way. The parameters from the Step 05 request are reused to debug the responses and reach an accurate HTTP 200 OK. The message User details fetch successfully confirms the request is now well formed.

From the original on medium.com

Step 09: fuzz for a parameter that returns more

This is the key step: look for one or more parameters that return more information than the baseline. Fuzzing again finds a valid parameter, named role, used with the value 1. The syntax that produced the result with ffuf is:

Bash
ffuf -w g0ld3n-api.txt -u https://vulnerable.com/api/endpoint -X POST --data '{"param1":value1,"param2":value2,"FUZZ":6}' -H 'Authorization: Bearer JWT'
From the original on medium.com

Step 10: read other users' data

Sending the request with the new role parameter makes the server return confidential information about all the users whose role equals 6, which corresponds to Low Privilege.

From the original on medium.com

Step 11: from read to write

At this point the API is confirmed vulnerable to IDOR in its user-information view. The author then asks whether the update user endpoint found in Step 01 behaves the same way.

The parameters from Step 10 are reused and debugged against /user/updateuser until the request is balanced and the server answers correctly. Then the value of the parameter "role": 6 is changed to "role": 1:

  • Role 6 = Low Privilege
  • Role 1 = Super Admin
From the original on medium.com

Logging in again with the same account shows it is now Super Admin.

From the original on medium.com

Root cause

Both endpoints trust a client-supplied role value. On user/users the value selects which users' records are returned, so a Low Privilege caller can read records belonging to any role by changing the number. On user/updateuser the same value is accepted, and changing it to 1 made the author's own account Super Admin. The JWT identifies the caller, yet changing the role value still returned other users' data and allowed the escalation.

Impact

An authenticated user holding the lowest role can, under the conditions shown here, read confidential information about all users in a given role and escalate their own account to Super Admin. The author's account became Super Admin, the highest role in the application. The report does not describe what the Super Admin role can reach beyond the escalation itself.

Fix

The report does not state what was changed. The fix that follows from the root cause is to stop taking the role from the request body on both endpoints: derive the caller's identity and role from the validated JWT on the server, return only the records the caller is entitled to see, and reject any attempt to assign a role the caller is not authorised to grant.

Variants to test

  1. Role parameter on read endpoints. Fuzz parameter names on any list or detail endpoint with a valid low-privilege token. A positive result is a response containing records that belong to another role or another user.
  2. Role parameter on update endpoints. Send the same body to the update endpoint with a different role value. A positive result is a successful response followed by the account showing the new role after a fresh login.
  3. Numeric identifiers alongside the role. Where the API accepts an id or similar field, change it while keeping the role fixed. A positive result is another user's data or a modified record you do not own.
  4. Header and content negotiation. Vary Content-Type and Accept and add a random JSON parameter, as in Step 07, to see whether error messages reveal which fields the server expects. A positive result is a different error that names a missing or unexpected field.
  5. Unauthenticated enumeration. Fuzz /api/FUZZ without a token on other targets. A positive result is endpoints that respond differently from the generic authorization error, which are worth replaying with a token.

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

What happened, in plain words

Imagine a large office building where every employee has a badge. The badge says who you are and what floors you are allowed to enter. A cleaner's badge opens the cleaning cupboard and the ground floor. A manager's badge opens almost everything, including the room where salaries are decided.

In this report, the author found that the building's door system had a flaw. The request carried a valid badge, yet changing one number still let the author reach data and roles he should not have. So a cleaner could walk up to the manager's door, wave their cleaner badge, and the door would open, as long as they also said the right magic word. The magic word here was a small piece of data called role, and the number attached to it decided which floor you ended up on.

The author started with a cleaner's account (called Low Privilege in the report), found the hidden doors of the building's internal service (its API), and discovered that by changing one number in a request he could first read private information about every cleaner in the company, and then promote his own account to Super Admin, the highest role in the application.

This is a beginner's walkthrough of that finding. Every term is explained as it appears. The requests and commands are copied exactly as the author wrote them.

Background: the words you need first

Before the steps, a few ideas that come up constantly.

  • Web application: a program you use through your browser. When you click a button, your browser sends a message to a server (a computer somewhere else), the server does some work, and sends a message back. Your browser draws the result on screen.
  • API: the set of private doors and counters a web application uses behind the scenes. Your browser does not talk to the database directly; it asks the API, and the API fetches or changes things. Think of a restaurant: the menu and the waiter are the API. You do not walk into the kitchen yourself, you tell the waiter what you want, and the waiter brings it. An API is usually reached at addresses that start with /api/, followed by a name, for example /api/user/users.
  • Endpoint: one specific address in that API. If the API is the restaurant, an endpoint is one dish on the menu, one specific thing you can ask for. /api/user/users and /api/user/updateuser are two endpoints.
  • HTTP method: the verb attached to a request. GET means "give me something". POST means "here is some data, do something with it". There are others, but these two matter here. A server can refuse a verb it does not expect, which is exactly what happens in Step 02.
  • Request and response: a request is the message your browser (or a tool) sends to the server. A response is the message the server sends back, including a status code such as 200 OK (fine) or 401/403 (not allowed).
  • Header: a small labelled line attached to a request or response, carrying extra information. Think of the address label on a parcel: the parcel is the body, the label is the header. Content-Type says what format the body is in. Accept says what format you would like back. Authorization carries proof of who you are.
  • Token / JWT: after you log in, the server gives your browser a long string of characters. Your browser sends it back with every request so the server knows who you are, without asking for your password each time. A JWT (JSON Web Token) is one common format for such a token. It is like a wristband you get at a festival: you show it at the gate instead of your ticket, and the staff trust the wristband.
  • Bearer token: a token sent in the header in the form Authorization: Bearer [token]. "Bearer" means "whoever bears (carries) this token is treated as the owner". Anyone who steals the string can use it, which is why tokens are secret.
  • Fuzzing: trying a large number of guesses automatically and watching which ones get a different answer. Like trying every key on a big keyring in a lock, one after another, very fast, and noticing which one turns. The tool used here is called ffuf.
  • Wordlist: a plain text file with one guess per line, which a fuzzing tool reads. g0ld3n-api.txt in the command below is such a file.
  • Parameter: a named value you send along with a request, for example role with the value 6. Think of a form field: the name of the field is the parameter, what you type in it is the value.
  • JSON: a simple text format for structured data, using curly braces and "name": value pairs. It is how the requests in this report carry their parameters.
  • Proxy / intercept: a tool that sits between your browser and the server and lets you pause a request, look at it, and change it before it goes on. Like a mail room that opens every envelope before delivery.
  • IDOR (Insecure Direct Object Reference): a vulnerability where the application lets you name the object you want (a user, an order, a record) and does not check that the object belongs to you. If changing a number in a request shows you someone else's data, that is IDOR. Think of a hotel where your room key is just the room number written on a card: change the number and you can open any door.
  • Privilege escalation: getting more rights than you were given. Here, going from the lowest role to the highest.
  • Role: a label attached to a user account that decides what that account may do. This application has 6 well defined user roles. The author calls the lowest one Low Privilege and the highest one Super Admin.

The target

The author calls the victim web application example.com. It has those 6 roles. He uses two accounts' worth of knowledge: a Low Privilege account that he owns, and the Super Admin role he wants to reach.

The feature at the centre of the report is the application's user API, mounted under /api/. Two endpoints from that API are used:

  • user/users, which views user information.
  • user/updateuser, which updates a user.

The first turns out to leak data about every user in a given role. The second accepts a role value, which is how a Low Privilege account becomes Super Admin.

What you need to follow along

  • A registered account on the target with the Low Privilege role.
  • The fuzzing tool ffuf.
  • A proxy to intercept requests and read the Authorization header the front end attaches.
  • No other preconditions are described: the first fuzzing run is done without being logged in.

Finding it

The author starts by fuzzing the API namespace itself, against /api/FUZZ, without logging in. The FUZZ part is the placeholder that ffuf replaces with each line of the wordlist, one after another. The run returns 4 endpoints. Two of them are the ones that matter:

  • user/users
  • user/updateuser

Requesting one of these endpoints shows that the server only accepts POST. Switching to POST produces a message about a lack of authorization to interact with the resource. That is the expected behaviour for an unauthenticated call, and it is the point where a token becomes necessary.

Exploitation

Step 01: enumerate the API

The author's first move is to find out which doors exist. He fuzzes /api/FUZZ unauthenticated with ffuf, which surfaces the four endpoints. Of those, user/users and user/updateuser are kept for the rest of the work.

From the original on medium.com

Why do this without logging in? Because the list of doors is often visible even to a stranger. Knowing the names of the endpoints is the map you need before you can test anything.

Step 02: check the accepted method

A request against the discovered endpoint shows that the server only accepts POST.

From the original on medium.com

Why check? Because a server that refuses a verb tells you which verb it wants. That is a free hint, and it saves guessing.

Step 03: switch to POST

Changing the method to POST returns a message stating a lack of authorization to interact with the endpoint.

From the original on medium.com

Why does this matter? The error is not "this endpoint does not exist". It is "you are not allowed". That means the endpoint is real and working, and the only thing missing is proof of identity. The next step is to get that proof.

Step 04: obtain a token

The author logs in with the Low Privilege account, then intercepts any request the front end makes. The backend attaches an Authorization header carrying a JWT.

From the original on medium.com

Why intercept? Because the token is created by the application after login and stored in the browser. You cannot guess it; you have to watch a real request go by and copy the header out of it. The proxy is the mail room that lets you read the envelope.

Step 05: read the header from a known endpoint

A request to /api/vehicle/getLoggedInUserBookings shows the header in the form Authorization: Bearer [token].

From the original on medium.com

Step 06: replay with the token

The captured header is pasted into the request from Step 03 and sent again. The application now returns a new error message, different from the authorization error.

From the original on medium.com

Why is a new error interesting? Because the server's answer changed after the token was added, so the next problem is something else in the request. That tells you the token worked and the next problem is the request body.

Step 07: balance the request

The next move is to "balance" the request until the server answers cleanly. That means adjusting headers such as Content Type and Accept, and adding a random parameter in JSON format with a random value, to see how the server reacts to it.

From the original on medium.com

It is like asking a shop assistant for a made-up product and hearing them list what they actually stock.

Step 08: reuse parameters from a known-good request

The author's habit with a new API is to save every parameter seen along the way. The parameters from the Step 05 request are reused to debug the responses and reach an accurate HTTP 200 OK. The message User details fetch successfully confirms the request is now well formed.

From the original on medium.com

Why reuse known parameters? Because a request that already works somewhere is a template. Copying its fields into the new request removes one unknown at a time, until the only thing left to vary is the part you actually care about.

Step 09: fuzz for a parameter that returns more

This is the key step: look for one or more parameters that return more information than the baseline. Fuzzing again finds a valid parameter, named role, used with the value 1. The syntax that produced the result with ffuf is:

Bash
ffuf -w g0ld3n-api.txt -u https://vulnerable.com/api/endpoint -X POST --data '{"param1":value1,"param2":value2,"FUZZ":6}' -H 'Authorization: Bearer JWT'

Line by line:

  • ffuf runs the fuzzing tool.
  • -w g0ld3n-api.txt names the wordlist file: one candidate parameter name per line.
  • -u https://vulnerable.com/api/endpoint is the address being tested.
  • -X POST forces the request to use the POST method.
  • --data '{"param1":value1,"param2":value2,"FUZZ":6}' is the body sent with the request. param1 and param2 are the known parameters carried over from earlier steps, and FUZZ is the slot where ffuf inserts each word from the wordlist.
  • -H 'Authorization: Bearer JWT' attaches the token captured in Step 05, so the server treats the request as coming from the logged-in Low Privilege user.
From the original on medium.com

Why fuzz parameter names? Because the server accepts fields you were never told about. The visible form on the website may not show a role field, but the API behind it may still accept one. Fuzzing is how you find the fields that exist but are not advertised.

Step 10: read other users' data

Sending the request with the new role parameter makes the server return confidential information about all the users whose role equals 6, which corresponds to Low Privilege.

From the original on medium.com

Why is this a vulnerability? Because the request asked for users by role and the server returned confidential information about all of them. The token proved the caller was a valid Low Privilege user, but nothing checked that this user was entitled to a list of everyone in that role. That is the IDOR pattern: you name the object, and the server hands it over.

Step 11: from read to write

At this point the API is confirmed vulnerable to IDOR in its user-information view. The author then asks whether the update user endpoint found in Step 01 behaves the same way.

The parameters from Step 10 are reused and debugged against /user/updateuser until the request is balanced and the server answers correctly. Then the value of the parameter "role": 6 is changed to "role": 1:

  • Role 6 = Low Privilege
  • Role 1 = Super Admin
From the original on medium.com

Why try the update endpoint? Because reading data is bad, but writing data is worse. If the same unchecked role value is accepted when updating a user, the caller can set their own role to the highest one. The read step proved the field is trusted; the write step turns that trust into a promotion.

Logging in again with the same account shows it is now Super Admin.

From the original on medium.com

Root cause

Both endpoints accept a client-supplied role value. On user/users it returned confidential information about all users with role 6. On user/updateuser changing it to 1 made the author's account Super Admin. The JWT proves who the caller is but the application never checks whether that caller is allowed to read or assign the requested role. The authorization error seen in Step 03 only enforces that a token is present, not what the token's owner may do.

In everyday terms: the door checks that you have a badge, but not which badge. Once you are inside, the number you write on the form decides which floor you reach.

Impact

An authenticated user holding the lowest role can, under the conditions shown here, read confidential information about all users in a given role and escalate their own account to Super Admin. The author's account became Super Admin, the highest role in the application. The report does not describe what the Super Admin role can reach beyond the escalation itself.

Fix

The report does not state what was changed. The fix that follows from the root cause is to stop taking the role from the request body on both endpoints: derive the caller's identity and role from the validated JWT on the server, return only the records the caller is entitled to see, and reject any attempt to assign a role the caller is not authorised to grant.

Variants to test

  1. Role parameter on read endpoints. Fuzz parameter names on any list or detail endpoint with a valid low-privilege token. A positive result is a response containing records that belong to another role or another user.
  2. Role parameter on update endpoints. Send the same body to the update endpoint with a different role value. A positive result is a successful response followed by the account showing the new role after a fresh login.
  3. Numeric identifiers alongside the role. Where the API accepts an id or similar field, change it while keeping the role fixed. A positive result is another user's data or a modified record you do not own.
  4. Header and content negotiation. Vary Content-Type and Accept and add a random JSON parameter, as in Step 07, to see whether error messages reveal which fields the server expects. A positive result is a different error that names a missing or unexpected field.
  5. Unauthenticated enumeration. Fuzz /api/FUZZ without a token on other targets. A positive result is endpoints that respond differently from the generic authorization error, which are worth replaying with a token.

Glossary

  • API: the set of addresses a web application uses behind the scenes to fetch and change data; your browser asks the API, and the API talks to the database.
  • Endpoint: one specific address in an API, for example /api/user/users.
  • HTTP method: the verb on a request, such as GET (fetch) or POST (send data and act).
  • Request: the message sent from your browser or tool to the server.
  • Response: the message the server sends back, including a status code such as 200 OK.
  • Status code: a number in the response saying how it went; 200 means fine, 401/403 mean not allowed.
  • Header: a labelled line attached to a request or response carrying extra information, such as Content-Type or Authorization.
  • Content-Type: the header saying what format the body is in, for example JSON.
  • Accept: the header saying what format you would like the response in.
  • Body: the main content of a request or response, as opposed to its headers.
  • Token: a long string the server gives you after login, which you send back to prove who you are.
  • JWT (JSON Web Token): a common format for such a token.
  • Bearer token: a token sent as Authorization: Bearer [token], where whoever carries it is treated as its owner.
  • Authorization header: the header that carries the token.
  • Fuzzing: automatically trying many guesses and watching which one gets a different answer.
  • ffuf: a tool that performs fuzzing, replacing a FUZZ placeholder with each line of a wordlist.
  • Wordlist: a text file with one guess per line.
  • Parameter: a named value sent with a request, such as role with the value 6.
  • JSON: a text format for structured data using "name": value pairs.
  • Proxy / intercept: a tool that pauses requests between your browser and the server so you can read or change them.
  • IDOR (Insecure Direct Object Reference): a flaw where the application lets you name the object you want and does not check that it belongs to you.
  • Privilege escalation: gaining more rights than your account was given.
  • Role: a label on an account that decides what it may do; this application has 6 roles.
  • Low Privilege: the author's name for the lowest role in the application.
  • Super Admin: the author's name for the highest role in the application.
  • Authentication: proving who you are, usually by logging in.
  • Authorization: deciding what a proven identity is allowed to do.
  • Confidential information: data that should only be visible to people entitled to see it.
  • Root cause: the underlying reason a vulnerability exists, as opposed to its visible symptom.
  • Impact: what an attacker can actually do by exploiting the flaw.

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.