What a shadow API is
A shadow API is any part of your API that is running in production without your security team knowing about it. It answers requests, but it is not in the inventory, the documentation or the gateway configuration. What nobody knows about, nobody tests, patches, monitors or switches off.
The term covers several situations:
- Undocumented endpoints on a known API, such as a debug route or an export function added in a hurry.
- Old versions left running after a newer one replaced them. These are often called zombie APIs.
- Forgotten hosts, such as a staging, beta or demo API exposed to the internet.
- Internal APIs that became reachable from outside after a network or gateway change.
The OWASP API Security Top 10 covers this risk as API9:2023, Improper Inventory Management.
How they come about
Shadow APIs are usually a side effect of normal work, not carelessness.
- Teams ship quickly, and the documentation is updated later or never.
- A new version launches, but some customer still depends on the old one, so it stays up.
- A developer adds a temporary endpoint for a migration or a support case and forgets to remove it.
- Frameworks generate routes automatically, such as admin, metrics or health endpoints.
- A mobile app released years ago still calls endpoints the web app abandoned.
What it looks like
A company's documented API is version 3. It requires a token and returns only the fields a client needs.
GET /v3/customers/8842 HTTP/1.1
Host: api.acme.test
HTTP/1.1 401 UnauthorizedVersion 1 was replaced two years ago, but the old host was never shut down. It predates the current authentication layer.
GET /v1/customers/8842 HTTP/1.1
Host: legacy-api.acme.test
HTTP/1.1 200 OK
Content-Type: application/json
{"id": 8842, "name": "Test Customer", "email": "test@acme.test", "internal_notes": "..."}Both versions read the same database. Every fix made to version 3 is bypassed by asking version 1. An attacker does not need a new technique here, only the old address. That is why forgotten APIs so often lead to broken object level authorization and similar findings.
How to find them
Compare what you think you run with what actually answers. The gaps are your shadow APIs.
- Start from traffic. Gateway, load balancer and proxy logs show every path that received requests. Compare the list with your API specification.
- Read the code and configuration. Route definitions in source code, and infrastructure definitions for gateways and load balancers, show what is deployed.
- Look from outside. Enumerate your hostnames through DNS records and certificate logs, then check which ones answer as APIs. This is part of mapping your attack surface.
- Inspect the clients. Web and mobile apps contain the addresses they call. Old app versions reveal old endpoints.
- Probe for versions and common paths. If
/v3/exists, try/v1/and/v2/. Check for exposed API descriptions and for GraphQL introspection, which can reveal a full schema. - Ask the cloud accounts. List every API gateway, function URL and public load balancer in each account.
A penetration test that starts with real reconnaissance, not just the documentation it was handed, finds these as a matter of course.
How to prevent them
The goal is to make the inventory a by-product of deployment, so it cannot fall behind.
- Generate the inventory from what is deployed, not from a document someone maintains by hand.
- Require a specification for every API, and fail the build when the code exposes a route the specification does not list.
- Route all traffic through a gateway that rejects paths it does not know.
- Give every API an owner and a retirement date. When a version is replaced, set a shutdown date and monitor its remaining traffic until then.
- Apply the same controls to every version. While an old version runs, it gets the same authentication, authorization and rate limits as the new one.
- Run discovery continuously. New hosts and paths should be flagged when they appear, not at the next yearly review.
API security covers the wider set of controls.