Summary
Erlang OTP's public_key OCSP validation logic fails to cryptographically verify that an OCSP designated responder certificate is signed by the issuing CA, relying instead only on issuer name matching and the OCSPSigning extended key usage.
Attackers who can intercept or control OCSP responses can forge OCSP replies that mark revoked certificates as valid, causing SSL/TLS clients to trust compromised servers and potentially send sensitive data over connections that should have been rejected.
Affected context
This vulnerability appears in environments using Erlang/OTP's public_key and ssl applications for certificate validation, particularly where OCSP stapling or direct OCSP checks are enabled.
It primarily affects TLS/SSL clients (and any applications directly calling public_key:pkix_ocsp_validate/5) that rely on OCSP to enforce certificate revocation, under deployments where network intermediaries, reverse proxies, or untrusted networks may influence or intercept OCSP traffic.
Exploit preconditions
- Attack surface: OCSP validation path in TLS/SSL clients and applications using
public_key:pkix_ocsp_validate/5. - Required access: Ability to intercept, modify, or inject OCSP responses (e.g., on-path attacker, malicious reverse proxy, or compromised OCSP responder endpoint).
- Trigger point: Client-side invocation of OCSP validation when establishing or validating TLS/SSL connections, including via OCSP stapling.
- Why exploitation is possible: The OCSP responder authorization check (
pubkey_ocsp:is_authorized_responder/3) validates only that: - The responder certificate's issuer name matches the CA's subject name, and
- The certificate includes the OCSPSigning extended key usage,
but does not verify that this responder certificate is actually signed by the CA's private key, allowing self-signed or attacker-controlled responder certificates to be accepted.
Why this happens
The core bug is an incomplete implementation of OCSP responder authorization logic in the pubkey_ocsp module.
Rather than performing a full certificate path validation to ensure that a designated OCSP responder certificate chains back to and is signed by the issuing CA, the code only checks metadata fields such as issuer name equality and the presence of the OCSPSigning EKU.
This pattern maps to CWE-295: Improper Certificate Validation, where trust is established based on non-cryptographic attributes (names and flags) instead of verifying that the certificate is bound to the CA by a valid signature and chain.
As a result, an attacker can generate a self-signed certificate with the right issuer name and EKU and have it treated as an authorized OCSP responder, undermining revocation checks.
Potential impact
- Clients may accept TLS/SSL connections to servers whose certificates have been revoked.
- Attackers can maintain the appearance of validity for compromised or stolen certificates by forging "good" OCSP responses.
- Sensitive data (credentials, session cookies, API keys, personal information) can be transmitted to servers that should be rejected.
- Defense-in-depth mechanisms that rely on OCSP for revocation enforcement can be silently bypassed.
- Security monitoring systems that depend on strict revocation handling may receive misleading signals about certificate health.
General mitigation guidance
Mitigation generally focuses on restoring strict cryptographic trust checks and hardening revocation handling:
- Ensure that OCSP responder authorization includes full certificate path validation so that only responder certificates that chain to and are signed by the issuing CA are trusted.
- Treat non-cryptographic attributes (subject/issuer names, EKUs) as necessary but not sufficient conditions; they must complement, not replace, signature verification.
- Reduce trust in network-delivered revocation information by combining OCSP with additional safeguards such as short-lived certificates or multiple revocation sources.
- Configure TLS/SSL clients to be conservative in the face of OCSP anomalies (e.g., treating unexpected responder identities or malformed responses as failure conditions where appropriate for the risk profile).
- Apply least-privilege principles to certificate roles: keep OCSP responder keys separate, constrained by EKUs and path structures, and monitor for unusual responder identities.
How teams detect issues like this
Detection can focus on both code and runtime behavior:
- Static analysis and code review:
- Flag certificate validation paths that rely only on issuer/subject name matching or EKU checks without invoking full chain verification.
- Look for custom OCSP validation logic that bypasses or wraps standard PKI verification routines.
- Review uses of
public_key:pkix_ocsp_validate/5to ensure downstream code does not assume stronger guarantees than the function actually provides. - Configuration and policy checks:
- Enforce security policies requiring full chain validation for OCSP responders and rejecting self-signed or non-chained responder certificates.
- Ensure TLS/SSL client configurations treat OCSP as advisory only when appropriate, or as a strict requirement accompanied by robust validation where high assurance is needed.
- Operational monitoring:
- Monitor for unexpected or new OCSP responder subject names associated with a given CA.
- Analyze TLS handshakes and OCSP stapling behavior for anomalies, such as responders not matching known CA infrastructure.
Automated review tools, including PKI-focused linters and general SAST solutions, can assist by highlighting simplified or custom certificate validation logic that deviates from established PKI best practices.

