Ruby2Shell: Critical Ruby vulnerability allows remote code execution
A critical vulnerability in Ruby discovered in November 2026 enables unauthenticated attackers to execute code on affected servers. The flaw, tracked as CVE-2026-132825 and nicknamed Ruby2Shell, involves a one-byte heap overflow in how Ruby processes case conversions on strings using legacy single-byte encodings.
Ruby maintainers released fixes in versions 3.3.14, 3.4.13 and 4.0.10 on November 18, 2026. The vulnerability has existed since Ruby 2.4.0 and affects all Ruby versions in the 2.4 through 3.3 series up to 3.3.13, the 3.4 series up to 3.4.12, and the 4.0 series up to 4.0.9. UTF-8 encoded strings are not vulnerable.
Applications that call case-modification methods such as upcase, capitalize or swapcase on untrusted strings in ISO-8859-x or Windows-125x encodings are affected. Rails and classic-style Sinatra applications change string case by default and are exposed by remote attackers without authentication.
Technical details of the heap overflow
The vulnerability stems from how Ruby implements case conversion methods on strings encoded in legacy single-byte character sets. When Ruby normalizes or transforms such strings, a single-byte overflow occurs in the heap allocated for the string's internal representation. Under specific conditions, an attacker can craft input that triggers memory corruption, resulting in arbitrary code execution with the privileges of the Ruby process.
The overflow specifically affects ISO-8859-x and Windows-125x encodings. Ruby's UTF-8 path does not contain this code and is not affected. The one-byte nature of the overflow makes it particularly insidious, as malformed input that appears benign can trigger the condition.
Rails and classic Sinatra applications are affected by default because both frameworks convert request parameters and other untrusted strings to the appropriate encoding before processing. An attacker sending a crafted request with a string in a legacy encoding can trigger the overflow through standard request-handling paths.
Impact on self-hosted platforms
Several widely used self-hosted products bundle their own Ruby interpreter. As of November 19, 2026, the latest release of each of the following projects still ships a Ruby version affected by Ruby2Shell:
- GitLab
- GitHub Enterprise Server
- Mastodon
- OpenProject
- Discourse
- Chatwoot
Organizations running any of these platforms should treat the server as untrusted until the vendor releases a fixed Ruby version. In the interim, restricting access through network controls such as VPNs or IP allowlists reduces the attack surface.
Recommended mitigation
The primary mitigation is upgrading Ruby to a patched version. Available fixes are:
- Ruby 3.3.14
- Ruby 3.4.13
- Ruby 4.0.10
After upgrading, restart all application servers and rebuild container images. Any Dockerfiles or .ruby-version files that pin a specific Ruby version must be updated to reference the patched release. Ruby's maintainers have noted that no workaround exists for affected versions in the 2.4 through 3.2 series; those releases receive no further security fixes.
If immediate upgrading is not possible, operators of self-hosted platforms should make servers private through VPN or IP allowlisting until the vendor ships a patched release. This network-level restriction limits who can send requests that could trigger the vulnerability.
Coordinated disclosure
Ruby credits Stephan Lipp of Ada Logics and Anthropic for reporting the vulnerability. The fix was released together with six other regexp and string flaws, covering all seven issues in a single coordinated update. Aikido Intel tracks this flaw as AIKIDO-2026-151885.