Skip to content
Putting technology to work.
Insights to guide decisions and action.

Search articles

Seven fixes in Ruby 4.0.10: the October update is not enough

Table of contents · 6 items

Applications that were upgraded in late October to Ruby 4.0.9, 3.4.12 or 3.3.13, which included regular expression fixes, need to be updated again. According to Ruby's official announcement, the seven issues fixed on November 18 were present in all of 4.0.9, 3.4.12 and 3.3.13. If you assume the October update was enough, you will miss this announcement.

The announcement opens as follows.

Seven vulnerabilities have been discovered in Ruby’s regular expression engine and in the case conversion of strings. We are aware of PoCs that prove some of them can be used to trigger remote code execution. We have released Ruby 4.0.10, 3.4.13 and 3.3.14 to fix them. We strongly recommend upgrading.

It says there are seven vulnerabilities in the regular expression engine and in string case conversion, and that proof-of-concept code leading to remote code execution (RCE) exists for some of them. The development team strongly recommends updating.

In this article, we use the announcement, the GitHub advisories published in the ruby/ruby repository and the fix commits to lay out which operation each of the seven issues relates to. This should help you decide which applications to upgrade first.

Affected versions and what to update to

The affected versions and fixed versions listed in the announcement are as follows.

Release lineTargetFixed versionSupport status (official branch list)
4.04.0.0〜4.0.94.0.10normal maintenance
3.43.4.0〜3.4.123.4.13normal maintenance
3.33.3.13 and earlier3.3.14Legacy maintenance; scheduled to end on March 31, 2027
3.2 and earlierAllNoneEnded on April 1, 2026

No fixes will be released for 3.2 and earlier. The announcement also says, "Ruby 3.2 and earlier have reached their end of life and will not receive these fixes." Applications running on 3.2 first need a plan to upgrade to 3.3 or later.

The status of the 3.3 series was renamed with this update. According to the release announcement for 3.3.14, from this version the 3.3 series receives not only security fixes but also bug fixes deemed necessary. For that reason, the "security maintenance phase" was renamed the "legacy maintenance phase." The scheduled end (end of March 2027) has not changed for now. Note that the body of the vulnerability announcement still uses the old name: "Ruby 3.3 is in the security maintenance phase."

No CVE numbers have been assigned yet. The announcement says "CVE identifiers have been requested for these vulnerabilities but have not been assigned yet" and identifies the seven issues by GitHub advisory numbers (GHSA). The seven advisories were published in the ruby/ruby repository on November 19 between 0:13 and 0:17 (UTC). As of November 24, all of them still say "A CVE ID has been requested and is pending." and none appear in the GitHub Advisory Database (the global list). Vulnerability scanners that track CVE numbers or this database may not show them for a while.

The severities assigned to the repository advisories are critical for three, high for three and medium for one. No CVSS scores have been assigned.

The seven issues fall into three groups by the operation that triggers them

Grouping the descriptions in the announcement and advisories by the triggering operation gives the following.

Diagram dividing the seven issues fixed in Ruby 4.0.10 and other versions into three groups by triggering operation. Four involve building regular expressions from externally supplied patterns (2 critical, 2 high), one involves matching against externally supplied strings (medium), and two involve string case conversion (1 critical, 1 high). According to the GitHub advisory details, the two case conversion issues occur with strings in single-byte encodings such as ISO-8859-1 and Windows-1252, and with strings whose converted result exceeds 4 GiB

Building regular expressions from externally supplied patterns (4 issues)

The four are GHSA-7x2q-68qv-6p8x (double free, critical), GHSA-3p8q-wmhx-vm2w (heap buffer overflow, critical), GHSA-7whj-cfh7-xgm4 (buffer overflow in Regexp#to_s, high) and GHSA-wpqw-5qxg-m68r (out-of-bounds read in case-insensitive matching, high). The announcement describes all of them as affecting "applications that compile attacker-controlled patterns" or "applications that use attacker-controlled patterns." The advisory details for GHSA-7x2q say it occurs when parsing character class intersections (&&).

Applications that pass user input to Regexp.new or embed it in a regular expression as in /#{input}/ are affected. Passing a string to String#match or String#match? also builds that string into a regular expression. These are the same conditions as the October update. If you inventoried your code after the October announcement, you can reuse those results as is. We covered how to find such code in our article on the regular expression fixes in Ruby 4.0.9 and other versions.

After 4.0.10 was released, on November 20 an explanation was added to the ruby/ruby documentation (doc/security/security.rdoc and others) stating that passing untrusted input as a pattern is "generally not recommended." It says that not crashing on regular expressions is a goal, not a guarantee. If you only need to search for a string, it recommends using String#include?, or escaping with Regexp.escape before turning it into a regular expression. To match any of several strings, it recommends Regexp.union, which escapes each string. Along with updating, this gives you guidance for fixing places where input is used directly as a pattern.

Matching against externally supplied strings (1 issue)

Only GHSA-pvgc-g7gj-pv6h (an out-of-bounds read when matching a case-insensitive backreference, medium) has the description "Matching a crafted string may disclose memory contents or crash the process." in the announcement. It is described as a problem where the string being matched, not the pattern, is crafted. The impact is disclosure of memory contents or a crashed process.

The advisory details say: "When matching a case-insensitive backreference, Ruby could read past the end of the subject string." According to the fix commit whose description matches (65d21db on ruby_4_0, originally 9a6ccf7), the code that compares backreferences (such as \1) without regard to case could treat text past the end of the string as a match. Affected code is anywhere a pattern that combines a backreference with the i option, such as /(\w+)\s+\1/i, is used on strings that arrive from outside.

String case conversion (2 advisories)

GHSA-34m4-m9fh-gqp5 (buffer overflow, critical) and GHSA-87fm-7w84-j2px (integer overflow, high) occur not in regular expressions but in string case conversion. The announcement describes them as: "Changing the case of a crafted string may allow remote code execution."

Read from the announcement alone, these two look broad in impact, because code that applies downcase or upcase to user input is common, for example to normalize email addresses. The details of each advisory state the conditions under which they occur.

  • GHSA-34m4: "When changing the case of a string in some single-byte encodings, such as ISO-8859-1 and Windows-1252, Ruby could write one byte past the end of the output buffer." In other words, when converting strings in single-byte encodings such as ISO-8859-1 and Windows-1252, Ruby could write one byte past the end of the output area. According to the fix commit (c48b962 on ruby_4_0, originally d582f8f), when converting the German "ß" (0xDF) into two bytes, Ruby checked for only one byte of space in the output area. The fix covers 10 ISO-8859 encodings plus Windows-1250, 1252, 1254 and 1257
  • GHSA-87fm: "When changing the case of a string whose converted result exceeds 4 GiB, the length of the result could overflow". In other words, for strings whose converted result exceeds 4 GiB, the length calculation overflows. The fix commit (8159481 on ruby_4_0, originally bdff3c5) corrects how the length is counted, and also raises ArgumentError ("string size too big") when a string passed to this conversion (rb_str_casemap) exceeds INT_MAX (about 2 GB)

Neither the advisories nor the commits state which corresponds to which. The commits above were matched by the editorial team based on the reporters and descriptions.

Reading the advisory conditions, code that only converts UTF-8 strings is not affected by GHSA-34m4. GHSA-87fm is limited to cases where an attacker can make the app convert a string whose converted length exceeds 4 GiB. However, apps that read external files with force_encoding("Windows-1252") or similar fall within the conditions of GHSA-34m4. It is worth checking features such as importing CSV files exported from older spreadsheet software.

Apps to update first (editorial summary)

The announcement strongly recommends updating regardless of how Ruby is used. If you need to set an order, it is as follows.

  1. Apps that build regular expressions from external input. These include features such as search screens that accept regular expressions, or admin screens where users can register patterns. Four advisories apply, two of them critical. Proof-of-concept code for RCE is reported to exist.
  2. Apps that handle ISO-8859 or Windows-125x strings. These process external data in European languages in that encoding without converting it. GHSA-34m4 (critical) applies.
  3. Apps that use patterns combining a backreference with the i option on external strings.
  4. All other apps. Update them as part of your regular updates.

Even internal business systems can meet condition 1 if logged-in users can type anything into input fields. Do not postpone the update because the system is not public; decide based on the input paths.

How to upgrade and verify

In Rails apps, the Ruby version may be written in several places: .ruby-version, the ruby line in Gemfile, the base image in the Dockerfile, and the CI configuration (such as ruby-version in ruby/setup-ruby). Changing only one of them leaves development and production on different versions. Proceed in the following order.

# 版が書かれている場所をまとめて探す
grep -rnE '(^|[^0-9])(3\.3\.[0-9]+|3\.4\.[0-9]+|4\.0\.[0-9]+)' \
  .ruby-version Gemfile Gemfile.lock Dockerfile* .github/workflows 2>/dev/null
  1. Use the search above to find every place where the version is written. The RUBY VERSION field in Gemfile.lock is included.
  2. Change them to the fixed release in the same series (4.0.10, 3.4.13 or 3.3.14). Plan any upgrade across series separately from this fix.
  3. Run the tests in CI, start the app with the same image as production, and check ruby -v.
  4. If you use official Docker images or OS packages, confirm that the fixed release has reached them before switching. The official Docker Hub image (ruby) had tags for 4.0.10, 3.4.13 and 3.3.14 as of November 24. We have not checked OS packages. If the fix has not reached them, prepare a procedure to build from the ruby-lang.org distribution.

Scope of verification

On November 24, 2026, we checked the ruby-lang.org vulnerability announcement "Security advisories: multiple vulnerabilities in Regexp and String case conversion" (November 18, 2026), the release announcements for Ruby 4.0.10, 3.4.13 and 3.3.14, and the branch maintenance status page. Using the GitHub API, we checked the seven advisories in the ruby/ruby repository (severity, affected versions and details) and confirmed that they are not listed in the GitHub Advisory Database. We also checked the descriptions and diffs of the fixes named in this article in the commits up to tag v4.0.10 of ruby/ruby (the ruby_4_0 branch), together with the documentation changes added on November 20. For the official Docker Hub image, we only checked whether the tags exist (desk research). The mapping between advisories and commits is the editorial team's interpretation. We have not reproduced the bugs or checked behavior on the fixed releases or the status of each OS's packages. As of November 24, no release newer than 4.0.10, 3.4.13 and 3.3.14 has been published.

The Rails-side update is covered in the article on Rails 8.1.4.1. Ruby and Rails updates tend to land around the same time, so also decide whether to combine them into one round to reduce the number of test runs.

GleamHub accepts consultations on development, AI and automation, including maintenance of business systems built with Ruby and planning language and framework updates. Please reach out via our contact form.

References

Share this articleXFacebook
Kakeru Suzuki

Fascinated by the possibilities of technology, has had a deep interest in programming and digital art since student days

Turn this article's theme into your company's next step

Concrete steps forward for your organization.

We organize your desired architecture, legacy systems, and operational requirements to formulate your next steps toward execution.

  • Desired architecture
  • Integration with existing environments
  • Operational requirements
Consult on development & operations initiatives

You can consult with us from the initial conceptual stage. Details from this article will be carried over to the inquiry form.

Receive the latest articles by email