Date
November 23, 2026
Author
Karan Patel
,
CEO

For most SaaS products, the API is the product. The web app and mobile clients are thin layers over a REST or GraphQL backend that holds every tenant's data and enforces every permission. That makes the API the most valuable target in your estate, and the place where one missing check can expose every customer you have.

API penetration testing is how you find those missing checks before someone else does. This guide covers how a SaaS API pentest should be scoped, the methodology a competent team follows, the issues that show up again and again, and the remediation patterns that keep them from coming back. It is written for CTOs and security leads who are vetting a provider and want to know what good work looks like.

What Is API Penetration Testing (and What Is It Not)?

API penetration testing is manual, authenticated security testing of your application programming interfaces. A tester exercises every endpoint the way a motivated attacker would: as a real logged-in user, across multiple tenants and roles, checking whether the server actually enforces the access control and validation it claims to.

It is not a vulnerability scan. A scanner can flag a weak TLS configuration or a known-vulnerable library. It cannot reason about whether a read_only user in one tenant should be able to update a billing record in another. That reasoning is the core of API testing, and it is why the work has to be done by people.

The reference framework is the OWASP API Security Top 10 (2023 edition). Every finding in a good API report maps back to it:

OWASP API Top 10 (2023) What it means for a SaaS API
API1 Broken Object Level Authorization One tenant reads or changes another tenant's records
API2 Broken Authentication Weak tokens, missing expiry, flawed login or reset flows
API3 Broken Object Property Level Authorization Users read or write fields they should not control
API4 Unrestricted Resource Consumption No limits on page size, uploads, or expensive queries
API5 Broken Function Level Authorization Members can call admin-only operations
API6 Unrestricted Access to Sensitive Business Flows Trials, coupons, or invites abused at scale
API7 Server Side Request Forgery User-supplied URLs reach internal services
API8 Security Misconfiguration Verbose errors, permissive CORS, debug endpoints
API9 Improper Inventory Management Old API versions and undocumented routes left live
API10 Unsafe Consumption of APIs Trusting data from third-party APIs without validation

Redfox Cybersecurity's API penetration testing service is built around this list, with every finding mapped to its category so your engineers and auditors read it the same way.

Why Do SaaS APIs Need Their Own Pentest?

A web application test that only clicks through the UI misses most of the API. Modern frontends call a fraction of the endpoints the backend exposes, and they only call them with the parameters the UI happens to send. Attackers do not use your UI. They read your JavaScript bundles, your mobile app, and your public docs, then call the API directly with whatever parameters they like.

Three things make SaaS APIs especially exposed:

  • Multi-tenancy. Every request has to be scoped to the right customer. One forgotten filter is a cross-customer data breach.
  • Integrations. Public APIs, webhooks, OAuth apps, and partner keys widen the set of callers far beyond your own frontend.
  • Velocity. Endpoints are added weekly, and older versions are rarely switched off.

How Do You Scope an API Penetration Test?

Scope is where an API test succeeds or fails. The goal is to give testers what a determined attacker would eventually have anyway: full documentation, working credentials for every role, and at least two tenants so cross-tenant access can be tested properly.

What Should You Hand the Testers?

  • The OpenAPI specification, GraphQL schema, or a Postman collection covering every endpoint.
  • Test accounts for each role in at least two separate tenants, plus an API key or OAuth client if third parties integrate with you.
  • The authentication flow documented end to end, including token lifetime, refresh, and revocation.
  • A staging environment that mirrors production, with realistic seeded data.
  • Rate limits and any endpoints that trigger real-world side effects, such as payments or outbound email.
# api-scope.yaml
base_url: https://api.staging.acme.io/v2
schema: ./openapi-v2.json
graphql: https://api.staging.acme.io/graphql
auth:
 flow: oauth2_authorization_code_pkce
 access_token_ttl_min: 15
 refresh_rotation: true
roles: [owner, admin, member, read_only, api_client]
tenants:
 - id: tenant-alpha
   accounts: {owner: o@alpha.test, member: m@alpha.test, read_only: r@alpha.test}
 - id: tenant-bravo
   accounts: {owner: o@bravo.test, member: m@bravo.test}
side_effects:
 - POST /v2/payments        # sandbox processor only
 - POST /v2/invitations     # outbound email, use test domain
constraints:
 env: staging
 max_rps: 5

[cta]

How Many Endpoints Are Really in Scope?

The number of endpoints, roles, and tenants drives effort more than anything else. Count REST operations (each path and method pair), GraphQL queries and mutations, webhook receivers, and any gRPC or internal APIs exposed through the gateway. If you are unsure how to size it, a free 30-minute scope review with Redfox Cybersecurity turns your schema into an effort estimate and a fixed quote.

Find Shadow Endpoints Before the Test Starts

Improper inventory management (API9) is one of the easiest categories to fix before testing begins. Compare what your specification documents against what your gateway actually serves:

# Paths documented in the OpenAPI spec
jq -r '.paths | keys[]' openapi-v2.json | sort -u > documented.txt

# Paths actually requested in the last 30 days (normalize numeric and UUID IDs)
zcat /var/log/gateway/access.log*.gz \
 | awk '{print $7}' | cut -d'?' -f1 \
 | sed -E 's#/[0-9a-f-]{36}#/{id}#g; s#/[0-9]+#/{id}#g' \
 | sort -u > observed.txt

# Routes being served that nobody documented
comm -13 documented.txt observed.txt

[cta]

Every undocumented route either gets documented and added to scope or gets removed. Old /v1/ routes with a legacy authentication model are the most common result.

What Methodology Should an API Pentest Follow?

A strong API engagement follows the OWASP Web Security Testing Guide and API Security Top 10, aligned with PTES and NIST SP 800-115, in five broad phases.

Phase 1: Discovery and Schema Analysis

Testers build a complete map of the API, including endpoints that appear in client code but not in documentation. They parse the schema to understand object relationships: which objects belong to a tenant, which belong to a user, and which identifiers are guessable. That map drives the authorization testing that follows. Sequential integer IDs, short slugs, and timestamps embedded in identifiers all get noted here, because predictable IDs turn a single authorization gap into a way to walk through every customer's records one request at a time.

Phase 2: Authentication and Session Handling

This phase checks how identity is established and maintained: token expiry and revocation, refresh token rotation, multi-factor enforcement, password reset and invitation flows, and how the server validates tokens. The pattern that causes the most damage is trusting a value the client controls, such as a tenant ID inside an unverified token claim or a header.

The durable fix is strict verification on the server, with identity derived from the verified token rather than from anything the client sends alongside it:

import jwt

def verify(token: str, jwks_client) -> dict:
   signing_key = jwks_client.get_signing_key_from_jwt(token).key
   # Pin the algorithm, audience, and issuer. Require expiry.
   return jwt.decode(
       token, signing_key,
       algorithms=["RS256"],
       audience="api.acme.io",
       issuer="https://auth.acme.io/",
       options={"require": ["exp", "iat", "sub", "tid"]},
   )

[cta]

Phase 3: Authorization at Every Level

This is the heart of the engagement. For every endpoint, testers ask whether a lower-privilege user, or a user in another tenant, can do something they should not. The method is to capture a legitimate request as a privileged user, replay it as an unprivileged or cross-tenant user, and observe whether the boundary holds.

# As a member of tenant-bravo, request a project owned by tenant-alpha
curl -s -o /dev/null -w '%{http_code}\n' \
 -H "Authorization: Bearer $BRAVO_MEMBER_TOKEN" \
 https://api.staging.acme.io/v2/projects/prj_41c9e2

# Only 403 or 404 is acceptable. A 200 is a critical finding.

[cta]

Authorization fails at three levels, and a good test checks all three:

  • Object level (API1): can you reach a record that is not yours at all?
  • Property level (API3): can you read or write fields on your own record that you should not control, such as role, plan, or tenant_id?
  • Function level (API5): can a member call an admin operation, such as exporting all users or changing SSO settings?

The fix that scales is moving authorization out of scattered controller code into one policy that every request passes through. Open Policy Agent is a common choice:

package api.authz

import rego.v1

default allow := false

# Users may only act on resources in their own tenant
allow if {
   input.resource.tenant_id == input.subject.tenant_id
   some perm in data.role_permissions[input.subject.role]
   perm == sprintf("%s:%s", [input.resource.type, input.action])
}

[cta]

For property-level issues, reject unknown fields outright instead of silently binding the request body onto your model:

from pydantic import BaseModel, ConfigDict

class ProfileUpdate(BaseModel):
   model_config = ConfigDict(extra="forbid")  # role, tenant_id, plan rejected
   display_name: str | None = None
   timezone: str | None = None
   notification_prefs: dict | None = None

[cta]

Phase 4: Input Handling, Injection, and SSRF

Testers probe for SQL and NoSQL injection, command injection, unsafe deserialization, and server-side request forgery. Modern frameworks block the classic injection cases, so findings tend to appear in raw queries, dynamic filter builders, report exports, and search features.

SSRF (API7) deserves special attention in SaaS because so many features accept a URL: webhook destinations, avatar imports, integrations, and PDF renderers. If the server fetches that URL from inside your cloud network, it can reach metadata services and internal APIs. Validate the resolved address, not just the hostname:

import ipaddress, socket
from urllib.parse import urlparse

def is_safe_destination(url: str) -> bool:
   parsed = urlparse(url)
   if parsed.scheme != "https" or not parsed.hostname:
       return False
   for info in socket.getaddrinfo(parsed.hostname, 443):
       ip = ipaddress.ip_address(info[4][0])
       if ip.is_private or ip.is_loopback or ip.is_link_local or ip.is_reserved:
           return False
   return True

[cta]

Pair this check with an egress proxy that enforces the same rules at the network layer, so a DNS change between validation and request cannot get around it.

Phase 5: Resource Consumption and Business Logic

APIs without limits can be abused for denial of service or cost amplification, which hurts SaaS businesses that pay per downstream call. Testers check pagination caps, bulk endpoints, file upload sizes, and expensive queries. Business logic testing then looks at flows unique to your product: can a free trial be restarted indefinitely, can a discount be applied twice, can an invitation be accepted by the wrong account.

Rate limits on authentication and expensive endpoints are a baseline control:

limit_req_zone $binary_remote_addr zone=auth:10m rate=10r/m;
limit_req_zone $http_authorization zone=export:10m rate=2r/m;

location /v2/auth/ {
   limit_req zone=auth burst=5 nodelay;
   proxy_pass http://api_upstream;
}

location /v2/exports {
   limit_req zone=export burst=1;
   client_max_body_size 1m;
   proxy_pass http://api_upstream;
}

[cta]

If your API exposes billing, exports, or integrations, these flows are where Redfox Cybersecurity's API testers spend a large share of their hours, because no scanner understands your pricing model.

What Do We Find Most Often in SaaS API Pentests?

Across SaaS API engagements, a short list of issues accounts for most of the critical and high findings:

  • Cross-tenant object access. An ID in the URL or body that the server trusts without checking ownership. This is the finding that becomes a breach notification.
  • Mass assignment. The full request body bound to a model, letting users set role, plan, or is_verified on themselves.
  • Nested route gaps. /projects/{id} checks ownership, but /projects/{id}/members/{member_id} only checks the member ID.
  • Admin functions reachable by members. Hidden in the UI, but callable directly.
  • Excessive data exposure. Endpoints returning whole objects, including internal fields, and relying on the frontend to hide them.
  • Unsigned or weakly verified webhooks. Anyone who learns the receiver URL can forge events.
  • Legacy versions left running. /v1/ routes with an older, weaker auth model.

Excessive Data Exposure: Serialize Explicitly

The fix is to define exactly which fields each response returns, instead of serializing database objects wholesale:

class UserPublic(BaseModel):
   id: str
   display_name: str
   avatar_url: str | None
   # password_hash, mfa_secret, internal_notes, stripe_customer_id never leave the server

@app.get("/v2/users/{user_id}", response_model=UserPublic)
def get_user(user_id: str, ctx: Ctx = Depends(auth)):
   return users.get_in_tenant(user_id, ctx.tenant_id)

[cta]

Webhooks: Verify Every Signature

Inbound webhooks should be signed with a shared secret and checked with a constant-time comparison, with a timestamp to block replays:

import hmac, hashlib, time

def verify_webhook(body: bytes, sig_header: str, ts_header: str, secret: bytes) -> bool:
   if abs(time.time() - int(ts_header)) > 300:
       return False
   expected = hmac.new(secret, f"{ts_header}.".encode() + body, hashlib.sha256).hexdigest()
   return hmac.compare_digest(expected, sig_header)

[cta]

How Should GraphQL APIs Be Tested Differently?

REST testing walks predictable URLs and HTTP methods. GraphQL collapses everything into one endpoint with a flexible query language, which changes the attack surface. A single query can traverse many object types, so authorization has to be enforced on every field resolver, not only at the top-level query. Testers also look at introspection exposure, query depth and cost, aliasing and batching behavior, and verbose error messages that leak schema details.

import depthLimit from "graphql-depth-limit";
import { createComplexityLimitRule } from "graphql-validation-complexity";

const server = new ApolloServer({
 schema,
 introspection: process.env.NODE_ENV !== "production",
 validationRules: [depthLimit(7), createComplexityLimitRule(1000)],
 formatError: (err) => ({ message: err.message }), // no stack traces to clients
});

[cta]

How Do You Keep Your API Secure Between Pentests?

A pentest gives you a verified snapshot. Keeping it true requires turning findings into tests. The most valuable one is an authorization matrix that runs on every pull request and asserts which roles can call which endpoints:

import pytest

MATRIX = [
   ("GET",    "/v2/projects/{alpha_project}", "alpha_member",   200),
   ("GET",    "/v2/projects/{alpha_project}", "bravo_member",   404),
   ("DELETE", "/v2/projects/{alpha_project}", "alpha_read_only", 403),
   ("POST",   "/v2/admin/export",             "alpha_member",   403),
]

@pytest.mark.parametrize("method,path,actor,expected", MATRIX)
def test_authz_matrix(client, tokens, fixtures, method, path, actor, expected):
   resp = client.request(method, path.format(**fixtures),
                         headers={"Authorization": f"Bearer {tokens[actor]}"})
   assert resp.status_code == expected

[cta]

Every confirmed finding from a pentest becomes a new row. Over time, the matrix encodes your entire permission model and catches regressions long before the next test. For teams shipping new endpoints weekly, folding API testing into a continuous testing program adds human review whenever the matrix itself changes.

What Does an API Penetration Test Cost?

With Redfox Cybersecurity, a combined web application and API test starts at $4,000 with a five business day turnaround, covering one web app and one API with authenticated roles. Every engagement includes immediate notification of critical findings, an executive summary, a technical report, a readout call, and a free retest so you can confirm fixes landed. Final pricing depends on the number of endpoints, roles, and tenants, and you receive a fixed quote within 24 hours of scoping. Teams that want API, external, and cloud testing in a single audit-ready report can scope the custom audit bundle instead.

What Should You Ask an API Pentest Provider?

  • How many hours of manual, authenticated testing are included, and how many roles and tenants will be tested?
  • Will every finding be mapped to the OWASP API Security Top 10, with reproduction steps your engineers can follow?
  • How are GraphQL, webhooks, and OAuth integrations handled?
  • Are critical findings reported immediately?
  • Is a retest included at no extra cost?
  • Can you see a sample report first? Redfox Cybersecurity offers a sample penetration test report so you know exactly what you will receive.

Final Thoughts

Your API enforces every security promise your product makes, so it deserves the closest scrutiny. A good API penetration test is manual, authenticated, multi-tenant, and mapped to the OWASP API Security Top 10. It finds the cross-tenant access, mass assignment, and function-level gaps that scanners miss, and it gives your engineers reproduction steps and fixes they can ship in a sprint. Turn each finding into a regression test, and the value of the engagement compounds long after the report is delivered.

If you are ready to put an experienced tester's eyes on your API, get a quote from Redfox Cybersecurity and start with a scope review that turns your schema and tenant model into a clear, fixed-price engagement.

Copy Code