P3 — Insecure Direct Object Reference (IDOR) in User Profile API
The user profile API accepted a user-controlled identifier and returned profile data without checking that the authenticated user owned that record. An authenticated attacker could change the identifier to read other users' profile information, including email and phone details.
Published on 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
The target is a web application exposing a user profile API. The affected functionality is the User Profile Retrieval API, which returns profile information for a user identified by a user-controlled identifier in the request.
The affected component is:
- Endpoint:
https://target.example/api/v1/user/profile/{user_id} - HTTP Method:
GET - Affected Functionality: User Profile Retrieval API
The researcher classifies the issue as Medium (P3), a Broken Object-Level Authorization (BOLA / IDOR) weakness, CWE-639 (Authorization Bypass Through User-Controlled Key) and OWASP API1:2023 (Broken Object Level Authorization), with a suggested CVSS v3.1 score of 6.5, described as context-dependent.
Setup
The test needs two accounts the researcher controls: Account A, used as the authenticated attacker, and Account B, used as the victim whose profile is requested. The researcher logs in with a valid test account and intercepts the profile request with Burp Suite, then works in Burp Suite Repeater. No versions, roles beyond the two accounts, or other preconditions are given.
Finding it
While testing, the researcher noticed that the profile endpoint accepts a user-controlled identifier to retrieve profile information, and that the application does not properly verify whether the authenticated user is authorised to access the requested resource. Changing the identifier in the API request appeared to return another user's profile without the required permissions, which points to a lack of server-side object-level authorization checks.
Exploitation
Step 1: authenticate as Account A
Log in to the application using a valid test account (Account A) and navigate to the user profile section.
Step 2: intercept the profile request
Intercept the profile API request using Burp Suite and send it to Burp Suite Repeater.
Step 3: locate the identifier
Identify the user identifier in the request URL or parameters. In the example it is the numeric segment at the end of the path.
Step 4: swap the identifier and forward
Replace the original user identifier with another valid test account's identifier (Account B) and forward the modified request to the server. The example request uses Account A's bearer token against Account B's identifier:
GET /api/v1/user/profile/1002 HTTP/1.1Host: target.exampleAuthorization: Bearer <ACCOUNT_A_TOKEN>Accept: application/json
The path carries the object reference (1002), the Authorization header carries Account A's token, and Accept: application/json asks for a JSON body.
Step 5: examine the response
The server returned Account B's profile information while the request was authenticated as Account A:
{ "status": "success", "user": { "id": 1002, "name": "Test User B", "email": "[redacted]", "phone": "9876543210" }}
The response contains the identifier, name, email address and phone number of the other account. The researcher repeated the test with accounts under their control to confirm the authorization weakness.
Root cause
The endpoint accepts a user-controlled identifier and returns the corresponding profile without checking that the authenticated user owns or may access that object. The server-side object-level authorization check is missing, so a valid session was enough to read another user's profile by supplying its identifier. The report does not describe the code behind the endpoint.
Impact
An attacker with a valid application account could potentially:
- Access other users' profile information.
- Retrieve personal information not intended for them.
- Enumerate user identifiers to identify additional accessible records.
- Collect information that could support targeted phishing or social engineering.
- Combine the vulnerability with other weaknesses to facilitate further attacks.
The actual impact depends on the sensitivity of the accessible information and the number of affected records. The researcher rates it Medium (P3) because it may allow unauthorised access to other users' information, depending on the sensitivity and scope of the exposed data.
Fix
The report recommends the following remediation:
- Implement server-side object-level authorization checks on every API request.
- Verify that the authenticated user has permission to access the requested resource.
- Never rely exclusively on user-supplied object identifiers.
- Apply ownership validation before retrieving or modifying user records.
- Implement role-based access control where applicable.
- Review all API endpoints that accept user IDs, account IDs, document IDs, or other object references.
- Add automated authorization tests covering cross-user access attempts.
- Log and monitor suspicious attempts to access resources belonging to other users.
When Account A attempts to access Account B's profile without authorisation, the server should reject the request, for example with:
HTTP/1.1 403 Forbidden
Alternatively, the application may return 404 Not Found where concealing whether the resource exists is appropriate.
Variants to test
What happened, in plain words
A security researcher was testing a website that lets people create accounts and view their own profile page. Behind that profile page, the website talks to a small piece of software called an API (Application Programming Interface). An API is the part of a website that actually fetches and returns data when a page asks for it. A useful everyday comparison: when you order food at a restaurant, you do not walk into the kitchen yourself. You tell the waiter what you want, the waiter goes to the kitchen, and the kitchen sends the dish back. The API is the waiter. Your browser is you at the table, and the website's database is the kitchen.
The researcher found that the API which returns a user's profile trusts a number that the browser sends to say which user's profile to fetch. If you change that number, the API happily returns a different person's profile, even though you are logged in as yourself. This kind of mistake has a name: Insecure Direct Object Reference, usually shortened to IDOR. "Direct object reference" means the request contains a direct pointer to a specific record (here, a user ID number). "Insecure" means the server does not check that you are allowed to use that pointer.
The researcher rated the issue Medium (P3). Bug bounty programmes often use a priority scale where P1 is the most serious and P5 the least; P3 sits in the middle. The researcher also gave it a suggested CVSS v3.1 score of 6.5. CVSS is a standard scoring system for the severity of a security flaw, where 0 is harmless and 10 is catastrophic. The score is described as context-dependent, meaning the real damage depends on what data is exposed and how many people are affected.
The report also labels the weakness in two other ways. CWE-639 is a catalogue entry called "Authorization Bypass Through User-Controlled Key". CWE is a public list of common software weakness types. OWASP API1:2023 refers to the Open Worldwide Application Security Project's list of the top ten API security risks, where "Broken Object Level Authorization" is entry number one for 2023. All three labels describe the same basic mistake: the server checks who you are but not what you are allowed to touch.
The target and the feature
The target is a web application that exposes a user profile API. The affected functionality is the User Profile Retrieval API, which returns profile information for a user identified by an identifier supplied in the request.
The affected component is:
- Endpoint:
https://target.example/api/v1/user/profile/{user_id} - HTTP Method:
GET - Affected Functionality: User Profile Retrieval API
An endpoint is a specific address on a server that accepts requests. Think of it as a particular counter in a large office building: the building address gets you inside, but the counter number tells you which service you want. The {user_id} part is a placeholder: in a real request, a number such as 1002 takes its place.
An HTTP method is the verb of a web request. GET means "give me something"; other common methods are POST (create), PUT or PATCH (update) and DELETE (remove). A GET request should only read data, never change it.
Setting up the test
The test needs two accounts that the researcher controls. Account A is used as the authenticated attacker: the account that is logged in and sending the request. Account B is used as the victim: the account whose profile is requested without permission. Using two accounts you own is standard practice in security testing, because it lets you prove the problem without touching anyone else's data.
The researcher logs in with a valid test account and intercepts the profile request with Burp Suite, then works in Burp Suite Repeater. Burp Suite is a tool that sits between your browser and the website, like a postal worker who opens every letter, lets you read it, change it, and then sends it on. Intercepting means pausing a request so you can inspect it before it reaches the server. Repeater is a part of Burp Suite that lets you send the same request over and over with small changes, which is exactly what this test needs.
The report does not give software versions, extra roles beyond the two accounts, or any other preconditions.
Finding it
While testing, the researcher noticed that the profile endpoint accepts a user-controlled identifier to retrieve profile information, and that the application does not properly verify whether the logged-in user is authorised to access the requested resource. Changing the identifier in the API request appeared to return another user's profile without the required permissions. That points to a missing server-side object-level authorization check. "Server-side" means the check happens on the server, not in the browser. Checks done only in the browser can be bypassed, because the browser belongs to the user. "Object-level" means the check is about one specific record (one user's profile), not just about whether you are logged in at all.
Exploitation
Step 1: authenticate as Account A
Log in to the application using a valid test account (Account A) and navigate to the user profile section. The reason for this step is that the API only answers logged-in users. You need a valid session to get past the front door before you can test what happens behind it.
Step 2: intercept the profile request
Intercept the profile API request using Burp Suite and send it to Burp Suite Repeater. The reason for this step is that the browser hides the raw request from you. Interception shows you exactly what the browser sends, including the address, the headers and any identifier, so you have something concrete to modify.
Step 3: locate the identifier
Identify the user identifier in the request URL or parameters. In the example it is the numeric segment at the end of the path. The reason for this step is that the identifier is the "direct object reference" itself. You cannot swap it until you know where it lives.
Step 4: swap the identifier and forward
Replace the original user identifier with another valid test account's identifier (Account B) and forward the modified request to the server. The example request uses Account A's bearer token against Account B's identifier:
GET /api/v1/user/profile/1002 HTTP/1.1Host: target.exampleAuthorization: Bearer <ACCOUNT_A_TOKEN>Accept: application/json
Line by line, in plain words:
GET /api/v1/user/profile/1002 HTTP/1.1is the request line.GETis the method (read something)./api/v1/user/profile/1002is the path: the API, version 1, the user profile feature, and the identifier1002.HTTP/1.1is the version of the web protocol being spoken.Host: target.exampletells the server which website name the request is for. One server can host many sites, so this line says which one you mean.Authorization: Bearer <ACCOUNT_A_TOKEN>is the line that proves who you are. A token is a long string of characters that the server gave you when you logged in, and it works like a wristband at an event: show it and you are let in without showing your password again.Bearermeans "whoever carries this token is treated as the user". The placeholder<ACCOUNT_A_TOKEN>stands for Account A's real token, which is a secret and must never be shared.Accept: application/jsontells the server what format you would like the answer in. JSON is a simple text format for structured data, using curly brackets, names in quotes and values after colons.
The key point is that the path says 1002 (Account B) while the token belongs to Account A. If the server checked ownership, it would refuse. The test is whether it does.
Step 5: examine the response
The server returned Account B's profile information while the request was authenticated as Account A:
{ "status": "success", "user": { "id": 1002, "name": "Test User B", "email": "[redacted]", "phone": "9876543210" }}
Line by line, in plain words:
- The outer curly brackets hold one JSON object, which is a collection of named values.
"status": "success"says the request worked. The server is not reporting an error."user": { ... }is a nested object: a group of details about one user."id": 1002is the identifier that was requested. It matches the number in the path."name": "Test User B"is the display name of the other account."email": "[redacted]"is that account's email address."phone": "9876543210"is that account's phone number.
The response contains the identifier, name, email address and phone number of the other account. That is the proof: Account A asked for Account B's record and got it. The researcher repeated the test with accounts under their control to confirm the weakness.
Why it works
The endpoint accepts a user-controlled identifier and returns the corresponding profile without checking that the logged-in user owns or may access that object. The server-side object-level authorization check is missing, so a valid session was enough to read another user's profile by supplying its identifier. The report does not describe the code behind the endpoint.
A comparison: imagine a hotel where the receptionist checks that you have a room key, then hands you the key to any room whose number you say out loud. The key check is real, but it answers the wrong question. The right question is not "do you have a key?" but "is this your room?".
Impact
An attacker with a valid application account could potentially:
- Access other users' profile information.
- Retrieve personal information not intended for them.
- Enumerate user identifiers to identify additional accessible records.
- Collect information that could support targeted phishing or social engineering.
- Combine the vulnerability with other weaknesses to facilitate further attacks.
Enumerate means trying a series of numbers in order, such as 1001, 1002, 1003, to see which ones return data. The report notes an attacker could potentially enumerate user identifiers to identify additional accessible records. Phishing is a scam where an attacker uses real details about a person (their name, email or phone number) to make a fake message look convincing. Social engineering is the broader trick of manipulating people into revealing information or taking actions. The actual impact depends on the sensitivity of the accessible information and the number of affected records. The researcher rates it Medium (P3) because it may allow unauthorised access to other users' information, depending on the sensitivity and scope of the exposed data.
The fix
The report recommends the following remediation:
- Implement server-side object-level authorization checks on every API request.
- Verify that the authenticated user has permission to access the requested resource.
- Never rely exclusively on user-supplied object identifiers.
- Apply ownership validation before retrieving or modifying user records.
- Implement role-based access control where applicable.
- Review all API endpoints that accept user IDs, account IDs, document IDs, or other object references.
- Add automated authorization tests covering cross-user access attempts.
- Log and monitor suspicious attempts to access resources belonging to other users.
In plain words: the server must compare the identifier in the request with the identity proven by the token, and refuse when they do not match. Role-based access control means giving different levels of permission to different kinds of user, such as an ordinary member and an administrator. Logging and monitoring means recording requests and watching for patterns, such as one account asking for hundreds of different profile numbers in a row.
When Account A attempts to access Account B's profile without authorisation, the server should reject the request, for example with:
HTTP/1.1 403 Forbidden
403 Forbidden is a standard HTTP status code meaning "I understood your request, but you are not allowed to do this". Alternatively, the application may return 404 Not Found where concealing whether the resource exists is appropriate. 404 means "there is nothing here". Using 404 instead of 403 hides whether a given profile number exists at all, which makes enumeration less useful to an attacker.
Other versions of the same test
Once you understand the pattern, there are several variations worth trying on the same feature:
200 OKis the standard status code for a successful request.- A query string is the part of a URL after a question mark, such as
?id=1002.
Each variant asks the same underlying question: does the server check that this particular object belongs to, or is permitted for, the person making the request?
Glossary
- API: the part of a website or service that receives requests for data and returns it, usually in a structured format rather than as a web page.
- Endpoint: a specific address on a server that accepts a particular kind of request.
- HTTP method: the verb of a web request, such as
GETto read,POSTto create, orDELETEto remove. - GET: the HTTP method used to ask for data without changing anything.
- HTTP status code: a three-digit number in a response saying how the request went, such as
200for success,403for forbidden and404for not found. - JSON: a text format for structured data using curly brackets, quoted names and values.
- Token: a string of characters issued at login that proves who you are on later requests, so you do not resend your password each time.
- Bearer token: a token sent in the
Authorizationheader where whoever carries it is treated as the logged-in user. - Header: an extra line in a request or response carrying information such as the host name, the token or the accepted format.
- IDOR (Insecure Direct Object Reference): a flaw where a request contains a direct pointer to a record and the server does not check that you are allowed to use it.
- BOLA (Broken Object-Level Authorization): the API-focused name for the same flaw: the server fails to check permission for one specific object.
- Object-level authorization: a check that a particular record belongs to, or is permitted for, the user making the request.
- Server-side: happening on the server rather than in the browser, and therefore not under the user's control.
- CWE-639: a catalogue entry for "Authorization Bypass Through User-Controlled Key", meaning a user-supplied identifier is trusted without a permission check.
- OWASP API1:2023: the top entry in the 2023 OWASP list of API security risks, which is Broken Object Level Authorization.
- CVSS v3.1: a standard scoring system for the severity of a security flaw, from 0 to 10.
- P3: a middle priority level on a bug bounty scale where P1 is most serious and P5 least.
- Burp Suite: a tool that sits between browser and server so you can inspect and modify requests.
- Intercept: pause a request in transit so you can read or change it before it reaches the server.
- Repeater: the part of Burp Suite that resends a request with modifications so you can compare responses.
- Enumerate: try a series of values, such as consecutive numbers, to discover which ones return data.
- Query string: the part of a URL after a question mark, carrying parameters such as
?id=1002. - Phishing: a scam that uses real personal details to make a fake message look trustworthy.
- Social engineering: manipulating people into revealing information or taking actions.
- Role-based access control: giving different permission levels to different kinds of user.
- Remediation: the fix for a security flaw.