Summary
A certificate name-constraint validation flaw in wolfSSL can accept an out-of-scope Subject Common Name (CN) when the certificate contains a SAN of another type but no dNSName SAN. In affected validation contexts, an attacker may use such a certificate to bypass DNS name constraints, potentially enabling unauthorized TLS identity or certificate-chain acceptance.
Affected context
The issue occurs in wolfSSL certificate validation when DNS name constraints are applied to a certificate that has a Subject CN and one or more non-dNSName SAN entries, such as an IP address or registered identifier. The affected logic may incorrectly treat the presence of any SAN as sufficient to suppress CN-based DNS validation, even though no dNSName SAN is present.
Exploit preconditions
- Attack surface: TLS or certificate-chain validation performed by wolfSSL
- Required access: Ability to present or cause acceptance of a certificate during a validated connection or chain-processing operation
- Trigger point: Name-constraint evaluation for a certificate containing a Subject CN and SAN entries without a dNSName SAN
- Why exploitation is possible: The fallback check for the CN is gated on the absence of all SAN entries rather than the absence of a dNSName SAN, allowing an out-of-scope DNS CN to avoid the intended constraint check
Why this happens
The underlying bug is incomplete certificate identity validation. The implementation uses the presence of any subject alternative name as a reason to skip the Subject CN-as-DNS fallback, instead of determining whether a dNSName SAN specifically exists. As a result, certificates with unrelated SAN types can bypass the applicable DNS name-constraint check. This behavior maps to CWE-295, Improper Certificate Validation, because certificate identity and authorization constraints are not enforced consistently across supported name representations.
Potential impact
- An attacker could cause an out-of-scope certificate identity to be accepted.
- TLS clients or services could establish trust in an unauthorized endpoint.
- Certificate-based authorization decisions may be bypassed.
- Systems relying on DNS name constraints could experience impersonation or
trust-boundary violations.
General mitigation guidance
Mitigation generally focuses on making certificate identity validation
type-aware and fail-closed.
Common defensive patterns include:
- Applying CN fallback validation when no dNSName SAN exists, regardless of other SAN types.
- Enforcing name constraints independently for each supported identity type.
- Rejecting ambiguous or unsupported certificate identity combinations when policy requires strict DNS validation.
- Limiting certificate trust and authorization decisions to explicitly permitted names and issuers.
- Running certificate-processing components with least privilege to reduce consequences if trust decisions are bypassed.
How teams detect issues like this
Organizations can look for this class of issue through:
- Static analysis and code review of branches that test for any SAN versus a specific SAN type.
- Tests covering certificates with a Subject CN plus iPAddress, registeredID, or other non-dNSName SAN entries.
- Negative validation tests confirming that out-of-scope CN values remain constrained when no dNSName SAN is present.
- Policy checks requiring certificate validators to process every applicable identity representation independently.
- Automated security review tools that flag incomplete certificate-name validation logic.

