← 新闻

安全新闻Ruby

Ruby Patches Ruby2Shell Vulnerability That Could Lead to RCE

VulnPulse 解读

Ruby2Shell (CVE-2026-132825): a one-byte overflow in Ruby's case conversion, fixed with six regex and string bugs in Ruby 4.0.10, 3.4.13 and 3.3.14

On November 18 the Ruby team shipped releases that fix seven bugs, spread across the regex engine and string case conversion, and said proof-of-concept code shows five of them can reach remote code execution in some setups.

目录
  1. 受影响对象
  2. 简单来说
  3. 原理
  4. 攻击过程
  5. 应对措施
  6. 尚不清楚的内容
  7. 出处

受影响对象

Ruby 3.3.13 and older, 3.4.0 to 3.4.12, and 4.0.0 to 4.0.9. Researcher Veria Labs says Rails and classic-style Sinatra expose the bug to unauthenticated users in their default setup. Products that bundle Ruby (GitLab, GitHub Enterprise Server, Mastodon and others) need a vendor update. Ruby 3.2 and older are end of life and get no fix.

简单来说

Picture copying text into boxes sized one letter each, where one particular letter turns into two when written. The extra letter spills into the neighbouring box, and whatever was stored there gets overwritten.

原理

CVE-2026-132825 is a bug where changing the case of a string in a single-byte encoding such as ISO-8859-1 or Windows-1252 writes one byte beyond the end of the output buffer. Veria Labs explains that some characters become two characters when upcased, yet the remaining space is only checked for one. UTF-8 text is handled by separate code and is safe, and the faulty loop dates back to Ruby 2.4.0. The other six bugs are memory-handling flaws in compiling and matching regular expressions and in Regexp#to_s (a double free, integer overflows, out-of-bounds reads and writes); most of them matter for apps that compile or match patterns supplied by an attacker. Ruby's GHSA rates the case-conversion bug Critical, while the CVSS score MITRE put in the CVE record is 7.4 (High). At release time the other six had no CVE numbers yet and were listed by GHSA ID.

攻击过程

  1. The attacker looks for an app that takes outside text and changes its case while it is still in a single-byte encoding (Veria Labs lists upcase, swapcase and casecmp? among the reachable methods)
  2. A crafted string makes the conversion write one byte past the buffer
  3. If the attacker manages to arrange memory just right, code can run inside the process. A watchTowr analyst told SecurityWeek that pulling this off on real systems is hard

应对措施

  • Developers and operators who install Ruby themselves: move to 4.0.10, 3.4.13 or 3.3.14 and restart your apps. Ruby 3.2 and older have no fix, so move to a supported series
  • Admins using a distro's Ruby package: check your distro's advisory for the fixed build. Debian shipped ruby3.3 3.3.14-0+deb13u1 for trixie on November 20
  • Self-managed GitLab admins: upgrade to 19.6.1, 19.5.8 or 19.4.10. Source installs must rebuild the Ruby that runs GitLab with 3.3.14 or 3.4.13 or later. GitLab says its hosted GitLab.com and Dedicated services need no action
  • GitHub Enterprise Server admins: 3.22.6 (November 22) says it updated Ruby and added application-level mitigations where an immediate update was not possible, without naming CVE numbers. Read the release notes for your series and upgrade
  • Users of other products that bundle Ruby: Veria Labs' table as of November 21 lists fixed releases for Chatwoot, Mastodon, OpenProject and the Discourse base image. Confirm versions in each vendor's notice
  • Everyone: Veria Labs plans to release a working exploit against stock Rails on November 25, or later if major vendors still lack a fix. Finish updating before then

尚不清楚的内容

  • Whether the bugs have been used in real attacks (CISA's assessment added to the CVE record on November 19 says exploitation: none)
  • CVE numbers for the remaining six bugs, and whether each is reachable from default setups such as Rails
  • The fix status for GitHub Enterprise Server series other than 3.22
  • Why Ruby's GHSA (Critical) and MITRE's CVSS (7.4) disagree on severity

出处

本解读由 VulnPulse 根据原文和公开信息以自己的语言撰写。准确信息请以出处为准。 更新:

原始公告 (原文)

Tracked as CVE-2026-132825, the bug is a heap-based buffer overflow that could lead to remote code execution (RCE).

在 SecurityWeek 阅读

2026/11/20 19:34,SecurityWeek 发布了“Ruby Patches Ruby2Shell Vulnerability That Could Lead to RCE”(类型:安全新闻)。相关技术:Ruby。CVE:CVE-2026-132825。