Vulnerabilities and exploitation

Ruby2Shell: Ruby patches seven memory bugs, five with RCE proof-of-concepts

Ruby 3.3.14, 3.4.13 and 4.0.10 fix seven memory-safety flaws in the regex engine and string case conversion. Proof-of-concept exploits reach code execution in some setups.

By Junglewise News DeskPublished 5 min read
An automated warehouse with conveyor belts moving cardboard parcels through sorting machinery
Photo by Hyundai Motor Group on UnsplashVideo: Junglewise Live

Ruby's maintainers released fixes on 18 November 2026 for seven memory-safety flaws in CRuby, the standard Ruby interpreter, affecting its regular expression engine and its string case-conversion code. Five of the seven come with proof-of-concept exploits that the maintainers say can reach remote code execution in some scenarios. The fixed releases are 3.3.14, 3.4.13 and 4.0.10.

The most widely discussed of them, now named Ruby2Shell, is CVE-2026-132825, a one-byte heap buffer overflow that fires when a string in a single-byte encoding such as Windows-1252 or ISO-8859-1 is converted to uppercase. An attacker who can get crafted text into such an application, through a file upload or an ordinary form field, can trigger it without authentication or special privileges. No exploitation in the wild has been recorded.

The cause is pleasingly small for the amount of trouble it creates. German ß becomes SS when uppercased, so one input byte turns into two output bytes. Security researcher Previdian explained to SecurityWeek that "Ruby checks that sufficient space exists for one byte but writes two, potentially corrupting adjacent heap memory". The exposure is correspondingly broad: WatchTowr described the affected population as "any Ruby application that changes the case of external text in a single-byte encoding", which covers a great deal of routine web code.

Turning that single stray byte into code execution is another matter. Yordan Ganchev, principal threat intelligence specialist at preemptive exposure management firm WatchTowr, told SecurityWeek that exploitation in production is likely to be hard: an attacker would need the right non-glibc memory allocator, a suitable runtime configuration, specific application logic preconditions and a way around address space layout randomisation, which he called a complete odyssey. Malformed requests, he said, are far more likely to cause denial of service and disruption than code execution.

Veria Labs takes a less relaxed view. According to SecurityWeek, the firm says unauthenticated attackers could reach the flaw in default configurations through Rails, classic-style Sinatra and potentially other frameworks, and that GitHub Enterprise Server is affected, while Chatwoot, GitLab, Mastodon, OpenProject and the Discourse base image have already shipped patches. Veria Labs plans to publish a proof-of-concept once major vendors have updated. Those claims have not been independently confirmed.

What to do now

  1. Upgrade Ruby to 3.3.14, 3.4.13 or 4.0.10, whichever matches the branch you run. All seven fixes landed in those releases, so a single upgrade closes the set.
  2. If you install Ruby from your distribution rather than from source, take the vendor package: SUSE, Ubuntu and Debian LTS have published their own advisories or patches for CVE-2026-132825, as recorded in the GitHub Advisory Database.
  3. Inventory the Ruby applications and appliances you operate, not just the ones you wrote. Products built on Ruby ship their own interpreter, so patching the host runtime does not necessarily patch them. GitLab has already released a fix, and Veria Labs says GitHub Enterprise Server is affected, a claim that has not been independently confirmed.
  4. Where an immediate upgrade is not possible, look at code paths that uppercase or downcase text arriving from outside, particularly where the string encoding is single-byte such as ISO-8859-1 or Windows-1252. Those are the paths that reach the case-conversion bug.
  5. Treat any application that compiles regular expression patterns supplied by users as higher priority still. Two of the fixed flaws, a double free and an out-of-bounds read, are reachable that way and both have proof-of-concept exploits attached.
  6. Watch for unexplained worker crashes and restarts in Ruby services. On the current reading of the bug, crashes and service disruption are the most likely visible effect of someone poking at it.

Technical details

The case-conversion overflow is tracked as CVE-2026-132825 and classified under CWE-122, Heap-based Buffer Overflow. The GitHub Advisory Database gives it a CVSS v3 base score of 7.4 (High) with vector AV:L/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H, attack vector listed as Local, no privileges and no user interaction required, and an EPSS score of 1.973%, in the 81st percentile for exploitation likelihood over 30 days. Ruby's own advisory GHSA-34m4-m9fh-gqp5, published by user 'mame' on 19 November 2026 with a CVE identifier still pending at the time, rates it Critical and classifies it as CWE-193, Off-by-one Error. Proof-of-concept exploits demonstrating code execution in some scenarios are known to exist.

Affected versions for the case-conversion flaw are all releases before 3.3.14, 3.4.0 up to but not including 3.4.13, and 4.0.0 up to but not including 4.0.10. The same version ranges apply to the other issues described below.

A double free in the regular expression engine, GHSA-7x2q-68qv-6p8x, occurs when parsing a character class intersection (&&) in a pattern and could allow remote code execution in applications that compile attacker-controlled regexes. It is rated Critical and classified as CWE-415, Double Free. "We are aware of PoCs that prove this flaw can be used to trigger RCE in some scenarios," the maintainers wrote in the advisory. A CVE identifier was requested but pending at publication.

GHSA-wpqw-5qxg-m68r covers a High severity out-of-bounds read in case-insensitive regular expression matching, CWE-125, which may allow remote code execution where regex patterns come from an attacker. The maintainers say they are aware of proof-of-concept code showing the flaw can lead to memory corruption in an attacker-controlled way. A separate Moderate issue, GHSA-pvgc-g7gj-pv6h, is an out-of-bounds read in case-insensitive backreference matching, also CWE-125, which can disclose memory contents or crash the process. Both had CVE identifiers requested but not assigned at publication.

The remaining issues with proof-of-concept code demonstrating remote code execution are two integer overflows and a further heap-based buffer overflow, with CVE identifiers requested and not yet assigned. Ruby also fixed an additional out-of-bounds read in the regex engine that can lead to memory leaks and process crashes.

Reporting credit for the case-conversion overflow, the regex double free and the case-insensitive matching read goes to Stephan Lipp of Ada Logics and Anthropic. The backreference out-of-bounds read was reported by Hiroya Fujinami and Hiroshi SHIBATA.

Share this article

On Junglewise Threat Intelligence

Related stories

Scan your domain free: see what attackers can see from outside, in about 30 seconds.

This article as Markdown. Atom feed.