Skip to content

The API flaw OWASP ranks #1, and how to test for it with two accounts

Most API breaches need no special tooling, only a changed ID. What API security testing should check first, how to run it with two accounts, and when your API needs a penetration test.

Defence Lab Team1 December 20265 min read

If API security testing sounds like something that does not apply to you, look at your product from the other side. Every time someone uses it, something has to answer them, and that answer comes through an API connection. When an end user taps a button to open an order or save a form, the screen sends a request to the server and waits for data. When a developer connects a mobile app, a new integration or any script, they actually do the same - send requests, with just no screen in between. So the API answers anyone who sends a request, not only the people clicking through your interface. That connection carries real risk, yet API security testing, which checks what the server hands out and to whom, is often skipped, because once the product is launched, the focus moves to something else. The most common API security vulnerabilities are easy to exploit, often with nothing more than a changed ID in a request, and OWASP rates them just as easy to find for someone who knows how to look. API penetration testing looks for exactly this, request by request.

In February 2026, a backend change at the app builder Lovable brought back something the company had removed in 2025: access to the chat history and source code of public projects. According to Lovable's own incident report, any user with a project link could potentially read them until a researcher went public on 20 April 2026. Lovable shipped a fix within two hours and says private projects were not affected.

The API was doing its job in every visible way. Requests came from logged-in users and returned the right format. What failed was the check on whether that user should get that object, and a demo never shows that. Checking it is the core of an API penetration test, and the rest of this article shows how far you can get on your own first.

Why API security vulnerabilities survive working software

The flaw has a name: broken object-level authorisation, also known as BOLA or IDOR. A user changes an identifier in a request and receives a record that belongs to someone else. The OWASP API Security Top 10 lists it first and rates it easy to exploit. In a payments product, the same flaw can mean one customer reading another's transactions, or a refund request acting on an account the caller does not own.

Nothing about this looks broken from the front end. The screen only ever shows users their own ID, so ordinary testing passes, and demos pass too. The check is missing from a request no normal user sends.

Three habits make it more likely. Teams rely on the front end to hide what a user should not reach, so a hidden button stands in for a permission check on the server. Backend platforms such as Supabase can generate an API straight from database tables, with the access rules kept in settings nobody on the team has opened. And changes reopen old gaps, as Lovable found, so a test passed last year tells you little about this week's release.

For scale, API security vendor 42Crunch reviewed 200 real-world API vulnerabilities reported in 2024 and 2025 and found broken authentication in 23.5% and BOLA in 12.5%. That counts published reports, so it shows how often these flaws appear and says nothing about how severe each one was.

API security testing you can run with two accounts

You can run a first round of REST API security testing this week, on staging and with accounts you own.

TestHowWhere it stops
Object accessSign in as user A, capture a request for A's record, and replay it with user B's sessionCovers only the requests you captured
Tenant separationRepeat across two customer organisationsNeeds a realistic test tenant
Role limitsCall admin actions with an ordinary user's sessionNeeds a written list of what each role may do
No sessionReplay requests with no token at allFinds missing authentication only
Write actionsTry update and delete as well as read, because the check may exist on one and not the otherUse test data, since these change records
Database rulesOn Supabase and similar platforms, confirm that Row Level Security is on and tested for each tableCovers that layer only

The fix belongs on the server. OWASP's advice is to build authorisation on user policies and hierarchy, and to check, in every function that uses client input to reach a record, that the user in the current session may perform that action on that record. In practice that means keeping the ownership rule in one shared place that every endpoint calls, so a new endpoint cannot skip it, and taking the user's identity from the session instead of from a field in the request.

Then make the check permanent. OWASP advises writing tests for the authorisation logic and refusing to deploy changes that fail them, which is exactly what would catch a regression like Lovable's. Random identifiers make records harder to guess, but they do not replace a check on each request, because IDs leak through logs and other endpoints.

Keys to outside services, such as a payment provider, are a separate problem. We cover them in Your AI tools are holding your keys.

API security assessment, audit or penetration test?

These names get mixed up, so ask any supplier which one you are buying. A vulnerability assessment runs largely automated checks for known weaknesses and lists what it finds. An API security audit compares the API with a standard or an internal policy. A penetration test puts an engineer in the attacker's position, trying to use the weaknesses and connect them. "API security assessment" is used in the market for any of the three.

The two-account check above shows the obvious gaps. It will not show how small weaknesses combine, for example a predictable identifier, a broad role and a forgotten endpoint that together reach customer data. A scanner also has to be told which user should see which record, and that knowledge lives in your product. Following that path across several steps is the work of a penetration tester.

When you need API penetration testing

A pentest earns its cost at a few moments:

  • the API handles customer data, payments or anything regulated
  • a customer has asked for proof of independent security testing
  • an internal tool is about to become a product
  • a change has touched authentication, roles or tenant separation
  • nobody on the team can explain how access control works

Our API penetration testing services start by building the real endpoint inventory from traffic and gateway logs, because documentation goes stale quickly. We then test authorisation per object and per tenant, with automation for breadth and an engineer holding the chain. Critical findings reach you the day they are found, the report takes hours once testing is done, and each finding is checked again about a week after your fixes. A single application with a clear authorisation model is days of work, while a multi-service environment takes weeks.

One test answers for one moment. If your team ships every week, permissions change faster than an annual pen test can follow. DevShield, our managed security programme, keeps one ranked list of findings with an owner and a date, and verifies each month that the fixes hold.

If you are comparing API security testing services, a short scoping call is a good first step. Tell us what your API touches and who has tested it so far.

API securityauthorisationpenetration testing
Defence Lab TeamSecurity engineers at Defence Lab

The engineers who run Defence Lab assessments, incident response and security programmes, writing down what they see.

want this looked at in your company?

A short consultation: we walk your surface and show where to start.

Talk to us