Sample alert How it works Coverage PENTEST METHODOLOGY DOCS PRICING FAQ MCP CONTACT LOG IN SCAN MY APP →

How to test broken access control in SaaS apps

GUIDE / ACCESS CONTROL

To test broken access control, sign in as two users from two organizations. Record the requests of the first user and replay them with the session of the second user. If the server returns data where it must return 401, 403 or 404, the access control is broken. This guide gives one request-level test for each class of OWASP A01:2021.

What do you need before you start?

You need three things. Each one is easy to get.

  1. Two test accounts in two separate organizations. Call them user A and user B.
  2. One account with a low role (member) and one with a high role (admin) in organization A.
  3. A tool that sends raw HTTP requests, such as curl, OWASP ZAP or a proxy.

Only test systems that you own, or systems that you have written permission to test. Use data that you created for the test.

The examples below use these shell variables:

BASE=https://app.example.com
TOKEN_A=<session token of user A, organization A>
TOKEN_B=<session token of user B, organization B>
TOKEN_MEMBER=<session token of a member in organization A>

This page covers the request layer. It tests what the HTTP API accepts. For the role matrix, see SaaS privilege escalation. For tests of the data layer, such as RLS, caches and storage, see how to test multi-tenant isolation.

Which classes of broken access control must you test?

The table lists the seven classes in this guide. Each class has one test below.

Class What the flaw is Signal that the test found it
IDOR / BOLA The server accepts an object ID that the caller does not own 200 with another user’s data
Missing function-level check A low role can call an admin endpoint 200 or 204 from a member session
Forced browsing A hidden URL has no access check 200 on an unlinked path
Mass assignment The server writes fields the user must not set A role or owner field changes
CORS misconfiguration The server trusts any origin with credentials The origin is reflected with credentials allowed
JWT or session tampering The server trusts claims that the client can edit A changed token is accepted
Path-based bypass A rule matches the path text, not the resolved route An encoded or changed path returns 200

How do you test for IDOR and BOLA?

An IDOR (insecure direct object reference) happens when an endpoint takes an object ID and does not check who owns the object. In an API, the same flaw has the name BOLA (broken object-level authorization). See the BOLA pattern write-up for how generated CRUD code causes it.

  1. Sign in as user A. Create an object, for example an invoice. Note its ID.
  2. Sign in as user B. Make sure that B cannot see the object in the UI.
  3. Request the object of A with the token of B.
curl -i -H "Authorization: Bearer $TOKEN_B" \
  "$BASE/api/invoices/INV_ID_OF_A"

If the response is 200 with the invoice, the endpoint is open. A correct server returns 404 or 403.

Do the same test for every verb. A server can protect GET and forget PUT or DELETE.

curl -i -X PUT -H "Authorization: Bearer $TOKEN_B" \
  -H "Content-Type: application/json" \
  -d '{"status":"void"}' "$BASE/api/invoices/INV_ID_OF_A"

Then examine four places where IDs hide:

  • Query parameters, such as ?org_id= or ?user_id=.
  • Request bodies that contain a foreign key.
  • Headers, such as X-Org-Id.
  • List endpoints. Search and export filters often skip the owner filter.

Sequential IDs make the attack easy. Random IDs (UUIDs) do not fix the flaw. They only make the ID harder to guess. The ownership check is the fix.

How do you test for missing function-level checks?

A function-level check decides if a role may call an action. The UI hides the admin button, but the API can still accept the call. Test the API directly.

  1. Sign in as an admin. Do each admin action in the UI, such as “invite user”, “delete project” and “change plan”.
  2. Save each request from the network tab.
  3. Replay each request with the member token.
  4. Replay each request with no token.
curl -i -X POST -H "Authorization: Bearer $TOKEN_MEMBER" \
  -H "Content-Type: application/json" \
  -d '{"email":"new@example.com","role":"admin"}' \
  "$BASE/api/orgs/ORG_ID_OF_A/invitations"

If the server returns 200, 201 or 204, a member can do an admin action. A correct server returns 403. With no token, a correct server returns 401.

Look also for admin routes that the UI never calls. Common names are /api/admin/users and /api/debug.

How do you test for forced browsing?

Forced browsing means that a user requests a URL that the app does not link to. If the server does not check access, the user gets the page.

  1. Collect all URLs from the JavaScript bundle. Search for strings that start with /api/ or /admin.
  2. Add the paths from robots.txt, sitemap.xml and any OpenAPI file at /openapi.json or /swagger.json.
  3. Request each path with no token and then with the member token.
curl -s "$BASE/static/js/main.js" | grep -oE '"/(api|admin|internal)[^"]*"' | sort -u

curl -o /dev/null -s -w "%{http_code}\n" \
  -H "Authorization: Bearer $TOKEN_MEMBER" "$BASE/admin/users"

Any 200 on a path that your role matrix marks as “denied” is a finding. Also check for files that must not be public, such as /.env, /.git/config and backup files. The security checks reference lists the file types that VibeEval tests.

How do you test for mass assignment and role fields?

Mass assignment happens when the server copies the full request body into a record. The user can then set fields that the UI never shows. Typical fields are role, is_admin, org_id, owner_id, plan and verified. See the mass assignment pattern for more detail.

  1. Send a normal profile update and note the fields in the response.
  2. Add one extra field to the same request.
  3. Read the object again and check if the field changed.
curl -i -X PATCH -H "Authorization: Bearer $TOKEN_MEMBER" \
  -H "Content-Type: application/json" \
  -d '{"name":"Test","role":"admin","org_id":"ORG_ID_OF_B"}' \
  "$BASE/api/me"

curl -s -H "Authorization: Bearer $TOKEN_MEMBER" "$BASE/api/me"

If role or org_id changed, the server trusts the client. A response of 200 is not enough. The server can ignore the field and still return 200. Always read the object again.

How do you test for CORS misconfiguration?

CORS (cross-origin resource sharing) controls which websites can read responses from your API in a browser. A bad rule lets a hostile website read private data with the cookies of the victim. The MDN CORS guide explains the headers.

  1. Send a request with an Origin header that you control.
  2. Read the Access-Control-Allow-Origin and Access-Control-Allow-Credentials headers in the response.
curl -s -D - -o /dev/null -H "Origin: https://evil.example" \
  -H "Authorization: Bearer $TOKEN_A" "$BASE/api/me" | grep -i '^access-control'

curl -s -D - -o /dev/null -H "Origin: null" \
  -H "Authorization: Bearer $TOKEN_A" "$BASE/api/me" | grep -i '^access-control'

Use this table to read the result.

Response header Meaning
Access-Control-Allow-Origin: https://evil.example and Allow-Credentials: true The server reflects any origin. This is a finding.
Access-Control-Allow-Origin: null and Allow-Credentials: true The server trusts the null origin. This is a finding.
Access-Control-Allow-Origin: * with no credentials Acceptable for public data only.
No CORS headers The browser blocks cross-origin reads. This is the safe default.

Also test an origin that ends with your domain, such as https://app.example.com.evil.example. A weak check on the end of the string lets it pass. The CORS credentials pattern shows the code that causes the flaw.

How do you test for JWT and session tampering?

A JWT (JSON Web Token) has three parts. The server must check the signature before it trusts any claim. If the server trusts a claim without a check, the user can edit the claim.

  1. Decode the payload of your own token. Note the claims, such as sub, role and org_id.
  2. Change one claim. Send the token again.
  3. Remove the signature, or set the algorithm to none. Send the token again.
  4. Send an expired token.
  5. After you sign out, send the old token again.
PAYLOAD=$(echo -n '{"sub":"USER_ID_OF_B","role":"admin","org_id":"ORG_ID_OF_A"}' \
  | base64 | tr '+/' '-_' | tr -d '=')
HEADER=$(echo -n '{"alg":"none","typ":"JWT"}' | base64 | tr '+/' '-_' | tr -d '=')

curl -i -H "Authorization: Bearer $HEADER.$PAYLOAD." "$BASE/api/me"

If the response is 200, the server accepts an unsigned token. A correct server returns 401.

Test Correct result Finding if
Changed claim, old signature 401 200
Algorithm none 401 200
Expired token 401 200
Token after sign-out 401 200
Token with no exp claim Policy decision Token never expires

For the alg: none and kid attacks in more detail, see the JWT pattern write-up. For cookie sessions, copy a session cookie before sign-out and send it again after sign-out. The server must reject it.

Also check where the role comes from. If a Supabase app reads the role from user_metadata, the user can change it. The Supabase anon key guide shows how to test this.

How do you test for path-based bypass?

Some apps protect a route with a rule that matches the text of the path. A proxy, a framework middleware or a WAF can apply the rule. If the rule and the router read the path in different ways, a request can pass the rule. It then still reaches the protected route.

  1. Find a path that returns 403 or 401, for example /admin/users.
  2. Request the same route with changes to the path.
  3. Compare each response code with the original.
for p in "/admin/users" "/admin/users/" "/ADMIN/users" "//admin/users" \
  "/admin/./users" "/admin%2fusers" "/admin/users;x=1" "/admin/users.json"; do
  printf "%s " "$p"
  curl -o /dev/null -s -w "%{http_code}\n" \
    -H "Authorization: Bearer $TOKEN_MEMBER" "$BASE$p"
done

Also test the HTTP method and the headers:

  • Change GET to POST, PUT or HEAD.
  • Add X-HTTP-Method-Override: GET.
  • Add X-Original-URL: /admin/users or X-Rewrite-URL: /admin/users to a request for an open path.
  • Request an old API version, such as /api/v1/ when the app uses /api/v2/.

Any response that differs from the original 403 and returns data is a finding. Old API versions are a common source of results. The team often fixes the new version and leaves the old one open.

How do you read the results?

Use the response code and the body together.

Response Meaning
200 with the other user’s data Confirmed finding
200 with an empty list Probably safe. Check that the filter is on the server.
403 The server knows the object exists. This is a small information leak.
404 Best result. The server hides the object.
401 The session is not valid. Check the token first.
500 The server crashed on the input. Examine it, because the check can be missing.

Make sure that your control request works. Send the same request with the owner’s token. If the owner also gets an error, the test proves nothing.

What must you do after you find a flaw?

  1. Write the failing request as a test. Keep the curl command or the test code.
  2. Enforce the check on the server. Use the session to find the user and the organization. Do not read them from the request.
  3. Return 404 for objects that the caller does not own.
  4. Allow only a list of known fields on write endpoints.
  5. Set a strict list of trusted origins for CORS.
  6. Verify the JWT signature, the algorithm, the expiry and the audience on each request.
  7. Run the test again after the fix, and keep it in your build.

The OWASP Authorization Cheat Sheet lists the design rules in detail. The page on security regression testing explains how to keep each fixed flaw as a permanent test.

How does VibeEval help with these tests?

VibeEval runs black-box tests on a deployed app. You can give a scan a bearer token, a cookie or a login form, and the scanner attaches it to every request. The security checks list includes BOLA and IDOR, mass assignment, authorization bypass, CORS and JWT weaknesses. The AI pentest for SaaS page describes the multi-tenant checks. Each finding in the findings view includes the captured request and response, so you can replay it. The scanner covers the request layer. It does not read your source code, and it does not replace a review of your RLS policies.

Reviewed against OWASP and MDN documentation on November 18, 2026.

Common questions

What is broken access control?
Broken access control is a flaw where the server lets a user do something the user must not do. The user can read another user's data, call an admin function, or change a record that belongs to someone else. OWASP lists it as A01 in the 2021 Top 10.
How do I test broken access control without a pentest team?
Create two accounts in two organizations. Sign in as each one and save the requests. Replay the requests of account A with the token of account B. If the server returns data or a success code, the control is broken.
What is the difference between IDOR and BOLA?
The two names describe the same flaw. IDOR is the older web term. BOLA is the API term from the OWASP API Security Top 10. In both cases, the server accepts an object ID without a check of who owns the object.
Can I test access control only in the browser?
No. The browser shows only the buttons the UI allows. The API often accepts more requests than the UI sends. Send requests directly with curl or a proxy to test the server and not the interface.
Is it safe to run these tests on production?
Use test accounts that you own and data that you created. Use read requests first. Do not run write or delete tests against real customer data. Use a staging copy for destructive tests when you can.
How often must I repeat these tests?
Repeat them after each release that adds or changes an endpoint, a role or a policy. Put each fixed finding into an automated test so the same flaw cannot return unseen.

Test access control on your live app

VibeEval scans your deployed app with an authenticated session and tests object-level access, mass assignment and CORS. Each finding includes the request and response that proved it.

14-day free trial · Cancel anytime

SCAN YOUR APP →