Ruby2ßhell: Pre-authentication RCE on stock Rails

Ruby2ßhell: Pre-authentication RCE on stock Rails

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.

该漏洞可以通过默认配置下的以下框架触发。其他框架默认情况下不会暴露,但如果应用程序代码对以旧版编码接收的字符串执行大写转换,也可能受到影响。

These products bundle their own Ruby, so the fix has to come from the vendor. Products marked Vulnerable have no fixed release yet: every current version is vulnerable.

这些产品捆绑了它们自己的 Ruby 环境,因此修复必须由供应商提供。标记为“易受攻击”(Vulnerable)的产品尚未发布修复版本:目前所有版本均存在漏洞。

Updated 20 November 2026 at 01:59 UTC.

更新于 2026 年 11 月 20 日 01:59 UTC。

Upgrade Ruby to a fixed release: 3.3.14, 3.4.13 or 4.0.10.

请将 Ruby 升级至修复版本:3.3.14、3.4.13 或 4.0.10。

Install the vendor’s fixed release. See Self-hosted software for fixed versions of popular products.

请安装供应商提供的修复版本。有关热门产品的修复版本,请参阅“自托管软件”(Self-hosted software)部分。

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).

大多数 Ruby 的单字节编码中没有大写的 ß。将其转换为大写会写入两个字节(SS),但循环仅对其中一个字节进行了边界检查(to < to_end)。

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.

输出缓冲区分配的大小为输入长度加上 20 字节。每个 ß 会在输出中增加一个字节,因此包含 21 个 ß 的输入会导致缓冲区溢出一个字节。

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?.

同样的循环存在于多种 ISO-8859 和 Windows-125x 编码中,且自 Ruby 2.4.0 版本以来一直存在。该循环可通过 upcase、swapcase、downcase(:fold) 和 casecmp? 方法触发。

UTF-8 strings take a different code path and are not affected.

UTF-8 字符串采用不同的代码路径,因此不受影响。

Fixed upstream in ruby/ruby@d582f8f.

已在上游 ruby/ruby@d582f8f 中修复。

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.

这是一个单字节堆溢出漏洞。执行大写转换时写入的字节为 S (0x53),执行大小写折叠(case-folding)时写入的字节为 s (0x73),该字节会直接落在输出缓冲区之后。攻击者可以通过输入长度来控制缓冲区的大小。

Copying the result out of the buffer then reads one byte out of bounds.

将结果从缓冲区中复制出来时,会读取到缓冲区外的一个字节。

We’ll be publishing a proof of concept demonstrating remote code execution on stock Rails on 25 November 2026, or later if major vendors have not shipped a fix by then.

我们将于 2026 年 11 月 25 日发布一个概念验证(PoC),演示在标准 Rails 环境下的远程代码执行;如果届时主要供应商尚未发布修复程序,发布时间将会推迟。

Veria Labs found this vulnerability independently and was the first to demonstrate remote code execution.

Veria Labs 独立发现了此漏洞,并率先演示了远程代码执行。

The Ruby security advisory also credits Stephan Lipp (Ada Logics) and Anthropic with reporting the underlying primitive. Additional discoverers include Moritz Sanft in collaboration with OpenAI.

Ruby 安全公告还将底层原语的报告归功于 Stephan Lipp (Ada Logics) 和 Anthropic。其他发现者还包括与 OpenAI 合作的 Moritz Sanft。