A single German letter lets attackers run code on stock Rails

Ruby2ßhell: Pre-authentication RCE on stock Rails

A single German letter lets attackers run code on stock Rails

A one-byte heap overflow in Ruby's single-byte encodings has lurked since 2.4.0: upcasing ß writes two bytes where the loop only checks room for one. Reachable through upcase, swapcase, downcase(:fold) and casecmp?, it makes default Rails and Sinatra apps vulnerable to pre-authentication RCE. Fixed in Ruby 3.3.14, 3.4.13 and 4.0.10; GitLab, GitHub Enterprise Server, Mastodon, Discourse and others ship affected versions.

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.
  1. cowlevel

    So the recent RCE wave seems to be people finding more single byte overflows and such, but reporting them as RCEs because AI can do the tedious grunt work of finding the rest of the vulnerability chain.

    If any single byte overflow can be converted into an RCE with minimal human effort then we have no choice but to prove the whole software stack is memory safe.

  2. circularfoyers

    Thought this was another vulnerability for a second, but for anyone else who thought the same, this is already covered in the Ruby advisory being discussed here https://news.ycombinator.com/item?id=50554038 (which covers six other vulnerabilities).

  3. barbegal

    More interested to see how you can use just a single byte overflow to trigger RCE. Definitely achievable but sounds tough.

  4. t1234s

    For people who haven't been to Germany the character that looks like a script B is pronounced like "S". Its a bit of humor in what is an annoying problem.

  5. Panzerschrek

    I suppose this function has been written first in assumption, that case conversion doesn't affect length, but later ß -> SS conversion has been added without proper testing.

  6. weinzierl

    There should be other codepoints other than ß that in principle could be used for a vulnerability like that. There are even ones that expand to three codepoints, like ffi.

  7. GTP

    > We'll be publishing a proof of concept in a week, once people have had time to upgrade.

    I think one may now decide to publish the PoC straight away or not publish it at all, since an AI agent pointed at this post would very likely be able to produce one in a few minutes.

  8. speedgoose

    But can the attacker specify the encoding in rails? It's not like UTF-8 or GTFO?

More from this day

2026-11-19