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 riskCross-tenant data access
Test setupTwo tenants, each with admin + user accounts
Where it breaksIDs, headers, caches, search, files, jobs, SSO
RelatedCWE-639, OWASP API1 BOLA
Strong fixTenant from session + database row-level security
Prevent regressionsAutomated cross-tenant tests in CI

Step by step

  1. 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.

  2. Swap tenant identifiers Headers, URLs and IDs

    Logged in as Acme, the tester changes X-Tenant-ID to 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.

  3. 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.

  4. 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.

  5. 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

More in Penetration Testing.