cloudflare / cloudflare/cfssl

Mkbundle does not respect certificate order

Open
#1,221 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
9.5k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

I have an issue with a cert-bundle containing three certificates - turned out that the host certificate is 2nd, the top / first in file is the CA cert, the 3rd / tailing cert is the intermediate certificate. I didn't dig into why it was put in this order, but I noticed that it fits to the alphabetical order of the filenames.

The [RFC document](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.2) however states

```
certificate_list
This is a sequence (chain) of certificates. The sender's
certificate MUST come first in the list. Each following
certificate MUST directly certify the one preceding it. Because
certificate validation requires that root keys be distributed
independently, the self-signed certificate that specifies the root
certificate authority MAY be omitted from the chain, under the
assumption that the remote end must already possess it in order to
validate it in any case.
```

Indeed this section refers to how the server has to send the certificate chain, but it seems that there are servers that do not check / reorder the certificates from the bundle.

Contributor guide

Open the contributing guide

Research direction

Start at the mkbundle entry point and trace how certificates are collected and ordered, using the reported alphabetical filename order as the reproduction clue. Compare the resulting bundle with RFC 5246 section 7.4.2; done means the host certificate comes first, followed by its directly certifying chain.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.