Ruby flaw exposes default Rails apps to memory corruption; RCE not demonstrated

- Reading
- 4 min
- Tables
- 2
An advisory from Veria Labs describes a one-byte heap overflow in the Ruby interpreter, reachable from Rails' default configuration and present in GitLab, GitHub Enterprise, Mastodon, Discourse, and Chatwoot, but the company has not demonstrated remote code execution.
A memory corruption flaw in Ruby creates a one-byte heap overflow primitive in Rails applications running default configuration, and the same bug also affects GitLab, GitHub Enterprise, Mastodon, Discourse, and Chatwoot.
On November 19, 2026, Veria Labs published a security advisory describing a memory corruption vulnerability in the Ruby interpreter, cataloged as GHSA-34m4-m9fh-gqp5. The company nicknamed the flaw Ruby2Shell, a pun on the German character ß (sharp s): when converted to uppercase, it becomes SS, and that exact conversion is what breaks the code. According to Veria Labs itself, the issue is an attacker-controlled one-byte heap overflow primitive; the company has not publicly demonstrated remote code execution from it.
How the Bug Works
Most of Ruby's single-byte encodings (ISO-8859, Windows-125x) have no uppercase version of ß. When the interpreter tries to uppercase that letter, it has to write two bytes (SS) instead of just one. The problem is that the loop performing this conversion only checks whether there is room for one byte before writing, not two.
The output buffer is allocated with the size of the input plus 20 bytes. Since each ß adds one extra byte to the output, a string with 21 occurrences of the character is already enough to overflow the buffer by one byte, right at the edge of the heap-allocated area.
In short: this is a single-byte heap overflow, but an attacker-controlled one. The byte written is S (0x53) when converting to uppercase or s (0x73) in case-folding operations, and the attacker decides the buffer size by manipulating the length of the input string. Copying the corrupted buffer's result out still produces an out-of-bounds read beyond the allocated memory.
The vulnerable code path is used by four methods common in Ruby applications: upcase, swapcase, downcase(:fold), and casecmp?. UTF-8 strings are not affected, since they follow a different execution path. The flaw has existed since Ruby 2.4.0, according to the Veria Labs advisory.
Why Rails Is Exposed by Default
According to the advisory, the bug is reachable from Rails' default configuration and from Sinatra in classic style. Other frameworks and plain Rack, used without these layers, are not exposed by default, but any application whose code applies upcase (or the other three methods mentioned) to strings received in a legacy encoding is also at risk, regardless of framework.
This is what makes the flaw relevant to Ruby developers: no exotic configuration is needed to be exposed, it's enough to run Rails with a vulnerable version of the interpreter and process input in these legacy encodings.
Which Versions Are Vulnerable
The table below summarizes the affected series and the fixed versions, according to Veria Labs:
| Ruby Series | Affected Versions | Fixed In |
|---|---|---|
| 4.0 | 4.0.0 to 4.0.9 | 4.0.10 |
| 3.4 | 3.4.0 to 3.4.12 | 3.4.13 |
| 3.3 | 3.3.0 to 3.3.13 | 3.3.14 |
| 3.2 and earlier | All, since 2.4.0 | No fix (EOL) |
Anyone still running Ruby 3.2 or older series will not receive a backported patch: these versions are already out of their support cycle (EOL), and the only way out is to migrate to a maintained series (3.3.14, 3.4.13, or 4.0.10 onward).
Self-Hosted Products That Bundle Vulnerable Ruby
The flaw is not limited to in-house Rails applications. Several popular self-hosted products, common at Brazilian companies, ship a vulnerable Ruby bundled into their most recent versions:
| Software | Version | Bundled Ruby | Status |
|---|---|---|---|
| GitLab | 19.6.0 | 3.3.13 | Affected |
| GitHub Enterprise Server | 3.22.5 | 4.0.9 | Affected |
| Mastodon | 4.7.5 | 4.0.9 | Affected |
| OpenProject | 17.9.7 | 4.0.9 | Affected |
| Discourse | 2026.10.1 | 3.4.7 | Affected |
| Chatwoot | 4.20.0 | 3.4.4 | Affected |
For anyone administering a self-hosted instance of GitLab, GitHub Enterprise Server, Discourse, or Chatwoot in Brazil, this means waiting for (or already having received) a release from the vendor itself with the fixed Ruby, rather than trying to manually swap the interpreter in a packaged product.
How to Fix It
Veria Labs recommends two lines of action, which apply both to platform teams and to those who maintain their own applications:
- Update Ruby directly to
3.3.14,3.4.13, or4.0.10, depending on the series in use. - For self-hosted third-party software, install the version fixed by the vendor itself (the versions in the table above already ship with the vulnerable Ruby, so you need to wait for each product's next release).
In practice, the first step for a Brazilian team is to check the .ruby-version file or the Gemfile.lock of production projects and compare them against the table of fixed versions. CI/CD instances that pin the Ruby version in old Docker images also deserve attention, since the image may be locked to a vulnerable version even if the application's code hasn't changed.
What Remains Open
The fix is already available upstream, in commit ruby/ruby@d582f8f, but Veria Labs decided to hold back publication of a public proof of concept (PoC) for one week from the advisory, precisely to give those running Rails in production time to apply the patch before the exploit circulates. This means that, as of this advisory, the company has only described the memory corruption primitive (the out-of-bounds byte write), without publicly demonstrating a complete exploitation chain through to code execution.
For those who set patch priorities day to day, this shouldn't change the risk calculation much: reachability from Rails' default configuration and presence in widely used products (GitLab, GitHub Enterprise, Discourse) already justify treating the update as a priority, even without a complete exploitation chain published so far.
Translated from the Brazilian Portuguese original · Read the original
Nginx fixes two critical remote code execution flaws in HTTP/2
Researchers found two critical remote code execution vulnerabilities in Nginx, the world's most widely used web server, and maker F5 has already released mandatory fixes for anyone using HTTP/2.





