/

CVE-2026-125336

Severity:

HIGH RISK

(7.4)

Improper Certificate Validation (CWE-295) in node-forge

CVE-2026-125336

Analyzed

Vulnerability type

Category:

Improper Certificate Validation

CWE:

CWE-295

Impact:

Certificate-based identity impersonation

Severity:

HIGH RISK

(7.4)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

In affected node-forge certificate-chain validation, X.509 name constraints in non-critical extensions are not decoded or enforced. If a trusted, name-constrained certificate authority issues a certificate for a name outside its permitted namespace, node-forge may accept the chain and enable impersonation.

Affected context

The issue affects applications that use node-forge's pki.verifyCertificateChain() or forge.tls clients to validate certificate paths containing a name-constrained CA with a non-critical nameConstraints extension. Chains without name constraints are not affected, and the described behavior does not apply to critical name constraints, which affected versions reject as unsupported.

Exploit preconditions

  • Attack surface: Certificate-chain validation performed by node-forge.
  • Required access: An attacker needs access to a name-constrained CA's private key or a way to obtain an out-of-scope certificate from that CA.
  • Trust requirement: The constrained CA must chain to a root trusted by the validating application.
  • Trigger point: The application validates a certificate chain containing a non-critical name-constraints extension.
  • Why exploitation is possible: The validator does not enforce the permitted and excluded name subtrees, so it may accept a certificate for a name outside the CA's delegated namespace.

Why this happens

The certificate-path validator does not decode and enforce the X.509 nameConstraints extension when it is non-critical. This is an improper certificate validation flaw (CWE-295): a chain may be accepted without checking whether the leaf certificate's subject alternative name or common name complies with the issuing CA's permitted and excluded subtrees.

Potential impact

  • An attacker with the required CA access could obtain acceptance of a certificate for a name outside the delegated namespace.
  • Applications may accept an attacker-controlled identity as a trusted server or service.
  • forge.tls clients could be exposed to impersonation when they rely on the affected chain validation.

General mitigation guidance

Defensive patterns include ensuring certificate validators enforce name constraints for every relevant certificate in the path, and failing closed when an extension cannot be safely interpreted. Use well-maintained certificate-validation APIs with explicit support for the required X.509 constraints, and avoid treating a valid chain signature as sufficient proof that a certificate is authorized for a particular name. Limit access to CA signing keys and issuance workflows, and apply least privilege to systems that manage certificates.

How teams detect issues like this

Review certificate-validation code and dependencies for complete handling of X.509 name constraints, including permitted and excluded subtrees and non-critical extensions. Test validation policy with chains containing constrained CAs and leaf names both inside and outside the delegated namespace. Monitor certificate issuance for names beyond a CA's authorized scope, and use static analysis or dependency-review policies to flag incomplete or custom certificate-validation logic.

Sources

SourceLink
github.comgithub.com/digitalbazaar/forge/commit/6b23eae8beac316b6867bdb0e7ad7c2c959a97f6
github.comgithub.com/digitalbazaar/forge/commit/862aa5f630bdf40b0dfda408d6ac357bf35a7d6b
github.comgithub.com/digitalbazaar/forge/pull/1169
github.comgithub.com/digitalbazaar/forge/releases/tag/v1.4.3
github.comgithub.com/digitalbazaar/forge/security/advisories/GHSA-3cc4-3294-vgjf

Frequently asked

questions

No. The issue concerns chains containing a name-constrained CA with a non-critical nameConstraints extension. Chains without name constraints are not affected, and critical name constraints are rejected as unsupported in the described behavior.

An attacker needs a name-constrained CA that chains to a trusted root, plus its private key or the ability to obtain an out-of-scope certificate from it.

Use certificate validation that correctly enforces name constraints throughout the chain and rejects certificates that fall outside the CA's permitted namespace.

Test certificate-validation policies against constrained and excluded names, use established validation implementations, and tightly control CA keys and certificate issuance.

Find out what's already
exploitable in your codebase.