The two-account test is the fastest way to learn whether one customer can see another customer's data. You create two test accounts with fake records, sign in as one, and try to reach the other's records by changing IDs in the address bar, API calls, exports and file links. If anything comes back that the first account should not see, you have found broken access control, the flaw OWASP ranks first in its 2025 Top 10.

What is broken access control?

Access control is the set of rules that decides what each user may see and do. Broken access control means those rules can be skipped. The OWASP Top 10 entry for broken access control keeps it at number one for 2025 and reports that 100% of the applications tested had some form of it. Its examples include viewing or editing someone else's account by supplying its ID, changing a URL to get past a check, and APIs that lack checks on create, update and delete requests.

Apps built with AI tools follow the same pattern. In a 2026 audit of 200 live apps written mostly by AI, broken access control was the most common category of flaw and appeared in 64% of the apps. The paper is a preprint and has not been peer reviewed.

The most common form has its own name. An insecure direct object reference, or IDOR, happens when the app takes an ID from a request, such as an invoice number, and returns the record without checking who owns it. The OWASP API Security Top 10 calls the same flaw broken object level authorization and says attackers exploit it by changing the ID of an object sent in the request.

Before you start: the ground rules

  • Test only your own app. Never probe a system you do not own or have written permission to test.
  • Use a staging copy if you have one. If you must test production, use only accounts and records you create for the test, and delete them afterward.
  • Use synthetic records with obviously fake names, like Test Patient Alpha. Never use real customer, patient or card data.
  • Create User A and User B at the same permission level. Add an admin account if your app has admin features. If your app has organizations or teams, put A and B in different ones.
  • Give each account a few records with distinct content, so you can tell at a glance whose record came back.
  • Open your browser's developer tools and keep the Network tab visible, so you can see each request the app makes.
  • Write down each attempt and its result.

The OWASP Web Security Testing Guide recommends at least two users, and often more, so the test covers different owned objects and functions.

Step by step: what to try

Sign in as User B first and note the IDs of B's records. You will find them in page addresses and in the responses on the Network tab. Then sign out, sign in as User A, and work through this list.

  1. Change IDs in the address bar. Open one of A's records, then swap in one of B's IDs. If IDs are sequential numbers, try the ones next to yours too.
  2. Replay API calls with B's IDs. In the Network tab, find the request that loads a record, copy it, change the ID and send it again. Try reading, editing and deleting.
  3. Probe list and search endpoints. Remove or change filters such as a user or organization ID in the request, ask for the next page, or ask for a larger page size. Check whether any of B's rows appear.
  4. Try exports and reports. CSV and PDF downloads often run through different code than the screens do.
  5. Test file links. Upload a file as B and copy its link. Open it as A, then while signed out, then a day later to see whether the link expires.
  6. Visit admin routes as a normal user. Try likely paths such as /admin, and replay admin actions you saw in the admin account's traffic using A's session.
  7. Switch tenants. If A belongs to one organization, change the organization ID in requests to B's. Check any organization switcher the app has.
  8. Write someone else's ID. Create or update a record and set its owner or organization to B's. Try changing fields like role, plan or paid status on A's own account.
  9. Repeat it all signed out. Every request that worked for A, send again with no session at all.

What about roles and teams?

The steps above test sideways access, where one user reaches another user's data at the same level. Apps with roles need an upward test too. OWASP lists elevation of privilege among the common forms of broken access control, which means acting with rights you were never given. Sign in as your lowest role, such as a viewer or a basic member, and try every action a higher role can take:

  • Inviting or removing users
  • Changing billing, plans or permissions
  • Deleting records you are only allowed to view
  • Exporting everything
  • Opening other people's files in a shared workspace

If your app has organizations, add a test user who belongs to two of them. Switch between them and confirm that each organization's records stay inside it.

How to read the results

What you seeWhat it meansWhat to do
B's data comes back to ABroken access control on readsFix it before any real data goes in
A can change or delete B's recordBroken access control on writesFix it first, because it can corrupt data
Data comes back with no sessionAnyone on the internet can read itFix it now, and check whether real data was exposed
A can set their own role, plan or paid statusThe server trusts the browserMake those fields writable only by the server
The button is hidden but the API call worksThe check lives only in the interfaceAdd the check on the server
An error such as 401 or 403, or an empty resultThe rule held for that requestRecord it and move on

Read the response body as well as the status code. Some apps return a success code with someone else's data inside, and an error on screen can hide a response that still carried the data.

What to fix when the test fails

  • Check ownership on the server, on every request. OWASP's guidance is to deny by default, except for public resources, and to have access controls enforce record ownership.
  • Take the user from the session. Never trust a user ID, role or organization ID sent by the browser.
  • Fix the database rules if the browser talks to the database. In Supabase apps, that means row level security policies, covered in the Supabase row level security guide.
  • Use random IDs as a second layer. OWASP's API list recommends random, unpredictable IDs, which make guessing harder. IDs still leak through shared links, exports and logs, so the ownership check stays essential.
  • Turn each failure into an automated test. OWASP says developers and QA staff should include functional access control in their unit and integration tests.
  • Log failed access attempts and alert an admin when appropriate, as OWASP also recommends.

Then run the whole test again with the same two accounts. A fix is done when the attempt that used to work now fails.

Run the test again whenever you add a table, an endpoint, a role or a new kind of record, and after any AI-written change to access rules. Keep the two test accounts and their fake records, so each rerun is quick.

Why do scanners struggle with this flaw?

A scanner sees code and traffic. It does not know that invoice 1042 belongs to a different customer than invoice 1041. In a November 2025 study by Semgrep, which sells AI-assisted code scanning, Claude Code found 13 real IDORs among 59 reports. When the authorization checks were spread across the app or handled by middleware, it found none (0 of 19 and 0 of 18), and the authors concluded that a human in the loop remains essential.

Automated penetration tests have a related limit. Lovable's docs for its Aikido pentest say that without test-user credentials, testing is limited to unauthenticated flows. If you run an automated test, give it your two test accounts. We explain why AI coding tools miss these rules in the first place in Why AI Coding Tools Miss Access Control, and what the built-in scans do cover in Your AI Builder's Security Scan Is Not a Security Review.

Run it this week

Set aside some time, create two test accounts, and work through the list. Then take the free 2-minute self-check to see what else to look at, and read the pre-launch security checklist for the other nine checks.

If you would rather have us run it, a two-account access test with fake records is part of every Compliance Readiness Review. We tie each finding to the SOC 2, HIPAA or PCI DSS requirement it affects and include one re-check after the fixes.