Ruby patches Ruby2Shell flaw with possible remote code execution

Ruby has fixed seven vulnerabilities, including Ruby2Shell, a heap buffer overflow in string case conversion that could enable remote code execution. Proof-of-concept code exists for five flaws.

The Ruby project has released updates for seven vulnerabilities in its string case-conversion functions and regular expression engine. Proof-of-concept code demonstrating remote code execution exists for five of the flaws.

Ruby2Shell, tracked as CVE-2026-132825 and rated 7.4 out of 10 on the CVSS scale, is a heap-based buffer overflow. It affects case conversion in some single-byte encodings, including ISO-8859-1 and Windows-1252.

When Ruby converts certain characters to uppercase, it may reserve space for one byte but write two. For example, the German character ß becomes “SS” in uppercase. The extra byte can corrupt nearby heap memory.

Veria Labs reported that unauthenticated attackers could trigger the flaw through Rails, classic-style Sinatra and potentially other frameworks in default Ruby configurations. The issue affects applications that convert externally supplied text to uppercase or lowercase while using a single-byte encoding.

GitHub Enterprise Server is affected, according to Veria Labs. Chatwoot, GitLab, Mastodon, OpenProject and the Discourse base image have patched the vulnerability.

The other four vulnerabilities with proof-of-concept code for remote code execution consist of a double-free bug, two integer-overflow flaws and another heap-based buffer overflow. Their CVE identifiers had been requested but not assigned.

Ruby also fixed an out-of-bounds read in its regular expression engine that could cause memory leaks and process crashes. Proof-of-concept code for another out-of-bounds read has demonstrated memory corruption.

Veria Labs plans to release Ruby2Shell proof-of-concept code after major vendors deploy patches. WatchTowr principal threat intelligence specialist Yordan Ganchev described successful exploitation in production as difficult because it would require specific memory layouts, allocator and runtime settings, application behavior and a way to bypass address space layout randomization.

Ganchev added that malformed requests were more likely to cause denial-of-service conditions and service disruption. The fixes are included in Ruby versions 4.0.10, 3.4.13 and 3.3.14. Users have been advised to update their installations as soon as possible.

Articles by this author