RHSB-2026-021 One-byte heap overflow - ruby (CVE-2026-132825) - "ruby2shell"

Public Date: November 20, 2026, 07:19
Mis à jour November 20, 2026, 12:39

Est-ce que cette infomation vous a été utile ?

Commentaires annulés

Ongoing État
Critical Impact

Executive Summary

This issue has been assigned CVE-2026-132825 and has been rated with a severity impact of Critical.

A vulnerability in the Ruby programming language, publicly referred to as ruby2shell, allows an attacker to crash a Ruby application or, in some circumstances, execute arbitrary code within the context of the Ruby process. The flaw is a one-byte heap buffer overflow that can be triggered when a Ruby application performs case conversions (such as upcase or downcase) on attacker-supplied text that uses specific non-UTF-8 single-byte character encodings, for example ISO-8859-1 or Windows-1252. Under these conditions, a single byte can be written outside the bounds of an allocated memory buffer, corrupting adjacent heap memory.

Most standard deployments process UTF-8 encoded text by default, which restricts exposure under typical configurations. Environments whose Ruby applications never perform case conversions on non-UTF-8 encoded, attacker-influenced input are unlikely to be impacted by this flaw.

The investigation is ongoing and this bulletin will be updated as new information emerges. Log in with your Red Hat account, then click the "Follow" button below to be notified of changes to this bulletin.

Affected Products

The following Red Hat product versions are directly affected:

  • Red Hat Enterprise Linux 10
  • Red Hat Enterprise Linux 9
  • Red Hat Enterprise Linux 8
  • Red Hat Enterprise Linux 7 (Extended Lifecycle Support)
  • Red Hat OpenShift Container Platform 5
  • Red Hat OpenShift Container Platform 4
  • Red Hat OpenStack Platform 17.1
  • Red Hat OpenStack Platform 16.2
  • Red Hat OpenStack Platform 13 (Extended Lifecycle Support)
  • Red Hat Satellite 6
  • Red Hat 3scale API Management 2

Further, any Red Hat product which is supported on Red Hat Enterprise Linux (including RHEL CoreOS) is also potentially impacted. This includes

  • Product containers that are based on the RHEL or UBI container images. These images are updated regularly, and container health indicating whether a fix to this flaw is available can be seen in the Container Health Index, part of the Red Hat Container Catalog. In addition, any customer containers should be rebuilt when the base images are updated.
  • Products that pull packages from the RHEL channel (this includes layered products such as Red Hat OpenShift Container Platform, Red Hat OpenStack Platform, Red Hat Virtualization, and others). Please ensure that the underlying Red Hat Enterprise Linux ruby package is current in these product environments.

Technical Summary

Ruby provides built-in methods for converting the case of strings, such as upcase, downcase, and swapcase. When these operations are applied to strings in certain single-byte character encodings, such as ISO-8859-1 or Windows-1252, the conversion logic can write a single byte beyond the end of a heap-allocated buffer. An attacker who controls the content and encoding of a string that is later case-converted by a Ruby application can exploit this out-of-bounds write to corrupt adjacent heap memory, which may result in a crash of the Ruby process or, with careful heap layout manipulation, arbitrary code execution with the privileges of the Ruby process.

This issue is present in Ruby before versions 3.3.14, 3.4.13, and 4.0.10. The Red Hat severity rating of Critical reflects the potential for remote code execution; however, exploitation requires the target application to perform case conversions on attacker-supplied text in a specific non-UTF-8 encoding, and successful code execution further depends on complex heap layout manipulation.

Detection

To determine whether the Ruby interpreter installed on a system is affected, check the installed package version:

rpm -q ruby ruby3.3 ruby4.0

Systems running Ruby versions prior to 3.3.14, 3.4.13, or 4.0.10 (as packaged for the respective Red Hat product) are affected.

Conditions

Exploitation of this vulnerability requires all of the following conditions to be met:

  • A Ruby application processes text whose content and character encoding are controlled, directly or indirectly, by an attacker.
  • The application performs a case conversion operation (upcase, downcase, or swapcase) on that text while it is in an affected single-byte character encoding, such as ISO-8859-1 or Windows-1252.
  • For code execution, as opposed to a crash, the attacker must additionally manipulate the process heap layout so that the single out-of-bounds byte corrupts data in a way that influences control flow.

Applications that process text exclusively in UTF-8 encoding, or that do not perform case conversions on attacker-supplied input, are not exposed to this flaw. Remote exploitation is possible when the attacker-controlled text reaches the application over a network, for example through a web request handled by a Ruby-based web application.

Mitigation

Overall Guidance

Red Hat is currently investigating mitigation options. Detailed guidance will be provided in a future update to this bulletin.

Product-Specific Mitigation Steps

The vulnerable code path is limited to the case conversion methods upcase/upcase!, swapcase/swapcase!, downcase/downcase! with the :fold option (plain downcase/downcase! without :fold is not affected), and casecmp?, applied to strings in the following single-byte encodings: ISO-8859-1, -2, -3, -4, -9, -10, -13, -14, -15, -16, and Windows-1250, -1252, -1254, -1257. The corresponding Symbol methods, such as Symbol#upcase and Symbol#swapcase, are also affected. Strings in UTF-8 are not affected.

1. Reduce network exposure (highest priority)

Place internet-facing self-hosted Ruby applications (for example GitLab, Mastodon, Discourse, or internal Rails applications) behind a VPN, an authenticating reverse proxy, or strict IP allowlists until patched.

Configure a WAF or reverse proxy (Nginx, Cloudflare, AWS WAF) to inspect incoming Content-Type headers and request bodies. Either of the following measures is sufficient on its own:

  • Reject requests that declare charset=ISO-8859-x or charset=Windows-125x (where x is a wildcard). This option is universally applicable and does not modify request data.
  • Reject requests containing raw 0xDF bytes that are not part of a valid UTF-8 sequence. Where this is not feasible — for example, services that legitimately process German-language text in legacy single-byte encodings — rely on the charset-based rejection above.

Test these rules in detection or logging mode first so that legitimate binary uploads and legacy client integrations are not disrupted.

2. Application-layer mitigation (custom Rails, Sinatra, and Rack applications)

Enforce UTF-8 at the request boundary: reject or sanitize incoming parameters and headers that declare ISO-8859-* or Windows-125* encodings, or validate that incoming strings are valid UTF-8 before they reach application logic.

Audit application code for case conversion of external input — upcase, swapcase, downcase with the :fold option, casecmp?, and their Symbol counterparts — particularly in authentication, header-parsing, and routing logic, and ensure such inputs are transcoded to UTF-8 beforehand.

3. Runtime and process hardening

Configure automatic worker recycling (for example Puma, Unicorn, or Sidekiq worker management) to restart worker processes periodically or on memory thresholds. This limits the impact of any memory corruption and disrupts repeated exploitation attempts.

Where practical, pause non-essential internet-facing Ruby services until they are updated to Ruby 3.3.14, 3.4.13, or 4.0.10.

Technical Details

CVE-2026-132825

A flaw was found in Ruby. This vulnerability may allow arbitrary code execution or a Denial of Service (DoS) due to a heap-based buffer overflow during string case conversions. An attacker who supplies specially crafted text containing specific character encodings can trigger an out-of-bounds write of a single byte into adjacent memory, potentially corrupting application memory or causing the process to crash. The issue affects Ruby before 3.3.14, 3.4.13, and 4.0.10.

The flaw is classified as CWE-787 (Out-of-bounds Write). The Red Hat CVSS v3 score is 9.8 with the vector CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H.

Background

Ruby is a dynamic, open source programming language focused on simplicity and productivity. It is widely used for web application development, notably with frameworks such as Ruby on Rails, and is included in Red Hat Enterprise Linux and consumed by numerous Red Hat products either as the ruby package or through bundled runtimes in containers and layered products.

Performance Impact

No performance impact is associated with this vulnerability or the planned fixes.

Product Impact

The impact rating for the flaw is referenced and linked to our Severity Ratings page.

Red Hat Enterprise Linux

Rated Critical. The ruby package and ruby module streams in Red Hat Enterprise Linux 7, 8, 9, and 10 are affected.

Red Hat OpenShift Container Platform

Rated Critical. OpenShift Container Platform 4 and 5 ship RHEL CoreOS 9, which contains the affected ruby package.

Other Affected Products

Red Hat OpenStack Platform 13, 16.2, and 17.1, Red Hat Satellite 6, and Red Hat 3scale API Management 2 include or consume the affected Ruby runtime and are therefore impacted.

Service Impact

Red Hat managed services that consume affected Ruby versions are being assessed. Updates will be provided as the investigation progresses.

FAQ

Q: Is my application vulnerable if it only handles UTF-8 text?

A: No. The overflow is triggered only when case conversion is performed on strings in specific single-byte encodings such as ISO-8859-1 or Windows-1252. Applications that process text exclusively in UTF-8 are not exposed to this flaw.

Acknowledgements

References

CVE-2026-132825

Veria Labs security advisory

OX Security blog

Aikido blog

Orca Security blog

How to use GPG to verify signed content from Product Security

Cette information vous a t-elle été utile? Vos commentaires nous intéressent.

Commentaires annulés

Comments