Skip to content
Crypto Disclosed report Advanced

Only OpenSSL handles a CRL when passed in via CApath

When curl is built against NSS, files placed in the CApath directory are all loaded as CA certificates, so certificate revocation lists in that directory are ignored and revoked certificates can still be accepted. An attacker holding a revoked certificate could therefore impersonate a TLS server, and duplicate subject names can also break connections to legitimate servers.

salvet Follow

Originally disclosed on HackerOne

  • Disclosed after 15 months

Summary:

Code in vtls/nss.c interprets CApath option differently than OpenSSL-using code, user can be mislead to unsecure use of curl/libcurl easily. CApath directory can contain CRL files in addition to CA certificate files and they are used for certificate verification when curl calls OpenSSL. Code path using NSS blindly loads all files residing in CApath as CA certificates instead, which has two effects: first, the meaning of CRLs is ignored and revoked certificates can be accepted, second, NSS may find duplicate SN in corrupt 'CA certificate' during TLS handshake and break connection to legitimate server (NSS does not perform full validation in load and search routines, ASN.1 templates used can mistakenly match both types of object). Such use is not explicitly supported according to curl documentation strictly speaking but I find current implementation very risky (I know security professionals who have fallen to this trap) and recommend adding validation/type detection for each file loaded from CApath (or using c_hash-style name extensions if any file with such extension is present, if full validation is deemed too complicated or as a quick fix helping most users).

Steps To Reproduce:

  1. revoke a certificate, install resulting CRL in CApath, try with NSS-based curl
  2. try connecting TLS server whose CA has self-signed certificate with SN=1 and CRL in CApath (success can depend on order of directory entries)

Supporting Material/References:

[list any additional material (e.g. screenshots, logs, etc.)]

  • [attachment / reference]

Impact

An attacker can impersonate TLS server using revoked (presumably leaked) certificate.

The original report as published on HackerOne, by salvet. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the NSS code path loads every file in CApath as a CA certificate without checking its type, so CRL files are misinterpreted and revocation is never enforced.

Impact

An attacker could impersonate a TLS server using a revoked, presumably leaked, certificate; the text notes success may depend on the order of directory entries.

What the attacker needed

Curl built against NSS; CApath contains a CRL file; attacker holds a revoked certificate

The fix

The report recommends adding validation or type detection for each file loaded from CApath, or using c_hash-style name extensions as a quick fix.

How it was found

  1. Revoke a certificate and place the resulting CRL in the CApath directory.
  2. Connect with an NSS-based curl to a TLS server whose CA has a self-signed certificate with subject name 1, with the CRL present in CApath.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A certificate revocation list (CRL) is a published list of certificates that should no longer be trusted, for example because the key leaked. curl can be built with different TLS libraries, and the NSS one treats every file in the CA folder as a trusted certificate instead of noticing some are revocation lists. That means a certificate that was meant to be rejected may still be accepted.

What is Crypto?

Encryption, signatures, randomness or certificate checks that do not protect what they claim to.

More from curl

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cryptographic weaknesses

The lesson behind this report.

Encryption, signatures, randomness or certificate checks that do not protect what they claim to.