{"id":"CVE-2026-42246","aliases":["GHSA-vcgp-9326-pqcp"],"url":"https://o3.security/vulnerability/CVE-2026-42246","summary":"net-imap vulnerable to STARTTLS stripping via invalid response timing","details":"### Summary\n\nA man-in-the-middle attacker can cause `Net::IMAP#starttls` to return \"successfully\", without starting TLS.\n\n### Details\n\nWhen using `Net::IMAP#starttls` to upgrade a plaintext connection to use TLS, a man-in-the-middle attacker can inject a tagged `OK` response with an easily predictable tag.  By sending the response before the client finishes sending the command, the command completes \"successfully\" before the response handler is registered.  This allows `#starttls` to return without error, but the response handler is never invoked, the TLS connection is never established, and the socket remains unencrypted.\n\nThis allows man-in-the-middle attackers to perform a STARTTLS stripping attack, unless the client code explicitly checks `Net::IMAP#tls_verified?`.\n\n### Impact\n\nTLS bypass, leading to cleartext transmission of sensitive information.\n\n### Mitigation\n\n* Upgrade to a patched version of net-imap that raises an exception whenever `#starttls` does not establish TLS.\n* Connect to an implicit TLS port, rather than use `STARTTLS` with a cleartext port.\n  This is strongly recommended anyway:\n  * [RFC 8314](https://www.rfc-editor.org/info/rfc8314): Cleartext Considered Obsolete: Use of Transport Layer Security (TLS) for Email Submission and Access\n  * [NO STARTTLS](https://nostarttls.secvuln.info/): Why TLS is better without STARTTLS, A Security Analysis of STARTTLS in the Email Context\n* Explicitly verify `Net::IMAP#tls_verified?` is `true`, before using the connection after `#starttls`.","published":"2026-05-09T19:33:17.880Z","modified":"2026-08-27T11:30:34.575293613Z","cvss":null,"epss":{"score":0.00312,"percentile":0.24198,"asOf":"2026-09-17"},"cisaKev":null,"exploitsKnown":0,"affectedPackages":[{"ecosystem":"RubyGems","name":"net-imap","fixedVersion":"0.6.4"},{"ecosystem":"RubyGems","name":"net-imap","fixedVersion":"0.5.14"},{"ecosystem":"RubyGems","name":"net-imap","fixedVersion":"0.4.24"},{"ecosystem":"RubyGems","name":"net-imap","fixedVersion":"0.3.10"}],"fix":{"url":"https://github.com/ruby/net-imap/commit/0ede4c40b1523dfeaf95777b2678e54cc0fd9618","label":"ruby/net-imap@0ede4c4"},"references":[{"type":"WEB","url":"https://github.com/ruby/net-imap/releases/tag/v0.3.10"},{"type":"WEB","url":"https://github.com/ruby/net-imap/releases/tag/v0.4.24"},{"type":"WEB","url":"https://github.com/ruby/net-imap/releases/tag/v0.5.14"},{"type":"WEB","url":"https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-42246.json"},{"type":"ADVISORY","url":"https://access.redhat.com/errata/RHSA-2026:33462"},{"type":"ADVISORY","url":"https://access.redhat.com/errata/RHSA-2026:33512"},{"type":"ADVISORY","url":"https://access.redhat.com/errata/RHSA-2026:33514"},{"type":"ADVISORY","url":"https://access.redhat.com/errata/RHSA-2026:33515"},{"type":"ADVISORY","url":"https://access.redhat.com/errata/RHSA-2026:33540"},{"type":"ADVISORY","url":"https://access.redhat.com/errata/RHSA-2026:33551"},{"type":"ADVISORY","url":"https://access.redhat.com/errata/RHSA-2026:33552"},{"type":"ADVISORY","url":"https://access.redhat.com/errata/RHSA-2026:33565"},{"type":"ADVISORY","url":"https://access.redhat.com/errata/RHSA-2026:33576"},{"type":"ADVISORY","url":"https://access.redhat.com/errata/RHSA-2026:33577"},{"type":"ADVISORY","url":"https://access.redhat.com/errata/RHSA-2026:33630"},{"type":"ADVISORY","url":"https://access.redhat.com/errata/RHSA-2026:33721"},{"type":"ADVISORY","url":"https://access.redhat.com/errata/RHSA-2026:34076"},{"type":"ADVISORY","url":"https://access.redhat.com/errata/RHSA-2026:35834"},{"type":"ADVISORY","url":"https://access.redhat.com/errata/RHSA-2026:35866"},{"type":"ADVISORY","url":"https://access.redhat.com/errata/RHSA-2026:35867"},{"type":"ADVISORY","url":"https://access.redhat.com/errata/RHSA-2026:35895"},{"type":"ADVISORY","url":"https://access.redhat.com/errata/RHSA-2026:36099"},{"type":"ADVISORY","url":"https://access.redhat.com/errata/RHSA-2026:37238"},{"type":"ADVISORY","url":"https://access.redhat.com/errata/RHSA-2026:37397"},{"type":"ADVISORY","url":"https://access.redhat.com/security/cve/CVE-2026-42246"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/42xxx/CVE-2026-42246.json"},{"type":"ADVISORY","url":"https://github.com/ruby/net-imap/security/advisories/GHSA-vcgp-9326-pqcp"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-42246"},{"type":"REPORT","url":"https://bugzilla.redhat.com/show_bug.cgi?id=2468499"},{"type":"FIX","url":"https://github.com/ruby/net-imap/commit/0ede4c40b1523dfeaf95777b2678e54cc0fd9618"},{"type":"FIX","url":"https://github.com/ruby/net-imap/commit/24a4e770b43230286a05aa2a9746cdbb3eb8485e"},{"type":"FIX","url":"https://github.com/ruby/net-imap/commit/97e2488fb5401a1783bddd959dde007d9fbce42c"},{"type":"FIX","url":"https://github.com/ruby/net-imap/commit/f79d35bf5833f186e81044c57c843eda30c873da"},{"type":"PACKAGE","url":"https://github.com/ruby/net-imap"},{"type":"WEB","url":"https://github.com/ruby/net-imap/releases/tag/v0.6.4"},{"type":"WEB","url":"https://github.com/rubysec/ruby-advisory-db/blob/master/gems/net-imap/CVE-2026-42246.yml"},{"type":"WEB","url":"https://nostarttls.secvuln.info"},{"type":"WEB","url":"https://www.rfc-editor.org/info/rfc8314"}],"provenance":{"sources":["OSV.dev","FIRST.org (EPSS)"],"lastVerified":"2026-08-27T11:30:34.575293613Z"}}