CVE-2021-22924: Bad connection reuse due to flawed path name checks
What the report claims
Bad connection reuse due to flawed path name checks in curl's SSL config matching function
Compare with curl's recorded outcome
Known vulnerability
A real vulnerability: CVE-2021-22924 Bad connection reuse due to flawed path name checks
Shown for comparison after analysis. The pipeline did not see this label.
ProveIt's finding
The available evidence does not settle the report. A maintainer should investigate.
See the withdrawn model reasoning
The following reasoning failed the citation check and does not support the final finding.
- Code at lib/vtls/vtls.c lines 132-147 confirms CURLOPT_ISSUERCERT (non-blob) is not compared (C2).
- Code confirms case-insensitive comparison via Curl_safe_strcasecompare for CApath, CAfile, and pinned_key (C3, C4).
- Code shows ca_info_blob IS compared (line 138), contradicting the claim for CURLOPT_CAINFO_BLOB, but issuer_cert_blob is missing (C1 partially contradicted).
- The combined flaws allow connection reuse with weaker security parameters, enabling MITM attacks as described.
How this analysis ran 5 claims · 7 citations verified
Evidence check: judge said likely_valid but contradicted a central claim
Checked against curl master on 2021-06-11 (23eef2394cb8). Test evaluation split. Citation verification checks that a referenced line was in the evidence; it does not prove the model interpreted it correctly.
Inspect the withdrawn draft reply
This draft belongs to the withdrawn judgment. It may contain unsupported claims.
Thank you for the detailed report. The code confirms three of the four specific flaws: CURLOPT_ISSUERCERT is not compared (line 132-147), paths and pinned_key use case-insensitive comparison (lines 139, 140, 147), and the pinned_key fingerprint is compared case-insensitively. However, CURLOPT_CAINFO_BLOB (ca_info_blob) IS compared at line 138, so only CURLOPT_ISSUERCERT_BLOB is missing from BLOB comparisons. These flaws allow connection reuse with weaker security settings, which is a valid security issue. We will address the missing issuer_cert and issuer_cert_blob checks and switch to case-sensitive comparisons for paths and fingerprints.
Inspect all claims and source code 5 claims · 1 code excerpts
This model judgment was withdrawn. The claim assessments below are preserved for inspection and may be wrong.
Report claims
Curl_ssl_config_matches fails to consider BLOB type certificate values such as CURLOPT_CAINFO_BLOB and CURLOPT_ISSUERCERT_BLOB
Read the reasoning
The code compares ca_info_blob (CURLOPT_CAINFO_BLOB) at line 138, contradicting the claim that it fails to consider this BLOB type. However, there is no comparison for an issuer cert blob (CURLOPT_ISSUERCERT_BLOB), so the claim is partially correct for that option.
CURLOPT_ISSUERCERT value is not matched during SSL config comparison
Read the reasoning
The function compares version, verifypeer, verifyhost, verifystatus, cert_blob, ca_info_blob, CApath, CAfile, clientcert, random_file, egdsocket, cipher_list, cipher_list13, curves, and pinned_key. No issuer_cert field appears, confirming CURLOPT_ISSUERCERT is not matched.
Path names for capath, cainfo and pinned public key use case-insensitive comparison
Read the reasoning
All three path/key fields use Curl_safe_strcasecompare, which by name and convention performs case-insensitive comparison, confirming the flaw.
Pinned public key fingerprint set by CURLOPT_PINNEDPUBLICKEY sha256// is compared case-insensitively
Read the reasoning
The pinned_key field (which holds the CURLOPT_PINNEDPUBLICKEY value including sha256// fingerprints) is compared case-insensitively, exactly as claimed.
Curl_ssl_config_matches incorrectly compares SSL security options leading to improper connection reuse
Read the reasoning
The function's flawed comparison logic (missing issuer_cert and issuer_cert_blob checks, case-insensitive path and fingerprint comparisons) directly enables improper connection reuse as described.
What the report says about other projects
not addressed CWE-664 Improper Control of a Resource Through its Lifetime might fit
not addressed CWE-41 Improper Resolution of Path Equivalence
Read the original report (excerpt)
Source code
| 128 | bool |
| C5: The Curl_ssl_config_matches function at lines 128-151 contains the comparison logic with the omissions and case-insensitive comparisons documented in C2-C4. | |
| 129 | Curl_ssl_config_matches(struct ssl_primary_config *data, |
| 130 | struct ssl_primary_config *needle) |
| 131 | { |
| 132 | if((data->version == needle->version) && |
| C2: The comparison list at lines 132-147 includes no field for issuer_cert (non-blob CURLOPT_ISSUERCERT). | |
| 133 | (data->version_max == needle->version_max) && |
| 134 | (data->verifypeer == needle->verifypeer) && |
| 135 | (data->verifyhost == needle->verifyhost) && |
| 136 | (data->verifystatus == needle->verifystatus) && |
| 137 | blobcmp(data->cert_blob, needle->cert_blob) && |
| 138 | blobcmp(data->ca_info_blob, needle->ca_info_blob) && |
| C1: Line 138 shows blobcmp(data->ca_info_blob, needle->ca_info_blob), meaning CURLOPT_CAINFO_BLOB is compared. However, no issuer_cert_blob field is compared, so CURLOPT_ISSUERCERT_BLOB is indeed omitted. | |
| 139 | Curl_safe_strcasecompare(data->CApath, needle->CApath) && |
| C3: Line 139 uses Curl_safe_strcasecompare for CApath (capath). | |
| 140 | Curl_safe_strcasecompare(data->CAfile, needle->CAfile) && |
| C3: Line 140 uses Curl_safe_strcasecompare for CAfile (cainfo/cacert). | |
| 141 | Curl_safe_strcasecompare(data->clientcert, needle->clientcert) && |
| 142 | Curl_safe_strcasecompare(data->random_file, needle->random_file) && |
| 143 | Curl_safe_strcasecompare(data->egdsocket, needle->egdsocket) && |
| 144 | Curl_safe_strcasecompare(data->cipher_list, needle->cipher_list) && |
| 145 | Curl_safe_strcasecompare(data->cipher_list13, needle->cipher_list13) && |
| 146 | Curl_safe_strcasecompare(data->curves, needle->curves) && |
| 147 | Curl_safe_strcasecompare(data->pinned_key, needle->pinned_key)) |
| C3: Line 147 uses Curl_safe_strcasecompare for pinned_key (pinned public key). | |
| C4: Line 147 compares pinned_key with Curl_safe_strcasecompare, making the fingerprint comparison case-insensitive. | |
| 148 | return TRUE; |
| 149 | |
| 150 | return FALSE; |
| 151 | } |