Ruby2ßhell: Pre-authentication RCE on stock Rails
Affected software Ruby versions Your deployment The bug is reachable from the following frameworks in their default configuration. Other frameworks are not exposed by default, but application code that upcases strings received in a legacy encoding may also be vulnerable. Self-hosted software The latest version of the following popular software bundles an affected Ruby. Updated 19 November 2026 at 08:30 UTC. Remediation Your deployment Upgrade Ruby to a fixed release: 3.3.14, 3.4.13 or 4.0.10. Self-hosted software Install the vendor's fixed release. See Self-hosted software for fixed versions of popular products. Technical details Root cause Most of Ruby's single-byte encodings have no capital ß. Upcasing it writes two bytes, SS, but the loop only bounds-checks one (to < to_end). 1 while (*pp < end && to < to_end) { /* room for one byte */ 2 code = *(*pp)++; 3 if (code == SHARP_s) { 4 if (flags & ONIGENC_CASE_UPCASE) { 5 *to++ = 'S'; /* first byte */ 6 code = 'S'; 7 } 8 /* ... */ 9 } 10 /* ... */ 11 *to++ = code; /* second byte, unchecked */ 12 } The output buffer is allocated as the input length plus 20 bytes. Each ß adds one byte to the output, so an input with 21 of them overflows the buffer by one byte. The same loop is in several ISO-8859 and Windows-125x encodings and has been there since Ruby 2.4.0. It is reached by upcase, swapcase, downcase(:fold) and casecmp?. UTF-8 strings take a different code path and are not affected. Fixed upstream in ruby/ruby@d582f8f. Primitive A one-byte heap overflow. The byte written is S (0x53) when upcasing or s (0x73) when case-folding, and it lands directly after the output buffer. The attacker controls the size of the buffer through the input length. Copying the result out of the buffer then reads one byte out of bounds. Proof of concept We'll be publishing a proof of concept in a week, once people have had time to upgrade.