Ruby2ßhell: pre-authentication RCE via one-byte overflow in Ruby case conversion
The bug, called Ruby2ßhell, is a one-byte heap overflow[1] in Ruby's string case conversion that can lead to remote code execution[2] (RCE). It is rated Critical and can be reached without authentication in the default configuration of common Ruby web frameworks and self-hosted software.
The cause is that most single-byte encodings have no capital ß. When upcased, it becomes two bytes, SS, but the loop checks bounds for only one. The output buffer is the input length plus 20 bytes, so an input with 21 ß characters overflows it by one byte. The same loop exists in several ISO-8859[3] and Windows-125x encodings and has been there since Ruby 2.4.0. It is reached through upcase, swapcase, downcase(:fold) and casecmp?, while UTF-8 strings are not affected.
Fixed releases are 3.3.14, 3.4.13 and 4.0.10, and the fix is upstream in ruby/ruby@d582f8f. Users should upgrade Ruby, and self-hosted products should install the vendor's fixed release. The advisory is GHSA-34m4-m9fh-gqp5, and a CVE is still pending. The overflow writes an S (0x53) when upcasing or an s (0x73) during case folding[4], directly after the output buffer. Copying the result then reads one byte out of bounds. A proof of concept will be published in a week, after people have had time to upgrade.
Read the original verialabs.comDiscussion
Discussion
Commenters doubt that a single-byte overflow can become RCE with little effort, and some suspect the recent wave of such reports comes from AI tools finding more bugs. Others note that the Ruby advisory covers six other vulnerabilities, and one asks whether an attacker can choose the encoding in Rails.
Sources
-
Veria Labs
Ruby2ßhell: Pre-authentication RCE on stock Rails
-
KRGeekNews KO
Ruby2ßhell: 기본 구성 Rails에서 인증 없이 가능한 원격 코드 실행


