Insecure Direct Object Reference (IDOR): When Changing One ID Exposes Another User's Data
Why IDOR is an authorization bug rather than an ID-format bug, how testers find it, and why scanners rarely do.
What Is Insecure Direct Object Reference (IDOR)
The name points at the identifier, but the bug is the missing authorization check. Replacing sequential IDs with UUIDs makes guessing harder; it does not fix IDOR, because identifiers leak through URLs, logs, shared links, API responses and browser history. In API contexts the same flaw is called Broken Object Level Authorization (BOLA).
A Simple Example
A user views their own invoice:
GET /api/invoices/10482
Authorization: Bearer <token for user A>The server looks up invoice 10482 and returns it. If user A changes the path to /api/invoices/10483 and the server returns user B's invoice, the application authenticated the user but never checked ownership of the object. The same pattern appears in query parameters (?account_id=), JSON bodies, hidden form fields, file download paths and GraphQL arguments.
Horizontal and Vertical IDOR
| Variant | What happens | Example |
|---|---|---|
| Horizontal | Access to objects belonging to another user at the same privilege level | Reading or editing another customer's order |
| Vertical | Access to objects or functions reserved for higher privileges | A standard user retrieving an admin-only report by ID |
| Write IDOR | Modifying or deleting another user's object | PUT /api/users/77/email changes the victim's login email, enabling account takeover |
| Multi-tenant IDOR | Crossing tenant boundaries in a SaaS application | Tenant A reading tenant B's records by changing an organization ID |
Why Scanners Miss IDOR
An IDOR response is a normal 200 OK with well-formed data. Nothing in the response signals that the data belongs to someone else. Detecting it requires knowing which objects belong to which user, which means testing with at least two accounts and understanding the application's data model. This is the same reason IDOR is a staple of business logic testing and bug bounty reports rather than automated scanner output.
How Penetration Testers Test for IDOR
- Create two or more test accounts in each role (and in separate tenants for SaaS).
- Capture every request that carries an object identifier while using account A.
- Replay each request with account B's session, and with no session, and compare the responses.
- Test every HTTP method on the object, not only
GET: read access may be checked whilePUT,PATCHorDELETEare not. - Look for identifiers in indirect places: export jobs, file names, websocket messages, batch endpoints and GraphQL node IDs.
- Report with both accounts' requests and responses so the ownership violation is unambiguous.
Prevention
- Enforce object-level authorization on every access: check that the authenticated principal owns or is permitted to act on the specific object, on the server, for every method.
- Scope queries to the user: look objects up through the user or tenant (for example
WHERE id = ? AND owner_id = ?) rather than by ID alone. - Centralize access control: use a shared policy layer instead of per-endpoint checks that developers can forget.
- Deny by default: objects are inaccessible unless a rule grants access.
- Use non-guessable IDs as defense in depth only.
- Add regression tests that assert a second user receives
403or404.
Standards Mapping
| Framework | Reference |
|---|---|
| CWE | CWE-639: Authorization Bypass Through User-Controlled Key |
| OWASP Top 10 (2025) | A01:2025 Broken Access Control |
| OWASP API Security Top 10 | API1:2023 Broken Object Level Authorization |
How FireCompass Tests for IDOR
FireCompass AI agents run authenticated tests with multiple user contexts, replay object-level requests across accounts and roles, and report an IDOR only when cross-account access to a specific object is demonstrated, with both requests and responses attached. See web application penetration testing.
Sources and Standards
- MITRE CWE-639: Authorization Bypass Through User-Controlled Key
- OWASP Top 10:2025, A01 Broken Access Control
- OWASP Insecure Direct Object Reference Prevention Cheat Sheet
- OWASP Authorization Cheat Sheet
Frequently Asked Questions
Is IDOR the same as BOLA?
They describe the same flaw. IDOR is the older web application term; Broken Object Level Authorization (BOLA) is the term the OWASP API Security Top 10 uses for it as API1:2023.
Do UUIDs fix IDOR?
No. Random identifiers make guessing harder, but identifiers leak in URLs, logs, emails and API responses. The fix is a server-side authorization check on every object access.
Which CWE is IDOR?
CWE-639, Authorization Bypass Through User-Controlled Key.
Why do automated scanners rarely find IDOR?
The vulnerable response looks like a normal successful response. Detecting IDOR requires multiple accounts and knowledge of which objects belong to which user.
Where does IDOR fall in the OWASP Top 10?
Under A01:2025 Broken Access Control, the top-ranked category in the OWASP Top 10:2025.
Further Reading
- FireCompass AI API penetration testing
- API Penetration Testing in 2026: Why Scanners Miss What Attackers Exploit
- API Penetration Testing: What It Is, How It Works, and How to Do It Continuously
Related Terms
Test Every Object Reference With Two Accounts, Not One
Run a free AI pentest with multi-user authenticated testing and get IDOR findings that show the cross-account request and response.
Free AI Pen TestNo credit card. Findings include reproducible steps and exploit code.
