AI pentesting guides / What to test

Distributed systems

Microservices pentesting

Microservices pentesting is the testing of an application built from many small services to prove whether an attacker can bypass the API gateway, abuse trust between services, or reach internal APIs that were never meant to face users. The individual services are usually ordinary APIs; the vulnerabilities live in the assumptions they make about each other.

The most common assumption is that anything arriving from inside the cluster is trusted. When one service is compromised, or a request can be smuggled past the gateway, that assumption turns a small flaw into broad access.

Common microservice weaknesses

  • Authorisation only at the gateway, so internal services accept any request that reaches them.
  • Identity passed in trusted headers (such as X-User-Id) that a client can set if the gateway does not strip them.
  • Path normalisation differences between gateway and service, letting /admin/ or /admin;x through where /admin is blocked.
  • SSRF in one service giving access to every internal service and to cloud metadata.
  • Inconsistent authorisation logic re-implemented in different languages per service.
  • Service-to-service tokens with broad scopes and no expiry.

How to test

Begin at the edge as a normal user and map every route through the gateway. Test whether the gateway and the backend agree on paths and headers by sending normalisation variants and override headers. Look for any feature that makes the server fetch URLs. With an internal vantage point, if in scope, check whether services authenticate each other or accept unauthenticated calls.

Proof

Gateway bypasses are proven with a differential pair: the canonical path returns 403 and a variant returns 200 with the protected content. Header trust is proven by setting the identity header and receiving another user's data. SSRF is proven with an out-of-band callback, then by reaching an internal endpoint if agreed.

Remediation

Authorise in every service, not only at the edge. Strip identity headers at the gateway and replace them with signed tokens the services verify. Use mutual TLS or a service mesh for service identity. Canonicalise paths once, consistently. Restrict outbound traffic so a compromised service cannot reach everything.

With Pentest-Swarm

How Pentest-Swarm tests microservice applications

Pentest-Swarm tests microservice systems through their exposed APIs, and several of its proofs target exactly the gateway-versus-backend mismatches these architectures create.

  • 403-to-200 bypass proof: path-normalisation variants (trailing slash, dot segment, doubled slash, path parameter) and override headers such as X-Original-URL and X-Forwarded-For.
  • Out-of-band SSRF proof on URL and webhook parameters.
  • BOLA, mass assignment and injection proofs on each discovered service API.
  • Cloud and Kubernetes checks via kube-hunter and Checkov in the cloud-exploitation playbook.

Where it falls short

Pentest-Swarm tests what it can reach from the vantage point you give it; it does not read service-mesh policy or trace internal call graphs. Reviewing service-to-service authentication, token scopes and mesh configuration is better done with architecture review and source access. It does not currently test race conditions between services automatically.

Questions

Is the API gateway enough to secure microservices?

No. The gateway is one control. Each service should verify identity and authorisation itself, because requests can bypass or be smuggled past the gateway.

What is a 403 bypass?

A request that reaches a protected resource despite a block, usually because the gateway and backend interpret paths or headers differently.

Should internal services be pentested?

Yes, at least from the perspective of a compromised neighbouring service, because that is how an attacker moves after the first foothold.

Sources

  1. OWASP Microservices Security Cheat Sheet