Vulnerability class

How to prove tenant isolation is broken across a multi-tenant app

Updated

Tenant isolation is broken when a request from one tenant returns or affects data belonging to another. Test it on every read path — list, search, aggregate, export, cache — because the scoped ORM query is usually correct and the thing next to it is not.

Where this class of bug actually lives in a multi-tenant app

  • Joins that ignore tenancy. The main table is scoped, the joined table is not, and a LEFT JOIN on a guessed key crosses the boundary.
  • Searches and aggregates. Full-text search and reporting queries are often written against a raw connection where the tenancy predicate was forgotten.
  • Caches keyed without tenant. A cache key of user:{id}:dashboard is fine; dashboard:{id} where the id is shared serves one tenant's data to another.
  • Background jobs. A worker that processes by id without re-checking tenancy writes into the wrong tenant after a queued job outlives the request.

What to try first

  1. Seed one distinctive record per tenant, then read every list, search and report endpoint as the other tenant and grep the response for the marker.
  2. Check cache headers and cache keys for anything tenant-independent.
  3. Trigger a long-running job and change the record's tenant mid-flight, where the app allows it.
  4. Hit aggregate endpoints — counts, totals, exports — which often run a different query path than the list view.

A reproduction you can keep

Seed a marker, then read as the wrong tenant. Grep is the assertion:

Marker-based isolation test
# as tenant B, read every list-ish endpoint and look for A's marker
for p in /api/invoices /api/search?q=marker /api/reports/summary /api/export; do
  echo "== $p"
  curl -sS "https://staging.example.com$p" \
    -H 'Authorization: Bearer ***' | grep -c 'TENANT_A_MARKER'
done

# vulnerable: any non-zero count
# fixed: all zero, and the same request from tenant A returns the marker

What "fixed" has to look like

Every query path — including search, aggregates, exports and cache reads — must carry the tenant predicate, and the answer is verified by reading as each tenant and asserting the other's marker is absent. Do not accept a fix that only touches the ORM list view.

Where people get this wrong

  • A shared cache in front of a scoped query undoes the scoping. Vary on the tenant, not the user.
  • Admin and support tooling is usually exempted from tenancy on purpose, which makes it the easiest cross-tenant read in the app.
  • Testing with records that are identical between tenants hides the leak. Seed something distinctive.

What Offense does here

Offense runs an agent swarm against your app in a disposable sandbox, keeps the request, the identity and the vulnerable response as evidence, and replays the same attack after the fix so the retest is a control comparison rather than a green check. It does not read your source and it does not patch your code: the finding goes to your coding agent with the reproduction attached. The hosted workspace is invite-only — join the waitlist — and the free dependency audit in /install needs no account.

Questions this page answers

How do I test tenant isolation without production data?

Seed one record per tenant with a unique string, then read every path as the other tenant and grep for it. Synthetic markers work as well as real data.

Why does a correctly scoped ORM query still leak?

Because search, reports, exports, caches and jobs often bypass the ORM. The scoped query is one of several read paths.

Written by Offense Research, reviewed December 2, 2026. Correct something? Email imran@offenseresearch.com.