CVE-2026-42246: Net imap Net-imap Vulnerable To STARTTLS Stripping Vulnerability

HIGH
Advisory Identifier: GHSA-vcgp-9326-pqcp
Advisory Summary

CVE-2026-42246 is a HIGH net-imap vulnerable to starttls stripping vulnerability (CWE-841: Improper Enforcement of Behavioral Workflow) affecting Net imap libraries in the RubyGems ecosystem. The issue involves net-imap vulnerable to starttls stripping via invalid response timing. Remediation is available by upgrading affected packages to version 0.6.4, 0.5.14, 0.4.24, 0.3.10.

CVE-2026-42246 at a Glance

CVE Identifier CVE-2026-42246
GHSA Identifier GHSA-vcgp-9326-pqcp
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-841: Improper Enforcement of Behavioral Workflow
Affected Product Net imap
Package Ecosystem RubyGems
Published Date
Last Updated

How to Fix CVE-2026-42246

To remediate this vulnerability, upgrade all affected Net imap dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

net-imap fixed: 0.6.4
Upgrade net-imap to 0.6.4
net-imap fixed: 0.5.14
Upgrade net-imap to 0.5.14
net-imap fixed: 0.4.24
Upgrade net-imap to 0.4.24
net-imap fixed: 0.3.10
Upgrade net-imap to 0.3.10
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for net-imap

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-42246, inspect your project dependencies for Net imap:

inspect dependencies for net-imap

Analyze the terminal output to locate any version of Net imap in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.6.4), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-841: Improper Enforcement of Behavioral Workflow, where the product supports a session in which more than one behavior must be performed by an actor, but it does not properly ensure that the actor performs the behaviors in the required sequence. In Net imap, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary A man-in-the-middle attacker can cause `Net::IMAP#starttls` to return "successfully", without starting TLS. ### Details When 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. This allows man-in-the-middle attackers to perform a STARTTLS stripping attack, unless the client code explicitly checks `Net::IMAP#tls_verified?`. ### Impact TLS bypass, leading to cleartext transmission of sensitive information. ### Mitigation * Upgrade to a patched version of net-imap that raises an exception whenever `#starttls` does not establish TLS. * Connect to an implicit TLS port, rather than use `STARTTLS` with a cleartext port. This is strongly recommended anyway: * [RFC 8314](https://www.rfc-editor.org/info/rfc8314): Cleartext Considered Obsolete: Use of Transport Layer Security (TLS) for Email Submission and Access * [NO STARTTLS](https://nostarttls.secvuln.info/): Why TLS is better without STARTTLS, A Security Analysis of STARTTLS in the Email Context * Explicitly verify `Net::IMAP#tls_verified?` is `true`, before using the connection after `#starttls`.

CVE-2026-42246 Affected Net imap Versions

4 component(s)
Fixed Versions:
0.6.40.5.140.4.240.3.10
Product / Package Ecosystem Affected Versions Fixed Version
net-imap
RubyGems
≥ 0.6.0
< 0.6.4
0.6.4
net-imap
RubyGems
≥ 0.5.0
< 0.5.14
0.5.14
net-imap
RubyGems
≥ 0.4.0
< 0.4.24
0.4.24
net-imap
RubyGems
< 0.3.10
0.3.10

References

Frequently Asked Questions

What is CVE-2026-42246?
CVE-2026-42246 is a security vulnerability in Net imap involving net-imap vulnerable to STARTTLS stripping via invalid response timing under CWE-841: Improper Enforcement of Behavioral Workflow.
Which Net imap versions are affected?
Affected versions include releases prior to 0.6.4, 0.5.14, 0.4.24, 0.3.10 across affected packages: net-imap.
What version fixes CVE-2026-42246?
Upgrading to 0.6.4, 0.5.14, 0.4.24, 0.3.10 (or the latest patched release for your respective branch) resolves the vulnerability.
Is net-imap affected?
Yes, net-imap is affected in releases prior to 0.6.4, 0.5.14, 0.4.24, 0.3.10. Upgrade your dependency to 0.6.4, 0.5.14, 0.4.24, 0.3.10 or later.
What CWE is associated with CVE-2026-42246?
CVE-2026-42246 is classified under CWE-841: Improper Enforcement of Behavioral Workflow (The product supports a session in which more than one behavior must be performed by an actor, but it does not properly ensure that the actor performs the behaviors in the required sequence.).
How can I check RubyGems dependencies for CVE-2026-42246?
Run the dependency tree command: 'inspect dependencies for net-imap'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-vcgp-9326-pqcp",
  "modified" : "2026-05-14T20:48:01Z",
  "published" : "2026-05-04T22:01:52Z",
  "aliases" : [ "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`.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "net-imap"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.6.0"
      }, {
        "fixed" : "0.6.4"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.6.3"
    }
  }, {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "net-imap"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.5.0"
      }, {
        "fixed" : "0.5.14"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.5.13"
    }
  }, {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "net-imap"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.4.0"
      }, {
        "fixed" : "0.4.24"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.4.23"
    }
  }, {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "net-imap"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.3.10"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.3.9"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "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" : "WEB",
    "url" : "https://github.com/ruby/net-imap/commit/0ede4c40b1523dfeaf95777b2678e54cc0fd9618"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ruby/net-imap/commit/24a4e770b43230286a05aa2a9746cdbb3eb8485e"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ruby/net-imap/commit/97e2488fb5401a1783bddd959dde007d9fbce42c"
  }, {
    "type" : "WEB",
    "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.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://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"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-392", "CWE-393", "CWE-636", "CWE-754", "CWE-841" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-05-04T22:01:52Z",
    "nvd_published_at" : "2026-05-09T20:16:28Z"
  }
}