Ruby Patches Ruby2Shell Vulnerability That Could Lead to RCE
Fresh security updates for the Ruby programming language resolve seven vulnerabilities in its regular expression engine and in the case conversion of strings. Proof-of-concept (PoC) code demonstrating remote code execution (RCE) exists for five of them.
At the top of the list sits CVE-2026-132825 (CVSS score of 7.4), described as a heap-based buffer overflow in the case conversion of strings that could potentially lead to RCE in certain scenarios.
Dubbed Ruby2Shell, the flaw impacts character case-conversion operations. In some single-byte encodings, including ISO-8859-1 and Windows-1252, when changing the case of a string, Ruby may end up writing one byte past the output buffer.
“For example, converting the German character ß to uppercase produces SS. In affected code, Ruby checks that sufficient space exists for one byte but writes two, potentially corrupting adjacent heap memory,” Previdian explains.
Veria Labs reports that, in default Ruby configurations, unauthenticated attackers could trigger the security defect from Rails, classic-style Sinatra, and potentially other frameworks.
According to preemptive exposure management firm WatchTowr, “any Ruby application that changes the case of external text in a single-byte encoding” is affected by the vulnerability.
According to Veria Labs, which plans to release a PoC after major vendors have rolled out patches, GitHub Enterprise Server is affected. Chatwoot, GitLab, Mastodon, OpenProject, and the Discourse base image have patched the bug.
Successful exploitation of Ruby2Shell in production environments is likely to be challenging, WatchTowr principal threat intelligence specialist Yordan Ganchev told SecurityWeek.
According to him, correctly laying out memory is difficult, and “attackers would also need the right non-glibc memory allocator, runtime configuration, and application logic preconditions, making exploitation even more challenging.”
“And if that weren’t enough, they’d need to contend with anyone else hammering the system on the internet and, in the end, defeat Address Space Layout Randomization (ASLR), making the whole journey a complete odyssey,” Ganchev noted.
Most likely, malformed requests could lead to denial-of-service (DoS) and service disruption, he said.
The other four vulnerabilities with a PoC demonstrating RCE include a double free, two integer overflows, and a heap-based buffer overflow. CVE identifiers for these issues have been requested but not assigned yet. PoC code also exists for an out-of-bounds read, demonstrating memory corruption.
Ruby also resolved an out-of-bounds read in its regular expression engine that could lead to memory leaks and process crashes.
Patches for all seven vulnerabilities were included in Ruby versions 4.0.10, 3.4.13, or 3.3.14. Users are advised to apply the fixes as soon as possible.
Originally published on SecurityWeek