# Test your API against the OWASP API Security Top 10 2023

*Authorized tests only, on an API you own or have written permission to test. 16 November 2026, Asia/Dhaka. By the Rokkhe research team.*

A browser-facing app and an API fail in related ways, but they do not fail in the same place. The current official OWASP API Security Top 10 is the **2023** edition. Its first item, broken object level authorization (BOLA), is the classic “change the id in the request and see someone else’s record” failure. You will not catch that with a CSS header scan. You catch it with two accounts and a disciplined set of requests.

This post is a testing pass of that 2023 list. It complements [post 2](https://rokkhe.hashnode.dev/test-fix-owasp-top-10-2025-web-app) on the web Top 10 2025. Use staging, use tokens you minted for the test, and do not point these requests at an API you are not allowed to test.

## TL;DR

- The official list is [OWASP API Security Top 10 2023](https://owasp.org/API-Security/editions/2023/en/0x11-t10/). Start with API1 (object) and API5 (function) authorization.
- Create two users, Alice and Bob, plus one admin. Every object-level test is “Alice asks for Bob’s id.”
- A 403 or 404 from the **server** is a pass. A 200 with Bob’s data is a finding.
- Also test property-level authorization, authentication, resource limits, SSRF, inventory and how you consume third-party APIs.
- Keep a simple inventory: endpoint, method, auth, object id, rate limit.

## Why API tests are not the same as web-page tests

Pages hide buttons. APIs often still expose the route. A mobile app, a single-page app, or a partner integration will call `/api/orders/124` whether or not the UI has a link. The 2023 API list therefore puts authorization at object, property and function level at the top, and it adds problems that are more visible on APIs than on HTML pages: unbounded resource consumption, unprotected business flows, leftover versions, and overly trusting consumption of other APIs.

You need:

- A base URL for staging, for example `https://api.staging.example.invalid`.
- A way to mint tokens or sessions for Alice, Bob and an admin (a password grant, a magic link, or your usual test harness).
- One object Alice owns and one object Bob owns (an order, a document, a message).
- `curl` or an equivalent HTTP client. The examples below use `curl`.

```bash
# Store tokens in memory for the session, not in git.
# Replace the login request with whatever your API uses.
export API='https://api.staging.example.invalid'
export ALICE_TOKEN='...'
export BOB_TOKEN='...'
export ADMIN_TOKEN='...'
export ALICE_ORDER=123
export BOB_ORDER=124
```

## Object and function level authorization (API1, API5)

**API1:2023 Broken Object Level Authorization** is the first item on the official list, and it is the test to finish before anything else. Alice, with her own token, asks for Bob’s object:

```bash
# Alice requests Bob's order. Expected: 403 or 404, not 200 with Bob's body.
curl -sS -D - -o /tmp/alice-gets-bob.json \
  -H "Authorization: Bearer $ALICE_TOKEN" \
  -H 'Accept: application/json' \
  "$API/v1/orders/$BOB_ORDER"

head -n 20 /tmp/alice-gets-bob.json
```

Repeat for mutate operations, which are often forgotten when the GET is already correct:

```bash
# Alice tries to change Bob's order. Expected: 403 or 404.
curl -sS -D - -o /tmp/alice-patch-bob.json \
  -X PATCH \
  -H "Authorization: Bearer $ALICE_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{"note":"alice should not be able to write this"}' \
  "$API/v1/orders/$BOB_ORDER"
```

Also try a **create** that sets an owner id, if the API accepts one, and a **list** endpoint (`GET /v1/orders`) to confirm Alice’s list does not include Bob’s orders.

The fix is a server-side check in every handler that loads a record: the current principal is allowed to act on **this** object, not merely “is authenticated.” Hidden fields in a client are not a check.

**API5:2023 Broken Function Level Authorization** is the other half: Alice calls an admin function.

```bash
curl -sS -D - -o /tmp/alice-admin.json \
  -H "Authorization: Bearer $ALICE_TOKEN" \
  "$API/v1/admin/users"
```

Expected: 403 or 404, not a user list. Do this for every administrative or privileged route you can find in the OpenAPI file or the mobile client. The fix is authorization on the function, usually a role or permission check that is independent of the object id.

## Property-level authorization and excess data (API3)

**API3:2023 Broken Object Property Level Authorization** combines two older names: excessive data exposure and mass assignment. The questions are: does the response include properties Alice should not see (another user’s email, a flag, an internal cost), and does the request accept properties Alice should not set (role, price, `isAdmin`)?

```bash
# Compare the fields Alice receives for her own order with the fields
# an admin receives for the same order.
curl -sS -H "Authorization: Bearer $ALICE_TOKEN" \
  "$API/v1/orders/$ALICE_ORDER" -o /tmp/order-as-alice.json
curl -sS -H "Authorization: Bearer $ADMIN_TOKEN" \
  "$API/v1/orders/$ALICE_ORDER" -o /tmp/order-as-admin.json

# Alice tries to set a privileged property on her own object.
curl -sS -D - -o /tmp/alice-mass-assign.json \
  -X PATCH \
  -H "Authorization: Bearer $ALICE_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{"role":"admin","price":1}' \
  "$API/v1/users/me"
```

A safe API has an explicit allowlist of properties for each role, on the way in and on the way out. Returning the entire ORM object “because the client will ignore extra fields” is how API3 findings start.

## Authentication, resource limits and business flows (API2, API4, API6)

**API2:2023 Broken Authentication** is about tokens, not only passwords. Check, on staging:

- Login, refresh and password-reset endpoints reject obviously invalid credentials without leaking whether the account exists, if that is your policy.
- Access tokens expire, and refresh tokens can be revoked.
- A token minted for Alice cannot be used after logout or after a password change, if that is what you claim.
- Authenticating with no `Authorization` header on a documented protected route returns 401.

Do not run credential stuffing against real users. Use the test accounts.

**API4:2023 Unrestricted Resource Consumption** is about CPU, memory, storage, and paid side effects (SMS, email, third-party API calls). From a single test account, confirm that a list endpoint cannot be asked for a million rows, that file uploads have a size limit, and that login and password-reset are rate-limited.

```bash
# Pagination: ask for an oversized page and expect a cap or a 400.
curl -sS -D - -o /tmp/big-page.json \
  -H "Authorization: Bearer $ALICE_TOKEN" \
  "$API/v1/orders?limit=1000000"
```

**API6:2023 Unrestricted Access to Sensitive Business Flows** is not always a bug in the code. It is a ticket-purchase, comment-post, or invite flow that works correctly once, and is harmful when scripted a thousand times. Rate limits, per-account quotas, and step-up authentication are the usual compensating controls. Decide what “too many” means, then test that the limit exists.

## SSRF, misconfiguration, inventory and third-party APIs (API7–API10)

**API7:2023 Server Side Request Forgery.** If any endpoint accepts a URL (webhooks, previews, imports, “fetch this avatar URL”), reuse the rule from post 2: allowlist schemes and hosts, resolve DNS, and block private ranges. Test only with destinations you control and with internal addresses on a staging network you own.

**API8:2023 Security Misconfiguration.** Look for debug endpoints (`/docs` in production if you did not mean to publish them, `/actuator`, `/graphql` introspection left on, verbose 500 bodies, missing TLS, permissive CORS such as `Access-Control-Allow-Origin: *` together with `Access-Control-Allow-Credentials: true`).

```bash
curl -sS -D - -o /dev/null \
  -H "Origin: https://evil.example.invalid" \
  -H "Authorization: Bearer $ALICE_TOKEN" \
  "$API/v1/orders/$ALICE_ORDER" | tr -d '\r' | grep -i '^access-control'
```

**API9:2023 Improper Inventory Management.** APIs accumulate versions. List what you actually expose: hostnames, versions (`/v1`, `/v2`, `/internal`), docs, and shadow copies in another region. If `/v0` or `/beta` still runs a weaker authorization check, that is a finding even if `/v2` is clean.

```bash
# Honest discovery against hosts you own. Replace the hosts.
for path in / /v1 /v2 /api /api/v1 /docs /swagger /openapi.json /graphql /health; do
  printf '%s ' "$path"
  curl -sS -o /dev/null -w '%{http_code}\n' "$API$path"
done
```

**API10:2023 Unsafe Consumption of APIs.** Your server is a client of someone else. Do not treat third-party JSON as trusted input: validate it, time out, and do not send your users’ tokens to a URL that a partner response told you to call unless that was an explicit, reviewed design. The tests here are code review plus contract tests, not attacks on the third party.

## A two-account testing script and checklist

Keep a sheet with columns: `method`, `path`, `auth`, `object id in request?`, `Alice→Bob result`, `Alice→admin function result`, `rate limit`, `version`. Fill it as you go. A small shell helper keeps the requests consistent:

```bash
# usage: api_as alice GET /v1/orders/124
api_as() {
  who=$1; shift
  method=$1; shift
  path=$1; shift
  case $who in
    alice) tok=$ALICE_TOKEN ;;
    bob)   tok=$BOB_TOKEN ;;
    admin) tok=$ADMIN_TOKEN ;;
    *) echo "unknown user"; return 1 ;;
  esac
  curl -sS -D - -o /tmp/last-body.json \
    -X "$method" \
    -H "Authorization: Bearer $tok" \
    -H 'Accept: application/json' \
    "$@" \
    "$API$path"
}
```

Checklist:

- [ ] Alice cannot read, change or delete Bob’s objects (API1).
- [ ] Alice cannot call admin or privileged functions (API5).
- [ ] Responses and request bodies are property-allowlisted per role (API3).
- [ ] Authentication failures, expiry and revocation behave as documented (API2).
- [ ] Pagination, uploads and expensive endpoints have limits (API4, API6).
- [ ] User-controlled URL fetches are allowlisted (API7).
- [ ] CORS, docs and debug endpoints are intentional (API8).
- [ ] Old versions and extra hosts are inventoried or retired (API9).
- [ ] Third-party responses are validated (API10).

## FAQ

**The UI already hides Bob’s orders. Is that enough?**
No. Test the API directly. Clients are not an authorization layer.

**What status code should we return for Alice asking for Bob’s id?**
Either 403 or 404 is acceptable if you are consistent and you do not leak Bob’s data in the body. Pick a policy and apply it everywhere.

**Is the 2023 API list still current?**
Yes. As of 16 November 2026, OWASP’s API Security project presents the 2023 edition as the current Top 10. Recheck the project page before you rely on it, and name the edition you test against.

**Can we do this in a production API?**
Only with written authorization, test accounts, and rate limits that will not harm real users. Prefer staging.

## Sources

- OWASP, [API Security Top 10 2023](https://owasp.org/API-Security/editions/2023/en/0x11-t10/)
- OWASP, [API Security Project](https://owasp.org/www-project-api-security/)
- OWASP, [API Security Project overview](https://owasp.org/projects/api-security-project)

## Next in the series

Next up: *Harden a Kubernetes workload with Pod Security, NetworkPolicies and a non-root image.*

Previous: [Lock down Amazon S3 and IAM with least privilege and Block Public Access](https://rokkhe.hashnode.dev/lock-down-s3-iam-least-privilege). Start of the series: [Pin your GitHub Actions by commit SHA and lock workflow permissions](https://rokkhe.hashnode.dev/pin-github-actions-sha-lock-workflow-permissions).

Rokkhe is an AI pentesting and security-operations workspace. Learn more at [rokkhe.com](https://rokkhe.com/).

