跳到正文
hackernews100(verialabs.com)· jdns·· 4 天前品質評分68

Ruby2ßhell 漏洞可讓攻擊者在 Rails 上未經驗證執行程式

Ruby2ßhell: Pre-authentication RCE on stock Rails

重點導讀

Ruby 的字串處理有一個漏洞,使用者不必先登入,就可能從採用預設設定的 Rails 或經典模式 Sinatra 觸發遠端程式執行。

  • 漏洞出在部分舊式文字編碼把 ß 轉成大寫時,寫入的資料超出記憶體緩衝區。
  • UTF-8 字串不受影響。Ruby 3.3.0 至 3.3.13、3.4.0 至 3.4.12 和 4.0.0 至 4.0.9 受影響,Ruby 3.2 及更舊版本也在影響範圍內。可升級到 Ruby 3.3.14、3.4.13 或 4.0.10。
  • 文章列出的 GitLab、GitHub Enterprise Server、Mastodon、OpenProject、Discourse 和 Chatwoot 也使用了受影響的 Ruby,應安裝廠商修補版本。作者表示,概念驗證預計一週後公開。

AI 伴隨問答

自備 Key 深度分析

針對這篇報導有疑問?可直接點選快捷問題或向 AI 追問背景脈絡與技術細節:

正文

Affected software

Ruby versions

Ruby series Affected Fixed in
4.0 4.0.0 to 4.0.9 4.0.10
3.4 3.4.0 to 3.4.12 3.4.13
3.3 3.3.0 to 3.3.13 3.3.14
3.2 and older All releases back to 2.4.0 EOL

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.

Framework Status on an affected Ruby
Rails Affected
Sinatra (classic style) Affected
Other frameworks and plain Rack Not exposed by default

Self-hosted software

The latest version of the following popular software bundles an affected Ruby.

Software Bundled Ruby Status
GitLab 19.6.0 3.3.13 Affected
GitHub Enterprise Server 3.22.5 4.0.9 Affected
Mastodon 4.7.5 4.0.9 Affected
OpenProject 17.9.7 4.0.9 Affected
Discourse 2026.10.1 3.4.7 Affected
Chatwoot 4.20.0 3.4.4 Affected

Updated 19 November 2026 at 10:00 UTC.

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

while (*pp < end && to < to_end) { /* room for one byte */

code = *(*pp)++;

if (code == SHARP_s) {

if (flags & ONIGENC_CASE_UPCASE) {

*to++ = 'S'; /* first byte */

code = 'S';

}

/* ... */

}

/* ... */

*to++ = code; /* second byte, unchecked */

}

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.

來源: hackernews100 (verialabs.com)
開啟原文

讀者討論

理性交流 · 即時討論