AI Security Auditing, Part 3: Audit Your API Against the OWASP API Top 10 With AI
Part 3 of the AI Security Auditing series. Use an AI agent to audit your REST and GraphQL API against every risk in the OWASP API Security Top 10 (2023) — from BOLA to improper inventory management.
AI Security Auditing, Part 3: Audit Your API Against the OWASP API Top 10 With AI
AI Security Auditing series — Part 3 of 5. Part 1: Setup · Part 2: Authentication · Part 3: API & OWASP · Part 4: Injection & XSS · Part 5: Runtime detections
If your product is API-first, this is the most important audit you'll run. APIs are the bloodstream of modern applications, and they fail in ways a web-page scanner never sees — because the vulnerability is in the authorization logic, not the markup. In this part we audit your API against the full OWASP API Security Top 10 (2023) with an AI agent.
New to the series? Start with Part 1.
The OWASP API Security Top 10 (2023)
The audit maps to all ten risks. Here's what each means and what the AI looks for in your code:
- API1 — Broken Object Level Authorization (BOLA). An endpoint takes an object ID but never checks the caller owns it (
GET /orders/1234returns anyone's order). The #1 API risk, ~40% of attacks. The audit flags handlers that read an ID from the request and query by it without an ownership check. - API2 — Broken Authentication. Weak token validation, missing expiry, JWTs accepted without signature checks. Overlaps with Part 2.
- API3 — Broken Object Property Level Authorization (BOPLA). Mass assignment (a client sets
isAdmin: true) or over-returned fields (the response leaks columns the user shouldn't see). - API4 — Unrestricted Resource Consumption. No rate limits, no pagination caps, unbounded queries — the door to denial-of-service and denial-of-wallet.
- API5 — Broken Function Level Authorization (BFLA). A regular user can call an admin-only route because the check is missing or client-side.
- API6 — Unrestricted Access to Sensitive Business Flows. Automation abuse of flows like checkout, signup, or ticket purchase — technically "valid" requests, used at scale.
- API7 — Server-Side Request Forgery (SSRF). The API fetches a user-supplied URL, letting an attacker reach internal services or the cloud metadata endpoint.
- API8 — Security Misconfiguration. Debug mode in prod, open
/swagger, wide-open CORS, missing TLS, default credentials. - API9 — Improper Inventory Management. Old API versions still live, shadow endpoints, internal/test APIs exposed. Attackers love forgotten endpoints — unpatched and unmonitored.
- API10 — Unsafe Consumption of APIs. Blindly trusting data from third-party APIs you call.
Run the audit
Go to /threat-modeling/api-security and click Copy prompt. Paste it into your agent at the project root.
The prompt tells the agent to inventory every route and handler, then walk each of API1–API10 against your real implementation. When it finishes, open threat/api-security/api-security-code-findings.html.
What the findings look like
An API audit typically surfaces:
- BOLA on
GET /api/projects/:id—routes/projects.js:28, critical. Reads:idand queries by it with noWHERE owner_id = currentUsercheck. - Mass assignment on
PATCH /api/users/:id—routes/users.js:64, high. Spreads the whole request body into the update, so a client can setrole. - No pagination cap on
GET /api/events—routes/events.js:12, medium.?limit=1000000will happily try to return everything. - Shadow endpoint
/api/v1/internal/export—routes/legacy.js:5, high. An old, undocumented route with no auth middleware.
Every finding points at a file:line. Fix the criticals first — BOLA and BFLA are the ones attackers reach for.
Don't forget the adjacent surfaces
The OWASP API Top 10 prompt covers REST. If your API includes other shapes, run these alongside it:
- GraphQL: /threat-modeling/graphql-security — introspection, query depth/cost, batching, resolver authorization.
- Webhooks: /threat-modeling/webhooks — inbound signature/replay verification and outbound SSRF on dispatch.
- Realtime: /threat-modeling/realtime-websocket-sse — authz and resource use on long-lived connections.
For a deeper, standalone reference on the framework itself, see OWASP API Security Top 10 (2023): a developer's guide with AI audit prompts.
Code fixes close holes; detection catches attempts
Two OWASP API risks — API4 (Unrestricted Resource Consumption) and API6 (Sensitive Business Flows) — can't be fully solved in code, because the individual requests are valid. The attack is the volume and pattern. That's a runtime-detection problem by nature.
Open api-security-detection-mitigation.html for the rules: flag an IP flooding a single endpoint, flag distributed enumeration of sequential object IDs (BOLA probing), flag automation against a sensitive business flow. Related deep dives:
- API attack surface discovery & mapping — find the shadow endpoints from API9.
- Anatomy of an API abuse campaign: detection to remediation.
We turn the detection logic into running rules in Part 5.
Checklist before you move on
- Ran the API security prompt and reviewed the code-findings report
- Fixed all BOLA/BFLA (API1/API5) findings — these are the priority
- Ran the GraphQL and/or webhooks prompts if they apply
- Skimmed the detection-mitigation report for API4/API6 rules
- Committed the reports to version control
Next
APIs fail on authorization. The next class of bug fails on input — data that gets executed instead of stored. That's injection, XSS, and SSRF, and it's Part 4.
Frequently Asked Questions
What is the OWASP API Security Top 10?
The OWASP API Security Top 10 (2023) is the standard list of the ten most critical API security risks: API1 Broken Object Level Authorization (BOLA), API2 Broken Authentication, API3 Broken Object Property Level Authorization, API4 Unrestricted Resource Consumption, API5 Broken Function Level Authorization, API6 Unrestricted Access to Sensitive Business Flows, API7 Server-Side Request Forgery, API8 Security Misconfiguration, API9 Improper Inventory Management, and API10 Unsafe Consumption of APIs.
Can AI detect BOLA and IDOR vulnerabilities?
Yes. Because BOLA/IDOR is a missing-check pattern — an endpoint that takes an object ID but never verifies the caller owns that object — an AI agent reading your route handlers is well suited to flagging it. BOLA is the number-one API risk and roughly 40% of API attacks, so it's the first thing the API audit looks for.
Does the API audit cover GraphQL?
The OWASP API Top 10 prompt covers your HTTP/REST surface. For GraphQL-specific risks — introspection exposure, query depth and cost, batching abuse, and resolver-level authorization — use the dedicated GraphQL security prompt at /threat-modeling/graphql-security alongside it.
Recommended reading
Part 1 of the AI Security Auditing series. Set up an AI coding agent to audit your application's security locally — install SecureNow, connect your account, and run your first threat-model pass in minutes.
Jul 24A practical, end-to-end guide to auditing your application's security with an AI coding agent — find vulnerabilities at the code level, build detections at the runtime level, and never upload your codebase to do it.
Jul 24Part 2 of the AI Security Auditing series. Use an AI agent to audit your login, session, MFA, password-reset and magic-link flows for account-takeover paths — then catch the attempts in live traffic.
Jul 23