API key scope, leakage and revocation
An API key needs a defined identity, permission scope and revocation process. Understanding API key scope and leakage and revocation helps establish which security property the feature needs and where that property is actually enforced.
What does this involve?
Authentication establishes who is making a request and the strength and freshness of that evidence. Enrolment, recovery, alternate channels and changes to authenticators are part of the same boundary. An impressive login screen provides little assurance if another path grants equivalent access with weaker checks.
Why it matters
Consider a realistic failure: a leaked analytics integration key also permits modification of customer records.
Account access can lead to disclosure, unwanted changes or misuse of a trusted identity. The consequence depends on the account's permissions and the actions available after authentication, rather than the appearance of the login mechanism.
An API review follows the server-side behaviour behind the interface. Direct requests, alternate methods and background operations can reveal boundaries that the normal frontend journey does not exercise.
How penetration testers check for it
Determine what the key authorises and where copies can be stored or exposed.
- Map normal, alternate and recovery authentication journeys.
- Compare verification across supported identities and application states.
- Check expiry, reuse and the binding of challenges to their intended action.
- Follow successful authentication into the operation that trusts it.
How to fix it
Separate keys by purpose, reduce permissions and support timely replacement and revocation.
- Apply consistent verification at trusted boundaries.
- Protect enrolment, replacement and recovery as carefully as login.
- Require appropriate fresh evidence for sensitive changes.
- Record important authentication events without retaining secrets.
Authentication and authorisation answer different questions. Establishing identity does not grant unrestricted permission to records or privileged functions.
Recheck the changed behaviour against the original failure conditions and the legitimate user journey. Keep enough evidence to show which release and configuration were verified, and include related entry points that depend on the same security decision.
Related issues
- API redirects and credential leakage to external services
- OAuth access token audience and scope validation in APIs
- JWT signature and algorithm validation in API gateways
Read about our methodology or contact pentested.com to discuss your APIs and integrations.