IDOR and BOLA: when the number in the request is the only "check"
IDOR (BOLA in the OWASP API list) is when the server checks who the user is but not who owns the requested object. So another id exposes other people's data. The fix is an ownership condition on the server in every handler, not hiding things in the interface. A UUID does not replace the check, because ids leak. QA tests with two accounts of one role: read, change and delete.
Pentest · Access control
I changed 1001 to 1002 in the request and see someone else’s order. A bug or by design?
A tester logs in to an online shop as Alice, opens her order and sees the request GET /api/orders/1001 in the network tab. Out of curiosity he changes the number to 1002 and gets a full order card with a stranger’s delivery address. The token is the same, the server answered "200 OK". This lesson explains why that happens, how to check it without harming the system, and what the right fix looks like.
Mechanism. Authentication answers "who is this?": a token or a cookie proves the request came from Alice. Authorization answers another question: "may exactly Alice perform exactly this action on exactly this object?". If the server stops at the first question, substituting someone else’s identifier is enough to open access.
The classic name is IDOR (Insecure Direct Object Reference). In the OWASP API Security Top 10:2023 it is called BOLA (Broken Object Level Authorization) and sits at number API1. In the web Top 10:2025 it is part of A01 Broken Access Control. It is so common because authentication is usually done by one shared layer (middleware), while object ownership is business logic that every handler has to repeat. Forgetting one endpoint is enough. A scanner does not see it either: it does not know whose object is whose.
The same token, another number
Figure 1. Alice’s token in every request. Order 1002 belongs to Bob.
Worked example. The tester works with two of his own test accounts in an authorized environment. First, Alice’s request for her own order:
GET /api/orders/1001 HTTP/1.1
Host: shop.example
Authorization: Bearer <token-alice>
HTTP/1.1 200 OK
{"id": 1001, "owner": "alice", "address": "..."}
Now the same token, but the number of Bob’s order (created from the second account):
GET /api/orders/1002 HTTP/1.1
Host: shop.example
Authorization: Bearer <token-alice>
HTTP/1.1 200 OK
{"id": 1002, "owner": "bob", "address": "..."}
The owner field in the response does not match the user from the token: that is the proof. It is enough for the report, there is no need to collect anyone’s real data. The cause is usually the same:
Where the owner check lives
Typical
orders.findById(id)
The token is checked, the owner is not. Any logged-in user sees any order.
Better
orders.findOne({ id, ownerId: user.id })
The owner is part of the database query itself. A foreign number is simply "not found", and choosing 404 does not confirm the order exists.
Figure 2. The fix is in one place: the owner condition inside the query, not a separate check "afterwards".
A real case. In May 2019 the journalist Brian Krebs reported that the site of the insurer First American served documents by a link with a sequential number: changing one digit opened someone else’s file. No authentication was required. The site held about 885 million files, including financial documents. The company called it a "design defect in an application". In 2021 the company settled with the US regulator SEC and paid a penalty of 487,616 dollars: the executives who reported on the incident had not been told that the company’s own security staff had found the flaw months earlier and had not fixed it. The lesson: a sequential number without an access check is exactly the flaw described above, only on the scale of millions of records.
Limits and workarounds.
UUID instead of 1, 2, 3. A random identifier makes guessing harder but does not replace the check: ids end up in logs, links, Referer headers and other API responses. Whoever sees one can open the object;
Not only GET. Check reading, changing (PUT, PATCH) and deleting (DELETE): protection is most often forgotten there;
Not only the path. An object number may sit in a query parameter, a JSON body, a header, a file name, a GraphQL query or a WebSocket message;
Nested resources. In /users/5/invoices/900 the server may only check "5 from the token matches the path" and never check that invoice 900 belongs to user 5.
How QA checks it. You need two accounts of the same role (A and B) and, if possible, an admin. User A creates objects and writes down their numbers. Then A’s requests are replayed with B’s token: reading, changing, deleting. Status and body are compared with the owner’s response. A separate pass without a token. In Burp this is done by Repeater or the Autorize extension, in Postman by two environment variables with tokens. Only on a test environment or in a training lab (PortSwigger Web Security Academy, OWASP Juice Shop); on a third-party system only with written permission and within the scope.
Common mistakes.
Checking access only in the interface (hiding foreign orders from the list). A direct request bypasses the UI, so protection there is useless;
Treating an "unpredictable" number as protection. It only lowers the chance of a random guess;
Answering 401 for a foreign object: 401 means "no valid credentials", and here they exist. The right answers are 404 or 403, with no data in the body.
Check yourself
GET /api/files/8f3c… (UUID v4) is served to any logged-in user. The team says: "a UUID cannot be guessed, so there is no IDOR". Is that right?
Answer
No. Guessing a UUID is indeed hard, but the identifier can be seen in a shared link, in logs or in a list that shows foreign files. Anyone who has it opens the file because nobody checks the owner. An owner (or permission) condition in the query is needed.
Alice’s request for a foreign order returned 200 with only {} in the body. Is there a flaw?
Answer
No foreign data is visible, so it is not a leak, but the behaviour is confusing: 200 says "the order exists and you are allowed". 404 (or 403) is more reliable. Also check that other methods (PUT, DELETE) on the same number do not work either, because an empty GET response says nothing about them.
Related lessons: “Vertical escalation, forced browsing and BFLA”, “Mass assignment”, “OWASP Top 10:2025: an overview of the list”.
In an interview.Junior: IDOR (BOLA) is when the server checks who the user is but not whose object they ask for. The fix is an owner condition on the server in every request. Middle/Senior: I test with two accounts of the same role and replay foreign requests for reading, changing and deleting, also in nested resources and in the request body. I do not count UUIDs as a fix because ids leak; a good fix does not confirm that the object exists.
Vertical escalation, forced browsing and BFLA
Vertical escalation is when an ordinary user performs a function of a higher role. Horizontal escalation (IDOR) exposes other people's objects of the same role, while the vertical kind is BFLA in the OWASP API list. A hidden button or address is not protection: the server checks the role for every function, method and API version. QA builds a function, method and role matrix and checks the state as an admin.
Pentest · Access control
An ordinary account calls DELETE /api/admin/users/7 and gets 204. Who decided that is allowed?
The admin panel has a "Delete user" button. An ordinary user does not see it, and the team considers the matter closed. But the button only sends the request DELETE /api/admin/users/7, and that request can be sent without the button. This lesson covers how vertical escalation differs from horizontal, why a hidden address is not protection, and how to check systematically that every privileged function is protected on the server.
Two directions of escalation
Figure 1. Horizontal: other people’s data at the same level. Vertical: actions of a higher role.
Mechanism. Horizontal escalation (IDOR, the previous lesson) gives access to other people’s objects of the same role. Vertical escalation lets a user perform a function of a higher role: an ordinary user creates an admin, sets a discount, exports all customers. In the OWASP API list of 2023 this is BFLA (Broken Function Level Authorization, API5). The check here is not "whose object" but "may this role call this function".
Forced browsing is an attempt to open addresses that nothing in the interface links to: /admin, /backup.zip, /api/v1/users/export, /debug. They are found in the application’s JavaScript files, in robots.txt, in API documentation or by dictionary guessing. "Hidden" does not mean "protected": an address missing from the menu is still served if the server does not check the role.
Where protection usually breaks.
Another method.GET on an admin address gives 403, but DELETE or PUT skips the check;
Another version or path. The new /api/v2/… is protected while the old /api/v1/… was left unchecked;
Trusting the client. The role is taken from a field the user can change: a hidden form field, a header X-Role, a cookie role=user;
Check after the action. The server performs the change and then returns 403: the response says "forbidden" but the state has already changed.
Worked example. An authorized environment, an ordinary user’s token. Reading the list is forbidden:
GET /api/admin/users HTTP/1.1
Authorization: Bearer <token-user>
HTTP/1.1 403 Forbidden
But deleting on the same address goes through:
DELETE /api/admin/users/7 HTTP/1.1
Authorization: Bearer <token-user>
HTTP/1.1 204 No Content
The first 403 creates a false feeling of safety: only the GET method is protected. The tester does not stop at the status and after every attempt checks the state as an admin: was the user really deleted. A status can lie both ways (403 with a changed state, 200 with an error in the body). To be systematic, build a matrix: rows are functions and methods, columns are roles.
Function
user
admin
GET /admin/users
403
200
DELETE /admin/users/7
403
204
GET /export.csv
403
200
The cells hold the expected statuses; any "user" cell with a status other than 401/403/404 is a finding. A separate "no token" column gives 401.
A real case. In October 2023 Cisco reported active exploitation of CVE-2023-20198 in the IOS XE web interface: before the fix an unauthenticated remote attacker could create a local account with the highest privilege level (privilege 15). Devices with the web interface enabled were affected. The CVSS 3.1 score was 10.0. According to CISA, attackers combined it with a second flaw (CVE-2023-20273, command injection) to run commands as root. A privileged function (creating an account) was reachable without a rights check, and the web interface itself was visible from the internet. Mitigation: disable the HTTP server on the device until a fix was available.
Limits. The matrix checks what you know about. Unknown addresses are searched separately: in JS files, documentation (Swagger/OpenAPI), version history. Path-guessing tools (ffuf, gobuster) are appropriate only within the scope. A list of "what is closed in the application" is better taken from the developers than reconstructed from responses.
Common mistakes.
Concluding from one method or one status. Protection of individual methods and versions is checked separately;
Relying on robots.txt or a long address. That is not authorization;
Keeping the role in a cookie or a JWT without a signature and a server-side check: the client changes it on its own.
Check yourself
An ordinary user sends PUT /api/admin/settings and gets 403. Is that enough to close the check?
Answer
No. The state must be checked as an admin: were the settings changed. Some handlers perform the change and then refuse. Also check the other methods of the same address and the old API version.
How does forced browsing differ from IDOR?
Answer
IDOR substitutes someone else’s identifier into a known function, while forced browsing looks for addresses and functions the interface does not link to. Both flaws are about a missing server-side check, but the first is about object ownership, the second about access to the function or resource itself.
Related lessons: “IDOR and BOLA”, “Mass assignment”, “SQL injection: how input becomes a command”.
In an interview.Junior: Vertical escalation is when an ordinary user performs an admin action. Hiding the button is not enough, the server must check the role for every function and method. Middle/Senior: I build a "function × method × role" matrix and after each attempt check the state as an admin, not just the status. Separately I look at old API versions and addresses from JS and documentation; a good fix is a central access policy that is "deny by default".
Mass assignment: the field that was not in the form
Mass assignment is when the server copies all request fields into the model and the client adds extras, such as role or credit. In the OWASP API Top 10 2023 it falls under BOPLA. The fix is an explicit allowlist of fields at request-schema level plus a separate response object; a blocklist misses a forgotten field. QA adds fields from a GET response to a POST or PATCH and re-reads the object.
Pentest · Access control
The profile form has three fields, the JSON response has nine. What if you send a tenth?
The profile form has the fields "Name", "Phone" and "City". The API response to GET /api/profile also shows role, verified, credit and others. A developer wrote one line that saves the whole request body into the model. So a request with an extra role field changes the role. The lesson explains the mechanism, how QA finds such fields and what fixes them.
Mechanism. Many frameworks can automatically copy request fields into an object or a database record: Rails, Django ModelForm, Spring (binding a body to an entity), Mongoose Model.create(req.body), Sequelize update(req.body). It is convenient, but the list of fields is decided by the client, not by the server. In the OWASP API Security Top 10:2023 this flaw, together with showing too many fields in a response, is called BOPLA (Broken Object Property Level Authorization, API3): a question about rights to individual properties of an object, not to the object as a whole.
What is sent and what should reach the model
Figure 1. The server decides the rights to each property, not the contents of the request body.
Worked example. An authorized environment, an ordinary user’s account. The tester takes the fields from the GET response and adds them to a profile update:
The response could lie too (return just what was sent), so the next step is to read the profile with a separate request and compare. If role really changed, this is a high-severity finding: an ordinary user became an admin.
A typical cause and the fix on the server:
// before: the client chooses the fieldsawaitUser.findByIdAndUpdate(req.user.id, req.body);
// after: an explicit allowlist, unknown keys are rejectedconstBody = z.strictObject({ name: z.string().optional(), phone: z.string().optional() });
awaitUser.findByIdAndUpdate(req.user.id, Body.parse(req.body));
z.strictObject in zod rejects unknown keys: parse throws and the handler answers 400. Silent ignoring is also safe as long as the field does not reach the database, but an error is more useful: it shows up in tests. A closed list (allowlist) is more important than a "blacklist" (remove role and isAdmin): a blacklist always misses a field somebody forgot about.
A real case. On 4 March 2012 a GitHub user used the public key update form, added his own key to the rails organization and pushed a test file to the repository to prove the problem. According to GitHub’s own description, the cause was mass assignment: the server did not check which form parameters it accepted. A fix shipped in about an hour, and after the incident the team audited the whole codebase for similar cases. The lesson for the whole ecosystem: frameworks had to move to explicit lists of permitted parameters (in Rails this became strong parameters).
What else to check.
Creation. Add id, ownerId, price, status to POST. An order with "price": 0.01 or someone else’s ownerId is already a business-logic violation and IDOR;
Reading. The other side of the same flaw: the response has extra fields (a password hash, internal flags). A separate response object hides them;
Roles. Some fields may be changed by an admin but not by a user: the permitted set depends on the role.
Common mistakes. Hiding a field only in the form (the client sends anything); closing only known "dangerous" names; verifying a change by the response alone instead of reading again; treating only escalation to admin as the flaw, although changing emailVerified or credit is no less serious.
Check yourself
A developer removed role and isAdmin from the accepted body, but the model also has credit. Why is the approach unreliable?
Answer
That is a blacklist: it closes only known names. Every new model field is open until someone remembers it. The reliable approach is an explicit allowlist of the fields the client may really change.
The response to a PATCH with an extra field returns 200 without that field. Does this prove the field was ignored?
Answer
No. The response may show only permitted fields while the value has already reached the database. Read the object with a separate request (or as an admin) and compare.
Related lessons: “IDOR and BOLA”, “Vertical escalation, forced browsing and BFLA”, “OWASP Top 10:2025: an overview of the list”.
In an interview.Junior: Mass assignment is when the server copies every request field into the model and the client adds an extra one, such as role. The fix is an explicit list of permitted fields. Middle/Senior: I take fields from GET responses and add them to POST/PATCH, then re-read the object with a separate request. I close it with an allowlist at the request-schema level and a separate response object, and make rights to a field depend on the role.