Broken API authentication and token handling
API authentication must establish the caller's identity and preserve that assurance throughout credential and token use. Understanding broken API authentication and token handling helps establish which security property the feature needs and where that property is actually enforced.
What does this involve?
Session and token controls preserve an authentication decision over time. They need a defined scope, lifetime and invalidation policy. A token should be accepted because a trusted service has verified the relevant properties, not simply because its structure looks familiar.
Why it matters
Consider a realistic failure: an expired or revoked credential continues accessing protected endpoints.
A reusable credential can let someone continue acting as an account after the intended access should have ended. Long-lived access, excessive token contents and inconsistent revocation can increase the exposure beyond the initial event.
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
Review credential verification, token acceptance, recovery and session invalidation.
- Review token creation, transport, storage and acceptance.
- Check issuer, intended recipient, lifetime and required claims.
- Test logout, permission changes and credential replacement.
- Inspect replay and concurrent use according to the documented design.
How to fix it
Use consistent trusted identity validation and a complete credential lifecycle.
- Use appropriately scoped credentials with bounded lifetimes.
- Validate trusted issuance and relevant claims consistently.
- Rotate and revoke according to the session model.
- Keep credentials out of unnecessary URLs, logs and persistent copies.
Some designs intentionally use short-lived credentials without immediate global revocation. Assess the complete lifetime and access model before calling that design a failure.
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 refresh token rotation and replay detection
- Machine-to-machine API authentication with mutual TLS
- Broken property-level authorisation in API responses and updates
Read about our methodology or contact pentested.com to discuss your APIs and integrations.