Join the Cyber Forum: Threat Intel on May 12, 2026 to learn how AI is reshaping threat defense.Join the Virtual Cyber Forum: Threat IntelRegister Now
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI for Security
      Leading the Way in AI-Powered Security Solutions
    • Securing AI
      Accelerate AI Adoption with Secure AI Tools, Apps, and Agents.
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • AI Data Pipelines
      Security Data Pipeline for AI SIEM and Data Optimization
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly Ingest Data from On-Prem, Cloud or Hybrid Environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    • Singularity Identity
      Identity Threat Detection and Response
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-Powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Securing AI
    • Prompt Security
      Secure AI Tools Across Your Enterprise
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-Class Expertise and Threat Intelligence
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      DFIR, Breach Readiness, & Compromise Assessments
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive Solutions for Seamless Security Operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • SentinelOne for Google Cloud
      Unified, Autonomous Security Giving Defenders the Advantage at Global Scale
    • Partner Locator
      Your Go-to Source for Our Top Partners in Your Region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
CVE Vulnerability Database
Vulnerability Database/CVE-2022-28738

CVE-2022-28738: Ruby-lang Ruby Use After Free Vulnerability

CVE-2022-28738 is a use after free vulnerability in Ruby-lang Ruby's Regexp compiler that allows attackers to write to unexpected memory locations. This article covers technical details, affected versions, impact, and mitigation.

Published: February 17, 2026

CVE-2022-28738 Overview

A double free vulnerability was discovered in the Regexp compiler in Ruby 3.x before 3.0.4 and 3.1.x before 3.1.2. If a victim attempts to create a Regexp from untrusted user input, an attacker may be able to write to unexpected memory locations, potentially leading to remote code execution or denial of service.

Critical Impact

This double free vulnerability in Ruby's Regexp compiler allows attackers to potentially achieve remote code execution by supplying crafted regular expression patterns, affecting all Ruby 3.x versions prior to the patched releases.

Affected Products

  • Ruby 3.x versions before 3.0.4
  • Ruby 3.1.x versions before 3.1.2
  • Ruby-lang Ruby (various distributions including Debian and Gentoo)

Discovery Timeline

  • 2022-04-12 - Ruby releases security advisory for CVE-2022-28738
  • 2022-05-09 - CVE-2022-28738 published to NVD
  • 2024-11-21 - Last updated in NVD database

Technical Details for CVE-2022-28738

Vulnerability Analysis

This vulnerability is classified as CWE-415 (Double Free), a memory corruption issue that occurs when memory is freed more than once. In the context of Ruby's Regexp compiler, the flaw exists in how the compiler handles memory allocation and deallocation during regular expression processing.

When processing certain regular expression patterns, the Ruby Regexp compiler incorrectly frees the same memory region twice. This double free condition can corrupt the memory allocator's internal data structures, leading to undefined behavior. An attacker who can influence the regular expression patterns being compiled can potentially exploit this condition to achieve arbitrary memory writes.

The vulnerability is particularly dangerous because regular expressions are commonly used to validate user input in web applications, meaning the attack surface is substantial in applications that construct Regexp objects from user-supplied data.

Root Cause

The root cause is a memory management error in Ruby's Regexp compilation process where the same memory block is deallocated twice. This occurs due to improper tracking of memory ownership during the compilation of complex regular expression patterns. When memory is freed more than once, the heap allocator's metadata becomes corrupted, creating conditions for exploitation.

Attack Vector

The attack vector is network-based and requires no privileges or user interaction. An attacker can exploit this vulnerability by:

  1. Identifying a Ruby application that creates Regexp objects from user-controlled input
  2. Crafting a malicious regular expression pattern that triggers the double free condition
  3. Submitting this pattern to the vulnerable application
  4. The double free corrupts heap metadata, potentially allowing the attacker to write to arbitrary memory locations

The vulnerability manifests during Regexp compilation when processing untrusted input. Attackers can craft specific regular expression patterns that trigger the memory management flaw. For detailed technical analysis, refer to the HackerOne Report #1220911 and the official Ruby security advisory.

Detection Methods for CVE-2022-28738

Indicators of Compromise

  • Unexpected application crashes or segmentation faults in Ruby processes, particularly during regex operations
  • Memory corruption errors in application logs related to Regexp compilation
  • Unusual memory consumption patterns in Ruby applications processing regular expressions
  • Application behavior anomalies when handling user-supplied pattern matching input

Detection Strategies

  • Monitor Ruby application logs for memory allocation errors or double-free warnings
  • Implement runtime memory sanitizers (such as AddressSanitizer) in development and testing environments to detect double-free conditions
  • Use SentinelOne's behavioral AI to detect anomalous memory access patterns indicative of heap corruption exploits
  • Audit codepaths where user input flows into Regexp.new() or similar regex construction methods

Monitoring Recommendations

  • Enable verbose logging for Ruby applications to capture memory-related errors
  • Deploy application performance monitoring (APM) solutions to track unusual memory behavior in production
  • Implement alerting for application crashes in Ruby services, especially those handling user input for pattern matching
  • Review web application firewall (WAF) logs for suspicious regex patterns in request parameters

How to Mitigate CVE-2022-28738

Immediate Actions Required

  • Upgrade Ruby to version 3.0.4 or later for Ruby 3.0.x installations
  • Upgrade Ruby to version 3.1.2 or later for Ruby 3.1.x installations
  • Audit applications to identify code paths where user input is used to construct Regexp objects
  • Implement input validation and sanitization for any user-controlled data used in regular expressions

Patch Information

Ruby has released patched versions that address this vulnerability:

  • Ruby 3.0.4 - Contains the fix for Ruby 3.0.x branch
  • Ruby 3.1.2 - Contains the fix for Ruby 3.1.x branch

Organizations should apply these updates immediately. For detailed patch information, consult the Ruby security advisory. Distribution-specific advisories are available from Debian, Gentoo, and NetApp.

Workarounds

  • Avoid constructing Regexp objects directly from untrusted user input until patches can be applied
  • Implement strict allowlists for acceptable regex patterns if user input must be used
  • Use precompiled, static regular expressions instead of dynamically generated patterns where possible
  • Consider using alternative string matching methods that don't require Regexp compilation for untrusted input
bash
# Verify Ruby version and upgrade if vulnerable
ruby --version

# For Ruby version managers (rbenv), upgrade to patched version
rbenv install 3.0.4
rbenv global 3.0.4

# For RVM users
rvm install 3.0.4
rvm use 3.0.4 --default

# Verify the upgrade
ruby --version

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

  • Vulnerability Details
  • TypeUse After Free

  • Vendor/TechRuby

  • SeverityCRITICAL

  • CVSS Score9.8

  • EPSS Probability0.37%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityHigh
  • CWE References
  • CWE-415
  • Technical References
  • HackerOne Report #1220911

  • Gentoo GLSA 202401-27

  • NetApp Security Advisory ntap-20220624-0002
  • Vendor Resources
  • Debian CVE-2022-28738 Tracker

  • Ruby News CVE-2022-28738 Update
  • Related CVEs
  • CVE-2025-61594: Ruby-lang Uri Information Disclosure Bug

  • CVE-2024-27282: Ruby Regex Information Disclosure Flaw

  • CVE-2024-27280: Ruby StringIO Buffer Overflow Vulnerability

  • CVE-2023-36617: Ruby-lang URI DoS Vulnerability
Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the World’s Most Advanced Cybersecurity Platform

See how our intelligent, autonomous cybersecurity platform can protect your organization now and into the future.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2026 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use

English