Ruby2Shell: Pre-auth RCE hits default Rails installs
Original: Ruby2ßhell: Pre-authentication RCE on stock Rails
Why This Matters
Default Rails exposure means millions of apps face unauthenticated RCE without custom code.
A one-byte heap overflow in Ruby's string case conversion enables unauthenticated remote code execution on default Rails and Sinatra apps. Fixed in Ruby 3.3.14, 3.4.13, and 4.0.10. GitLab and GitHub Enterprise Server remain affected.
Veria Labs has disclosed Ruby2Shell (GHSA-34m4-m9fh-gqp5), a critical pre-authentication remote code execution vulnerability affecting Ruby versions 2.4.0 through the latest releases of the 3.3, 3.4, and 4.0 series. The root cause is a one-byte heap overflow in Ruby's string case conversion for single-byte encodings such as ISO-8859 and Windows-125x. When upcasing the German character ß, the code writes two bytes (SS) but only bounds-checks for one, so 21 or more ß characters in the input overflow the heap buffer. The overflowed byte is a predictable S (0x53) or s (0x73), and the attacker controls buffer sizing via input length. Rails and classic-style Sinatra are exposed in their default configuration; plain Rack is not. Among popular self-hosted software, GitLab 19.6.0 (bundling Ruby 3.3.13) and GitHub Enterprise Server 3.22.5 (bundling Ruby 4.0.9) remain affected. Mastodon, OpenProject, and Discourse have already shipped fixed versions. UTF-8 strings use a separate code path and are unaffected. The fix landed in ruby/ruby@d582f8f. A proof-of-concept is scheduled for release one week after disclosure.