Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should not assume TLS certificate chain is provided in order #1086

Open
andersk opened this issue Jun 13, 2024 · 0 comments
Open

Should not assume TLS certificate chain is provided in order #1086

andersk opened this issue Jun 13, 2024 · 0 comments

Comments

@andersk
Copy link
Contributor

andersk commented Jun 13, 2024

The TLS 1.2 specification required the certificate chain to be in order:

The sender's certificate MUST come first in the list. Each following certificate MUST directly certify the one preceding it.

However, in practice, servers are commonly misconfigured to violate this requirement, and so TLS 1.3 relaxed it from MUST to SHOULD:

The sender's certificate MUST come in the first CertificateEntry in the list. Each following certificate SHOULD directly certify the one immediately preceding it.

For compatibility, Forge should not assume the chain is provided in order. It currently assumes this here:

forge/lib/x509.js

Lines 3033 to 3039 in 2bb97af

// verify each cert in the chain using its parent, where the parent
// is either the next in the chain or from the CA store
var first = true;
var error = null;
var depth = 0;
do {
var cert = chain.shift();

forge/lib/x509.js

Lines 3059 to 3061 in 2bb97af

// 2. verify with parent from chain or CA store
if(error === null) {
parent = chain[0] || caStore.getIssuer(cert);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant