← IDOR lesson
FoundationsIDORFoundation25 min+100 XP

Invoice Across the Hall

A invoice portal looks up records by identifier and never compares the record tenant with the signed-in tenant. Retrieve Southbank Logistics's restricted note.

“The portal showed only Sarah's invoices. One number later, it showed the CFO's settlement note.”

CWE-639OWASP API Security API1:2023OWASP ASVS 4.1.3
The story
Ask one question before every request: who owns this object, and did the server compare that owner with me? Authentication tells the server who you are. Authorization tells it whether this specific record is yours.

The UI lists your records, so the brain assumes the server filters them. Often the server only checks that you are logged in, then looks up whatever ID the request supplies. The identifier becomes a key to every tenant's filing cabinet.

Your objective
  • Find the object identifier used by the portal
  • Request a record that belongs to another tenant
  • Capture the flag
Boundary under test

Session identity to requested object

Field guide · request anatomy

Where to look before you type a payload

01Authenticate

The session proves who you are. It does not prove which rows you may read.

02Resolve the reference

The handler turns a path, query or body value into a database key, file name or downstream API call.

03Authorize the object

A correct handler loads the object and compares its owner or tenant with the current subject before returning data.

04Act

Read, update, delete or export the object. Every verb needs the same object-level decision.

Progressive hints

Open one hint at a time. The first two build the model; the last two point at the boundary.

Hint 1

Compare the object IDs visible in the portal with the IDs the server accepts.

Hint 2

Change one identifier at a time and watch the status code, body size and field names.

Hint 3

The visible records leave a gap. The foreign identifier is 1042; the endpoint is /invoice?id=<id>.

Hint 4 · near the answer

Request the foreign ID directly and read the restricted note.

Guided workbench

Observe → Hypothesize → Test → Prove → Explain

This is the same loop a reviewer expects in a report. Your draft stays in this browser; nothing is submitted until you choose to export it.

0/15steps complete
Observe0/3
Hypothesize0/3
Test0/3
Prove0/3
Explain0/3

Evidence log

Write for a reviewer who was not in the room. Every claim needs a request, response or state change behind it.

Preview the evidence report
# Lab evidence report — Invoice Across the Hall

- Family: IDOR
- Lab ID: idor-invoices
- Date: 2026-12-05

## Workflow

### Observe

- [ ] Open "Invoice Across the Hall" and record /invoice, the HTTP method and the role you are given.
- [ ] List every parameter, header, cookie and object identifier the normal flow exposes.
- [ ] Save a baseline response: status, body shape, timing and the fields that change by user.

### Hypothesize

- [ ] Name the server decision that protects /invoice, and the evidence it should use.
- [ ] Use the clue as a constraint, not an answer: Identifiers are sequential. The server returns any record by ID without a tenant check.
- [ ] Predict the exact status, body or state change that would prove the decision is missing.

### Test

- [ ] Start from the baseline and change one value: the id identifier.
- [ ] Keep the request replayable; vary encoding, method or identifier location only after the first result.
- [ ] Capture the full request and response for the winning attempt, including the flag.

### Prove

- [ ] Capture the flag and name the exact foreign object, role or state change it proves.
- [ ] Repeat from a clean session and confirm the result is not cached or stale.
- [ ] State impact precisely: what data or action did you actually obtain?

### Explain

- [ ] State the root cause without naming the payload: which decision failed?
- [ ] Name the control that prevents recurrence and the layer where it belongs.
- [ ] Write one regression test that fails before the fix and passes after it.

## Evidence

### Target and baseline

_Not recorded._

### Hypothesis

_Not recorded._

### Winning request

_Not recorded._

### Proof

_Not recorded._

### Root cause

_Not recorded._

### Control and regression test

_Not recorded._

## Analyst conclusion

The proof demonstrates the missing control above. The regression test should fail against the vulnerable behavior and pass after remediation.
Solution and debrief
Locked until you capture the flag.

The full request, the reasoning and the debrief unlock after a successful capture. That is deliberate: struggle first, then consolidate.

What a reviewer will ask

False positives to rule out

  • The identifier is a UUID and therefore hard to guess: unpredictability reduces discovery but is not authorization.
  • The UI only lists your own records: the API can still accept a foreign identifier.
  • The response is 403 for one guessed ID: test another tenant, another verb and a nested reference before concluding the control is complete.

Regression tests to name

  • Cross-tenant read: The API returns 403 or an indistinguishable 404 and no object fields
  • Cross-tenant write: No row changes and the response does not reveal whether the object exists
  • Nested reference: The request is rejected; the child is not resolved through the parent alone
The defender's move
  • Enforce object-level authorization in the query or policy layer, not in the template.
  • Scope every lookup by the authenticated tenant and user, and return 404 when it does not match.
  • Add automated cross-tenant tests for every object type and every verb.
See the secure-code pattern and all 4 regression tests →
الخلاصة

الثغرة ليست في إخفاء الرابط، بل في عدم مقارنة مالك الكائن بالمستخدم الحالي.