Kuboid
Open Luck·Kuboid.in
Security BSides2025
Open in YouTube ↗

ClientAuth Certificates Everywhere: When Your CA Becomes The Attack Surface

Security BSides London196 views11:27about 1 month ago

This talk demonstrates how misconfigured client certificate authentication allows attackers to bypass access controls by leveraging a single trusted root CA. It highlights that many implementations only verify the certificate's signature rather than validating the specific purpose or identity context of the certificate. The presentation emphasizes the importance of using distinct intermediate CAs for different services and enforcing strict certificate attribute validation to mitigate lateral movement risks.

Why Your Client Certificate Authentication Is Likely Broken

TLDR: Most implementations of client certificate authentication only verify that a certificate is signed by a trusted root CA, ignoring the certificate's intended purpose or identity. This flaw allows an attacker who compromises a single low-privilege client certificate to authenticate against any service trusting that same CA. To secure these environments, organizations must enforce strict certificate attribute validation and move toward issuing distinct intermediate CAs for every individual service.

Security professionals often treat client certificate authentication as a silver bullet for identity management. It feels cleaner than managing rotating passwords or complex OAuth flows. You drop a certificate into a browser or a service configuration, and suddenly you have a cryptographically verified identity. But there is a massive, often overlooked gap in how most enterprise systems implement this. They verify the signature, but they fail to verify the context.

The Trust Fallacy in Certificate Validation

When you configure a service to require client certificate authentication, you typically point it at a root CA certificate. The service then trusts any client certificate that chains back to that root. The problem is that most standard implementations, such as those found in Nginx or various database connectors, stop their validation process once the chain is verified. They do not check if the certificate was actually intended for that specific service.

If your organization uses a single root CA to issue certificates for everything—from your VPN and internal web portals to your HashiCorp Consul clusters and PostgreSQL instances—you have created a single point of failure. An attacker who gains access to a certificate meant for a low-security internal dashboard can use that same certificate to authenticate against your production database or your service mesh. The service sees a valid signature from the trusted root and grants access, completely unaware that the certificate was never meant for its eyes.

Mechanical Failure: The Nginx Example

The vulnerability is essentially a failure to enforce OWASP A01:2021-Broken Access Control. When you look at a standard Nginx configuration for client authentication, it looks deceptively secure:

ssl_client_certificate /etc/nginx/certs/ca.crt;
ssl_verify_client on;

This configuration tells Nginx to verify the client's certificate against ca.crt. If the client presents a certificate signed by that CA, the connection is established. The server does not inspect the Subject or Extended Key Usage fields to see if the certificate is authorized for this specific proxy.

During a penetration test, this is a goldmine. If you find a single exposed client certificate—perhaps left in a developer's home directory, a misconfigured CI/CD pipeline, or a public GitHub repository—you have effectively bypassed the authentication layer for every service sharing that CA. You are not just testing a single application; you are testing the entire trust domain of the organization.

Real-World Impact and Testing

In a typical engagement, you might start by enumerating services that require client certificates. Once you identify a target, your goal is to obtain a valid certificate. This often involves looking for configuration files, backup archives, or even memory dumps from compromised endpoints. Once you have a certificate, you do not need to crack it or find a password. You simply present it during the TLS handshake.

If you are performing a red team engagement, this is often the moment you move from a single compromised workstation to full lateral movement across the infrastructure. Because the services trust the CA, they trust the identity. If the application logic behind the proxy relies on the certificate's Common Name (CN) for authorization, you might even be able to impersonate other users if the CA allows for flexible certificate issuance.

Moving Toward Granular Trust

Defending against this requires moving away from the "one CA to rule them all" approach. If you are using HashiCorp Vault to manage your PKI, you have the tools to fix this. You should be issuing distinct intermediate CAs for every service or service group.

Your Nginx proxy for the web portal should only trust the "Web Portal Intermediate CA," and your database should only trust the "Database Intermediate CA." This ensures that even if a certificate is leaked, the blast radius is contained to the specific service that certificate was issued for.

Furthermore, your services must be configured to validate more than just the signature. They should be checking the certificate's attributes. If a service only needs to perform server authentication, it should explicitly reject certificates that have the "Client Authentication" flag set in their Extended Key Usage field.

Stop assuming that a valid signature equals a valid identity. Start auditing your CA hierarchy and your service configurations to ensure that trust is as granular as your access control policies. If you cannot explain exactly which services trust which intermediate CAs, you are likely one leaked certificate away from a total bypass.

Talk Type
talk
Difficulty
intermediate
Has Demo Has Code Tool Released


BSides London 2025 Rookie Track 1

14 talks · 2025
Browse conference →
Premium Security Audit

We break your app before they do.

Professional penetration testing and vulnerability assessments by the Kuboid Secure Layer team. Securing your infrastructure at every layer.

Get in Touch
Official Security Partner
kuboid.in