Research

Business logic: where AI agents beat scanners and where humans still win

The most expensive web bugs often use perfectly valid requests. A scanner sees nothing wrong, because technically nothing is. Here is what changes when the tester can reason about intent, and what still needs a person.

What a business logic flaw is

A business logic flaw is a gap between what the application allows and what the business intended. The code does exactly what it was written to do. It just was not written to stop something.

Typical examples we look for:

  • a discount code that can be applied twice, or combined with another code that was meant to be exclusive;
  • a price, quantity or currency that the client sends and the server trusts;
  • a multi-step flow, such as checkout, KYC or account recovery, where a later step can be called without completing an earlier one;
  • a refund or credit that can be triggered more often than the original payment;
  • an invitation flow that lets a member grant a role higher than their own;
  • a free trial or usage limit that resets when an identifier changes;
  • a race between two requests that both pass a balance check before either one is recorded.

OWASP gives this its own chapter in the Web Security Testing Guide (WSTG 4.10, Business Logic Testing), and the OWASP API Security Top 10 2023 lists a close relative as API6:2023, Unrestricted Access to Sensitive Business Flows.

Sources: OWASP WSTG v4.2 · OWASP API Security Top 10 2023

Why scanners cannot see them

A dynamic scanner works by sending payloads that should never be accepted and watching for signatures that should never appear: a SQL error, a reflected script, an unexpected file. Business logic abuse has no such signature. Applying a coupon twice is two well-formed requests that each return 200 OK. Skipping a checkout step is a valid call to an endpoint the user is allowed to reach. The response looks normal. Only the outcome is wrong.

To notice that, the tester needs three things a scanner does not have: a model of what the application is for, the state across several requests, and an expectation of what should have happened. That is why these flaws have historically been found by human testers and bug bounty hunters, and why PortSwigger's Web Security Academy, a widely used free training resource for web testers, teaches business logic as its own category of labs.

Source: PortSwigger Web Security Academy, all labs

Where AI agents do better

Language-model agents change two of those three ingredients. They can build a working model of what an application is for by reading it: page text, field names, API documentation, JavaScript, error messages. And they can keep state across a long sequence of requests, comparing what happened with what the application itself says should happen.

From our own work in lab apps seeded with business logic flaws, a few patterns stand out where agents do well.

  • Exhaustive variation of a known flow. Once an agent has mapped checkout, it can systematically try every step out of order, every parameter negative, zero or very large, every coupon combination, and every currency. A human tester knows to do this but rarely has time to do all of it.
  • Reading the rules the app states about itself. "One code per order", "Admins can invite members", "Trial lasts 14 days". Agents turn these sentences into testable hypotheses and try to break each one.
  • Comparing roles and tenants. Many logic flaws are authorisation flaws in disguise. With several test accounts, an agent can compare what each role can do at each step, which is tedious and error-prone by hand.
  • Persistence. Agents do not get bored on the fortieth variant of the same request, and the fortieth variant is sometimes the one that works.

There is public evidence that structure matters a lot here. Research on teams of agents, with a planner directing specialised sub-agents, showed large gains over single agents on real vulnerabilities.

Source: Zhu et al., arXiv 2406.01637

Where humans still win

We are equally clear about the limits we observe.

  • Knowing what is actually forbidden. An agent can infer that a coupon should not stack. It cannot know that your enterprise customers are contractually allowed to stack two codes, or that a negative quantity is how your warehouse team records returns. A human who asks one question on a call resolves what an agent would otherwise report or miss.
  • Judging impact. Getting a free month on a trial and moving money between customer accounts are both logic flaws. Ranking them needs an understanding of your business that a CVSS vector does not capture well.
  • Flows that leave the application. Real processes run through payment providers, email inboxes, identity providers and back-office tools. Agents work well inside the scope they can see. People are better at reasoning about the parts they cannot.
  • Novel ideas. The best logic bugs come from a creative leap: "what if I cancel the order while the refund is processing?" Agents generate many ideas, but the truly odd ones still come more often from experienced people.
  • Deciding when to stop in production. Some logic tests, such as races on a balance, are only safe to prove with care. A senior tester's judgement about what is safe to try belongs in that decision.

Our approach: agents propose, replay proves, people judge

We split the work along those lines.

Dedicated agents map each business flow during recon and write down the rules they believe the flow should enforce. They then try to break each rule with the test accounts you supply, using small, reversible actions: a coupon applied to a test order, not a real purchase; a role changed on a test account, not on a real user. Race conditions are proven with the smallest number of parallel requests that shows the effect.

Nothing is reported on an agent's say-so. A candidate logic flaw must be replayed and must produce an observable state change that contradicts the stated rule, for example a total that is lower than it should be, or a role that is higher. Findings that rest on an assumption about your business rules are labelled as such, with the assumption written out, so you can dismiss them in seconds if the behaviour is intended.

For the sign-off tier, a senior pentester reviews every logic finding, discusses the business rules with you where it matters, and hand-tests the critical flows: payment, account recovery, privilege changes and anything an agent flagged as suspicious but could not prove.

How you can help the test

  • Give us test accounts in at least two roles and, if you are multi-tenant, two tenants.
  • Tell us the three rules that would hurt most if broken: "a member can never see another company's invoices", "a refund never exceeds the payment".
  • If payments are involved, point us at a sandbox or test mode, so agents can complete the flow without real money.
  • Prefer staging if your production data or side effects are sensitive. We note it in the report.

15-minute call

Talk to our team

A 15-minute call about your app, your deadline and what your auditor, insurer or customer needs to see.