One byte too many, in Ruby since 2016
Ruby's security advisory credits Stephan Lipp of Ada Logics and Anthropic with the report. The security firm Veria Labs found the flaw independently, named it Ruby2Shell and says it was the first to show code execution with it.
| When | What |
|---|---|
| 19 November | The Ruby team publishes its advisory and the fixed releases 3.3.14, 3.4.13 and 4.0.10. The same releases fix six more memory flaws in Ruby's strings and regular expressions. |
| 19 November | Veria Labs publishes its write-up: Ruby on Rails and classic Sinatra are exposed in their default setup. No attacks are reported yet. |
| 19 to 21 November | GitLab, Mastodon, OpenProject, Chatwoot and Discourse ship fixed releases. GitHub Enterprise Server has none yet on 21 November. |
| 21 November | Shieldify's WAF starts refusing the form requests the attack needs, on every website with the WAF on. |
| 25 November | Veria Labs plans to publish its proof of concept, or later if major vendors have not shipped a fix by then. |
Twenty are fine. Twenty-one overflow.
The German letter ß has no capital of its own in most older character sets: in capitals it is written SS, two letters for one. When Ruby changes the case of a string in one of 14 older single-byte character sets, among them ISO-8859-1 and Windows-1252, it makes room for one letter and writes two. Ruby gives the result 20 spare bytes, so a string with 21 of these letters puts one byte past the end of its buffer.
One byte sounds harmless. In a memory-corruption attack it can be enough to damage whatever sits next to the buffer, and Ruby says it knows of proofs of concept that turn it into code execution in some scenarios. Text in UTF-8, which most of the web uses, takes another path in Ruby and is not affected.
Almost no application changes the case of such a string on purpose. The framework does it for them:
Before login
A web form can only send GET and POST, so Rails forms carry a hidden _method field for everything else, and a part of every Rails and classic Sinatra application turns its value into capitals. In an upload form each field may name its own character set, and Ruby's web layer believes it. This runs before sign-in checks and before any of the application's own code.
Elsewhere
Any code that changes the case of a form field, or compares two fields ignoring case, can be reached the same way. Semgrep found such a comparison in the sign-up of the Rodauth library. Strings from other servers, mail, files and databases in an old character set are further ways in that never pass a web form.
A patched and an unpatched Ruby answer such a request identically, with no error and nothing in a log. You cannot test a server for the flaw from outside: what counts is which Ruby each process runs.
The Ruby version decides, not your gems
- The Ruby version: 2.4.0 to 3.3.13, 3.4.0 to 3.4.12 and 4.0.0 to 4.0.9. The October security releases (3.3.13, 3.4.12, 4.0.9) are affected too. Ruby 3.2 and older are past their end of life and will not be fixed.
- The framework: Ruby on Rails with its full stack and classic-style Sinatra are exposed by default. Rails in API-only mode, modular Sinatra and plain Rack applications are not exposed through the framework, but their own code can still be.
- Products that bring their own Ruby: GitLab, GitHub Enterprise Server, Mastodon, OpenProject, Discourse and Chatwoot shipped an affected Ruby. Updating the server's Ruby package does not update theirs.
The flaw is in the Ruby interpreter, not in a gem. bundle update changes nothing, and a dependency scanner that reads Gemfile.lock stays silent. JRuby and TruffleRuby do not share it.
| Product | Fixed in |
|---|---|
| GitLab | 19.6.1, 19.5.8, 19.4.10 |
| Mastodon | 4.7.6, 4.6.12, 4.5.22, 4.4.29 |
| OpenProject | 17.9.8, 17.8.3 |
| Chatwoot | 4.20.1 |
| Discourse | Base image 2.0.20261119-0203; a forum is fixed once it is rebuilt |
| GitHub Enterprise Server | No fixed release on 21 November |
The table is Veria Labs' list of 21 November. Check your vendor's notes before you rely on it.
Update, restart, then check what you missed
1. Find every Ruby
ruby -v in your shell is not your application server. Check the Ruby each running process uses, the one each product bundles (GitLab keeps its own under /opt/gitlab/embedded) and the base image of every container.
2. Update and restart
Install Ruby 3.3.14, 3.4.13 or 4.0.10, or your product's fixed release, and rebuild container images. Then restart every application server: a worker started yesterday still runs yesterday's Ruby.
3. Distribution packages
Debian, Ubuntu, Red Hat and SUSE put fixes into the version they already ship, so the version number alone does not tell. Check the package against your distribution's advisory. Some ship Ruby 3.2 or older, which Ruby itself will not fix.
4. If you cannot update today
Keep the application behind a VPN or an allowlist until you can. Semgrep describes removing Rack::MethodOverride from a Rails application as an unofficial stopgap: it closes the path before login and breaks every form that sends PUT, PATCH or DELETE. It does not close the application's own code.
The same update fixes six others
Ruby 3.3.14, 3.4.13 and 4.0.10 also fix six memory flaws that got no name. One is in the same code: changing the case of a string whose result passes 4 GiB. The other five are in Ruby's regular expressions, and most of them need an application that builds a pattern from what a visitor sends, such as a search box that accepts patterns. Ruby says several of them can lead to code execution. The update covers all seven.
A rule for the form the attack needs
21 November. An emergency signature went live on every website on Shieldify with the WAF on. It refuses form requests that carry what the overflow needs, in the method field that Rails and Sinatra read before login, in the other fields of the form and in the names of uploaded files, before they reach the website. Forms sent from a browser and ordinary uploads pass as before.
The rule is listed under Shieldify Emergency Signatures in each website's WAF settings and can be switched off per website, for a program whose own uploads really look like what it refuses.
The flaw that needs a string of several gigabytes cannot arrive in a form field through Shieldify: the WAF already refuses fields of that size. Shieldify's own edge does not run Ruby, so the flaws do not touch the service itself.
A firewall buys time. It does not fix Ruby.
A web application firewall reads requests as they arrive. It cannot see a string that reaches Ruby another way: mail your application reads, files it imports, answers from other servers, rows from a database in an old character set, or traffic that reaches your server without passing through the firewall. And no signature can tell which pattern is safe for an application that compiles its visitors' regular expressions.
So treat any WAF protection, ours included, as the time it gives you to update. Update Ruby, restart every application server, and make sure your server only accepts web traffic through Shieldify.
Sources
- Ruby, security advisories of the November 2026 releases, and the advisory GHSA-34m4-m9fh-gqp5.
- Veria Labs, Ruby2Shell: the root cause, the affected frameworks and products, and the date of the proof of concept.
- Semgrep, Ruby2Shell: twenty is fine, twenty-one is a heap overflow: which methods and character sets reach the flaw, the paths through Rails, Sinatra and Rodauth, and how to find the Ruby a process runs.
- Cloudflare, How Cloudflare WAF protects against ruby2shell.
Shieldify's dates are from our own records.