Machine-to-machine API authentication with mutual TLS
Mutual TLS identifies a connecting peer but does not replace application permissions. Understanding machine-to-machine API authentication with mutual TLS 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: any trusted client certificate can invoke an administrative service method.
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
Review certificate validation, identity extraction and the permissions attached to that identity.
- Confirm that an encrypted protocol such as TLS is used for all inbound and outbound connections to and from the application, including monitoring systems, management tools, remote access and SSH, middleware, databases, mainframes, partner systems, or external APIs. The server must not fall back to insecure or unencrypted protocols.
- Confirm that TLS clients validate certificates received before communicating with a TLS server.
- Confirm that TLS or another appropriate transport encryption mechanism used for all connectivity between internal, HTTP-based services within the application, and does not fall back to insecure or unencrypted communications.
- Confirm that TLS connections between internal services use trusted certificates. Where internally generated or self-signed certificates are used, the consuming service must be configured to only trust specific internal CAs and specific self-signed certificates.
- Confirm that services communicating internally within a system (intra-service communications) use strong authentication to ensure that each endpoint is verified. Strong authentication methods, such as TLS client authentication, must be employed to ensure identity, using public-key infrastructure and mechanisms that are resistant to replay attacks. For microservice architectures, consider using a service mesh to simplify certificate management and enhance security.
- 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
Bind validated client identities to explicit service authorisation policies.
- 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
- Broken API authentication and token handling
- WebSocket API authentication and message authorisation
- API refresh token rotation and replay detection
Read about our methodology or contact pentested.com to discuss your APIs and integrations.