Mutual TLS (mTLS) sounds bulletproof on paper. Standard HTTPS checks that your browser reached the right server. In mutual TLS, both sides exchange certificates and prove key ownership during the initial handshake Istio mutual TLS guide.
Teams often assume that once mTLS is configured, unauthenticated callers cannot reach their application. But real-world bypasses almost never involve breaking cryptography or stealing private keys. Instead, callers slip through gaps between TLS handshakes, reverse proxy headers, and application handlers.
The Two Gates
To see why mTLS fails, split your security boundary into two gates.
Gate 1 is transport authenticity. Did the client complete a valid handshake with a certificate signed by your trusted Certificate Authority (CA), and did it prove key ownership?
Gate 2 is application authorisation. Is this specific client permitted to call this specific endpoint? If you want to explore how to enforce these checks in application code, take a look at this guide on authorising actions beyond login.
Gate 1 proves identity. Gate 2 decides permissions. Most bypasses happen when developers assume Gate 1 handles both, or when an edge proxy handles Gate 1 and passes an unverified header to Gate 2.
The Proof-of-Possession Trap in Go
Here is a common trap in Go's crypto/tls library. A developer wants to enforce client certificates, looks at the options, and picks tls.RequireAnyClientCert.
It sounds strict because it requires a certificate. But RequireAnyClientCert only verifies that the caller owns the private key for whatever certificate they send. It completely ignores your configured ClientCAs trust pool SentinelOne Go analysis.
// VULNERABLE: Accepts any self-signed certificate tlsConfig := &tls.Config{ ClientCAs: trustedCaPool, ClientAuth: tls.RequireAnyClientCert, // Ignores trustedCaPool } This exact mistake caused CVE-2025-54424 in the 1Panel server manager Miggo 1Panel advisory. The 1Panel agent daemon configured tls.RequireAnyClientCert, and its HTTP middleware checked whether the certificate Common Name was CN=panel_client.
Because the agent never verified the certificate against a CA, an attacker created a self-signed certificate with CN=panel_client using OpenSSL. Go confirmed the attacker held the private key, the agent accepted the connection, and the attacker reached an administrative WebSocket for remote code execution.
To fix this, use tls.RequireAndVerifyClientCert. This forces Go to validate the certificate chain against your trusted CA pool before accepting the connection:
// SECURE: Enforces full CA chain verification tlsConfig := &tls.Config{ ClientCAs: trustedCaPool, ClientAuth: tls.RequireAndVerifyClientCert, MinVersion: tls.VersionTLS13, } Handshake Drift in Node.js
In Node.js, teams often want to return a neat JSON error, such as a 401 response, rather than dropping the TCP connection during a failed handshake.
To do that, developers sometimes configure rejectUnauthorized: false alongside requestCert: true:
// DANGEROUS: Handshake finishes even if certificate verification fails const tlsOptions = { key: serverKey, cert: serverCert, ca: [trustedCa], requestCert: true, rejectUnauthorized: false }; Setting rejectUnauthorized: false tells OpenSSL to finish the TLS handshake even if the client sends an invalid certificate, an expired one, or no certificate at all Node Book TLS guide.
Node.js flags the socket with req.socket.authorized = false. If downstream Express middleware inspects req.socket.getPeerCertificate() without checking req.socket.authorized === true, unauthenticated callers walk right in. If someone adds a new route that forgets that custom middleware, that route is exposed to everyone.
Fix this at the listener level by setting rejectUnauthorized: true. Let the TLS layer drop invalid handshakes immediately.
Reverse Proxy Header Spoofing
Most production systems terminate TLS at an edge proxy, such as Envoy, NGINX, or Traefik, rather than directly inside application code. The proxy validates the certificate and forwards identity details downstream inside HTTP headers like X-Forwarded-Client-Cert or Ssl-Client-*.
This setup replaces an unforgeable cryptographic handshake with a plain HTTP header. That shift introduces two common bypass paths:
First, direct origin access. If an attacker reaches your backend directly, bypassing the edge proxy through an open firewall rule or container port, they can send whatever header values they want. The backend reads the header, assumes the proxy validated it, and grants access.
Second, unsanitised proxy routing. If the proxy forwards plain HTTP requests upstream without stripping incoming client headers, external callers can inject identity headers directly.
That second flaw caused CVE-2026-114640 in Traefik NIST Traefik advisory. When running the Kubernetes Ingress-NGINX provider with auth-tls-pass-certificate-to-upstream enabled and SSL redirect disabled, Traefik failed to sanitize incoming client headers on its plain HTTP router. An external attacker could send a simple HTTP request with forged headers:
GET /admin HTTP/1.1 Host: api.internal.local Ssl-Client-Verify: SUCCESS Ssl-Client-Subject-DN: CN=cluster-admin,O=DevOps Traefik forwarded those headers straight upstream, granting the caller administrative access without presenting any certificate.
If your reverse proxy passes plain HTTP traffic upstream, strip these headers explicitly using exact header names:
# Edge NGINX: Clear client-supplied headers before proxying plain HTTP traffic server { listen 80; location / { proxy_set_header Ssl-Client-Verify ""; proxy_set_header Ssl-Client-Subject-DN ""; proxy_set_header Ssl-Client-Issuer-DN ""; proxy_set_header X-Forwarded-Client-Cert ""; proxy_pass http://backend_upstream; } } If port 80 only exists to force encryption, issue a clean return 301 https://$host$request_uri; without proxying any request.
Parser Fallbacks and Shared Handlers
Proxies often use Server Name Indication (SNI) to pick the right TLS certificate and security policy. If the handshake fails to parse, many proxies fall back to a default configuration.
In Netty (CVE-2026-75595), the handshake decoder did not account for the record header when reading fragmented packets. When an attacker sent a fragmented ClientHello, the parser threw an IndexOutOfBoundsException, which Netty caught before falling back to the default SslContext SecureLayer7 Netty advisory. If the requested domain required mTLS but the default fallback allowed anonymous traffic, the attacker bypassed the certificate check.
A related issue hit the HAProxy Data Plane API (CVE-2026-109575). The daemon shared a single request handler across HTTPS, plain HTTP, and UNIX socket listeners. When an operator configured a TLS CA, the daemon globally disabled Basic authentication. Because mTLS was applied only to the HTTPS listener, the plain HTTP listener inherited the disabled Basic auth setting without requiring TLS, leaving administrative endpoints wide open NIST HAProxy advisory.
Review Checklist
When reviewing mutual TLS implementations, check these failure points:
- In Go: Search for
RequireAnyClientCert. Replace it withRequireAndVerifyClientCertand verify against a dedicated CA pool. - In Node.js: Keep
rejectUnauthorized: true. If middleware must handle verification failures, checkreq.socket.authorized === truebefore reading certificate details. - At the edge: Overwrite or strip incoming client certificate headers on all listeners before proxying upstream.
- On backends: Restrict network access so backends only accept traffic from the proxy, or run mTLS on internal hops too.
Catching these configuration gaps during code review prevents critical bypasses before deployment. You can explore more real-world review scenarios in the CodeReviewLab catalog or test yourself on interactive challenges.
