# CVE-2022-27782: TLS and SSH connection too eager reuse

libcurl's connection pool reused TLS/SSH connections despite changed security options (CRLFILE, SSL_OPTIONS, TLSAUTH, SSH keys), letting later transfers inherit wrong identity or weaker TLS settings.

- Payout: $2,400
- Severity: medium
- Program: Internet Bug Bounty
- Found by: nyymi
- Disclosed: 2022-05-12
- CVE: CVE-2022-27782
- Write-up quality: 7/10
- Original: https://hackerone.com/reports/1565624
- Library page: https://bugbountylibrary.com/r/h1%3A1565624
- Tags: area:oss domain:oss impact:integrity impact:privesc kind:bounty platform:hackerone sev:medium tech:curl technique:legacy-endpoint technique:source-review vuln:auth-bypass vuln:business-logic

**Target:** libcurl connection reuse / connection pool matching logic
**Root cause:** The connection-reuse match check omitted several TLS and SSH options (CURLOPT_SSL_OPTIONS, CRLFILE, TLSAUTH_*, PROXY_* variants, SSH_PUBLIC/PRIVATE_KEYFILE) from the configuration comparison, so connections matched too easily and were reused across transfers with different security settings.
**Steps:**
1. Create a curl handle and perform a transfer to host H with e.g. `CURLOPT_SSL_OPTIONS=CURLSSLOPT_NO_REVOKE` or `CURLOPT_CRLFILE` set, establishing a pooled TLS connection.
2. Reuse the same easy handle (or share connection cache) for a second transfer to H with different security options (e.g. remove NO_REVOKE, change CRLFILE, change TLSAUTH_USERNAME/PASSWORD, or change SSH key files).
3. Observe libcurl reuses the existing pooled connection instead of opening a new one, so the second transfer runs under the first transfer's TLS/SSH security context.
4. For SSH: authenticate to host H with key A via SCP/SFTP, then issue a second transfer to H with key B; the previously authenticated session is reused.
**How found:** Code review of libcurl's connection-reuse matching logic: the reporter enumerated TLS/SSH-related CURLOPT_* settings and noticed they were absent from the configuration comparison used to decide whether a pooled connection matches, implying reuse across differing security settings.
**Exploitation:** Attacker who knows a vulnerable application uses SSH key auth to a specific host/user can trigger subsequent actions to the same host that reuse the already-authenticated session, acting under the wrong identity. For TLS, a connection established with weakened options (ALLOW_BEAST, NO_REVOKE) or a client cert is reused for later transfers that should have required stricter settings.
**Insight:** When auditing connection/session pooling, enumerate every security-relevant option and verify each is part of the cache-key/match predicate; options added later (proxy variants, TLSAUTH, SSH key files) are commonly forgotten, so diff the option list against the match function.

