CVE-2026-8286: wrong STARTTLS connection reuse 漏洞概述 curl 在连接复用过程中存在错误,导致在不正确的配置下可能重用 SSL 升级的连接。具体表现为: 对于 、 、 、 和 协议,如果 设置为 或 ,则 函数不会检查连接是否通过 TLS 升级。 对于 行,代码会尝试重用 SSL 升级的连接,即使配置中未启用 SSL。 对于 行,只有在现有连接不是 SSL 时才会检查请求。 影响范围 影响 、 、 、 和 协议。 攻击者可以利用此漏洞进行中间人攻击(MITM),特别是在 STARTTLS 升级过程中。 修复方案 修复代码已合并到 curl 的 GitHub 仓库中:https://github.com/curl/curl/pull/21522 修复内容包括: - 在 函数中,除了 标志外,还检查 和 。 - 验证通过两个函数和追踪 和 通过 返回 的情况。 - 在 行, 返回 而不调用 。 POC 代码 ```plaintext url_match_ssl_config() is gated on m->neede->scheme->flags & PROTOPT_SSL. For imap://, pop3://, smtp://, http://, https:// with CURLOPT_USE_SSL=[STARTTLS], the scheme lacks PROTOPT_SSL, so Curl_ssl_conn_config_match is never called even though the connection runs TLS. url_match_ssl_use() at L833-838 plain a scheme reuse need an SSL-upgraded conn via PROTOPT_SSL_REUSE without ever checking the config comparison; the req_tls check at L840 only fires when the existing conn is NOT ssl. Impact: handle A connects imap://host with CURLOPT_USE_SSL=CURLUSESSL_ALL and CURLOPT_SSL_VERIFYPEER=0; on-path attacker MITMs the STARTTLS upgrade. Handle B connects imap://host with USE_SSL=ALL, VERIFYPEER=1, and a pinned key. B reuses A's unverified TLS session; B's verifypeer/pinning never run. (FTP's ftp_conn_match_checks_ssl_level and ftp_ccc but not ssl_primary_config.IMAP/POP3/SMTP have no protocol-specific check at all.) Same bug class as CVE-2022-27782 (TLS/SSH too-eager reuse) - that fix added Curl_ssl_conn_config_match but only behind a PROTOPT_SSL gate, missing the STARTTLS paths. Verified by reading both functions and tracing the needle for imap:// + USE_SSL through url_match_ssl_use -> returns TRUE at L838, then url_match_ssl_config() -> returns TRUE at L1028 without calling Curl_ssl_conn_config_match.