Multi-Tenant (SaaS) Pen Testing
Proving one customer can never reach another
SaaS products serve many customer organisations (tenants) from the same application and often the same database. The most serious bug a SaaS can have is one tenant seeing or changing another tenant's data. A multi-tenant pen test focuses on exactly that, across every place tenants share infrastructure.
Advanced · 5 steps
| Main risk | Cross-tenant data access |
|---|---|
| Test setup | Two tenants, each with admin + user accounts |
| Where it breaks | IDs, headers, caches, search, files, jobs, SSO |
| Related | CWE-639, OWASP API1 BOLA |
| Strong fix | Tenant from session + database row-level security |
| Prevent regressions | Automated cross-tenant tests in CI |
Step by step
Set up two tenants And learn how the tenant is chosen
The tester gets two test organisations, Acme and Globex, each with an admin and a normal user. First they learn how the app decides which tenant a request belongs to: a subdomain, a header like
X-Tenant-ID, an ID in the URL, or a claim inside the login token. Every place the tenant can be supplied is a place to test.Swap tenant identifiers Headers, URLs and IDs
Logged in as Acme, the tester changes
X-Tenant-IDto 202 and requests Globex invoice IDs. Most endpoints correctly use the tenant from the token and refuse. But the report export endpoint trusts the header, and returns Globex's invoices to an Acme user.Shared components Cache, search and files
Isolation often fails outside the main database. The tester checks whether cached pages are keyed by tenant (they are), whether search returns other tenants' documents (it doesn't), and whether file links can be guessed. Invoice PDFs live at predictable paths and the download link doesn't check the tenant.
Admin, invites and SSO Features that cross tenants on purpose
Some features are designed to cross boundaries, so they get extra attention: inviting a user who already belongs to another tenant, background exports and webhooks that run as "system", single sign-on settings per tenant, and the vendor's support impersonation tool. Here, an Acme admin can't attach their SSO provider to Globex's email domain: good.
Report and fix at the root One rule, enforced everywhere
Both findings share a root cause: some code takes the tenant from the request instead of the session. The fix is to derive the tenant from the session in one place, add database row-level security as a safety net, and add an automated test that calls every endpoint as Acme with Globex IDs on every build.
Best practices
- Take the tenant only from the authenticated session, never from a URL, header or body field
- Enforce isolation in the database too (row-level security or tenant-scoped connections)
- Include the tenant in every cache key, search query, storage path and queue message
- Audit support "impersonation" features and log every use
- Run automated tests that try every endpoint with another tenant's IDs
More in Penetration Testing.
Packets
| No. | Time | Source | Destination | Protocol | Info | Size |
|---|