By Sergio Atenciano8 min read

Testing authorization without false positives

A 200 OK does not prove a bug. What separates a real finding from an illusion are the controls: positive, negative, and length-matched.

Testing access control is easy to do badly. You change an identifier, get a 200 with data, and it looks like you found a leak. Often it is not: the server returns an empty page, a generic error that also answers 200, or your own data because the identifier landed on an object of yours. The difference between a finding and a mirage is not in the request, it is in the controls around it.

Two accounts, always

The basic object-level authorization test needs two identities, A and B, each with their own objects. Then you cross them: have A ask for B's object. But one direction is not enough.

  • A asks for B's object: does it come back? (the bug you are after)
  • B asks for A's object: does it too? (confirms it is systemic, not a one-off grant)
  • A asks for its own object: it must work (positive control: the route exists and answers)
  • A asks for a non-existent object: it must fail (negative control: you tell "unauthorized" from "not found")

The length-matched control

The most common false positive: you ask for someone else's object, get a 200 of 15,000 bytes, and call it a leak. But maybe that endpoint returns 15,000 bytes for any input, because it paints an error template or an empty page. Response size on its own proves nothing.

The way to kill it is a length-matched control: repeat the request with a same-length but meaningless parameter, so the only possible difference is whether the server uses your value. If the real response and the control are byte-for-byte identical, your parameter is not being consumed, and there is no bug.

real:    GET /page?function=ADMIN_EXPORT   -> 200, 15,371 bytes
control: GET /page?zzzzzzzz=ADMIN_EXPORT   -> 200, 15,371 bytes

# Same size, byte for byte: the parameter name changes nothing.
# The server does not consume "function". No finding.
The idea, in pseudo-tests

The whole lifecycle, not one verb

An owner check on the read says nothing about the write. An object has a life: it is created, read, updated, cancelled, reopened, deleted. Each transition is a different endpoint, and authorization may be present in some and missing in others.

The usual mistake is to test the GET, see it protected, and call the whole family safe. Enumerate every verb on the object and test each with the same crosses. The bug tends to live in the verb no one reviews: the reopen, the cancel, the resolve.

Pace and noise

Two practical details that wreck a test run:

  • Pace: a many-threaded sweep over a single egress tunnel causes resets that look like the target blocking you and are not. Slow down before you read a result matrix as a real pattern.
  • Browser-extension noise: wallets, translators and blockers inject scripts and trigger CSP violations that are not the site's. Repeat the test in a clean profile before you write anything down.

The takeaway

An authorization finding holds up when you can show all four corners: your object works, someone else's works too, the non-existent one fails, and the length-matched control rules out the server ignoring your input. Without those controls you have a screenshot; with them you have a finding a team can reproduce and fix.

Everything here is generic. We never describe a specific flaw in a client or a bug-bounty program, neither while it is unfixed nor after.

Back to research