Skip to content

[CVE-2026-42246] Pin net-imap 0.3.10 - #457

Merged
Jan-Kazlouski-elastic merged 3 commits into
mainfrom
jan-kazlouski/12735-cve-2026-42246-fix
Jul 24, 2026
Merged

[CVE-2026-42246] Pin net-imap 0.3.10#457
Jan-Kazlouski-elastic merged 3 commits into
mainfrom
jan-kazlouski/12735-cve-2026-42246-fix

Conversation

@Jan-Kazlouski-elastic

@Jan-Kazlouski-elastic Jan-Kazlouski-elastic commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Part of https://github.com/elastic/security/issues/12735

Resolves CVE-2026-42246 (high) — STARTTLS stripping / response injection in Net::IMAP#starttls. Fixed in net-imap 0.3.10.

JRuby 9.4.12.0 ships vulnerable net-imap in two places: the default gem 0.2.3 and an older stdlib copy 0.1.1 (net/imap.rb). The crawler does not use IMAP; this change removes both from the images and pins the fixed gem so scanners and runtime use 0.3.10.

Changes

  • Gemfile / Gemfile.lock: pin net-imap 0.3.10 (lowest fixed release) so Bundler installs over the JRuby default gem.
  • Dockerfile / Dockerfile.wolfi: remove the default net-imap 0.2.3 gem artifacts and the older stdlib net/imap.rb (0.1.1) from /opt/jruby.
  • NOTICE.txt: regenerated for the new gems (make notice); added a date license-file fallback.

Testing

  • Full test suite (JRuby 9.4.12.0 image): 690 examples, 0 failures, 16 pending.
  • Confirmed runtime net-imap version is 0.3.10 (vendor/bundle/.../net-imap-0.3.10).
  • Confirmed the post-cleanup image has no remaining *imap* files under /opt/jruby, and the app still loads 0.3.10 via bundler/setup.

Scanner A/B (CVE-2026-42246)

Tool Before After
Trivy reported clear
Snyk reported (SNYK-RUBY-NETIMAP-16420230) clear

Checklists

Pre-Review Checklist

  • This PR does NOT contain credentials of any kind, such as API keys or username/passwords (double check crawler.yml.example and elasticsearch.yml.example)
  • This PR has a meaningful title
  • This PR links to all relevant GitHub issues that it fixes or partially addresses
  • this PR has a thorough description
  • Covered the changes with automated tests
  • Tested the changes locally
  • Added a label for each target release version (example: v0.1.0)
  • Considered corresponding documentation changes
  • Contributed any configuration settings changes to the configuration reference
  • Ran make notice if any dependencies have been added

Changes Requiring Extra Attention

  • Security-related changes (encryption, TLS, SSRF, etc)

Release Note

Pin net-imap to 0.3.10 to resolve CVE-2026-42246 (STARTTLS stripping in Net::IMAP).

JRuby 9.4.12.0 ships vulnerable default net-imap 0.2.3 (STARTTLS
stripping). Pin the lowest fixed release and remove the default gem
from Docker images so scanners and runtime both use 0.3.10.

Part of elastic/security#12735
@Jan-Kazlouski-elastic

Jan-Kazlouski-elastic commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

Scanner A/B (CVE-2026-42246) — updated

Tool Before After
Trivy reported clear
Snyk reported (SNYK-RUBY-NETIMAP-16420230) clear

The default gem removal missed the older stdlib copy
(/opt/jruby/lib/ruby/stdlib/net/imap.rb, net-imap 0.1.1), which still
contains the vulnerable #starttls and is within the CVE-2026-42246
affected range (< 0.3.10). Remove it too so no vulnerable IMAP code
remains in the images; the app loads the pinned 0.3.10 gem via Bundler.

Part of elastic/security#12735
@Jan-Kazlouski-elastic
Jan-Kazlouski-elastic force-pushed the jan-kazlouski/12735-cve-2026-42246-fix branch from 8a2758a to e90f688 Compare July 23, 2026 19:00
@Jan-Kazlouski-elastic
Jan-Kazlouski-elastic enabled auto-merge (squash) July 24, 2026 14:17
Resolve NOTICE.txt conflict by regenerating it (make notice) on top of
the merged Gemfile.lock, which now includes both erb 4.0.4.1 (#456) and
net-imap 0.3.10.
@Jan-Kazlouski-elastic
Jan-Kazlouski-elastic merged commit 209df52 into main Jul 24, 2026
2 checks passed
@Jan-Kazlouski-elastic
Jan-Kazlouski-elastic deleted the jan-kazlouski/12735-cve-2026-42246-fix branch July 24, 2026 18:54
@github-actions

Copy link
Copy Markdown

💚 Backport PR(s) successfully created

Status Branch Result
1.0 #459

This backport PR will be merged automatically after passing CI.

Jan-Kazlouski-elastic added a commit that referenced this pull request Jul 27, 2026
Backports the following commits to 1.0:
 - [CVE-2026-42246] Pin net-imap 0.3.10 (#457)

Co-authored-by: Jan-Kazlouski-elastic <jan.kazlouski@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants