---
title: "Ruby patches seven memory bugs in its regex engine and string case conversion that can enable code execution"
url: https://badiyaa.com/ruby-regexp-string-case-vulnerabilities/
published: 2026-11-19T13:09:00+00:00
modified: 2026-11-19T13:09:00+00:00
section: Tech
publisher: Badiyaa
---

# Ruby patches seven memory bugs in its regex engine and string case conversion that can enable code execution

Ruby 4.0.10, 3.4.13 and 3.3.14 fix seven memory bugs in Ruby's regex engine and string case conversion; some can lead to remote code execution.

Changing a string from lowercase to uppercase should be harmless. In Ruby, until this week, a carefully crafted string could turn that routine call into a way to run code. The Ruby core team disclosed seven memory-safety bugs on November 18 and pushed out patched releases, numbered 4.0.10, 3.4.13 and 3.3.14, saying it knows of proof-of-concept exploits that reach remote code execution.

In [the Ruby project’s security advisory on the Regexp and String bugs](https://www.ruby-lang.org/en/news/2026/11/18/multiple-vulnerabilities-in-regexp-and-string/), the team writes that the flaws sit in two places: the regular expression engine and the code that converts the case of strings. It “strongly” recommends upgrading. CVE numbers have been requested but not yet assigned, so each bug is tracked for now by a GitHub Security Advisory ID.

## The seven bugs at a glance

Three of the seven involve case conversion, the work behind methods that change letters to upper or lower case. One is a one-byte heap overflow and another is an integer overflow that leads to a heap overflow; the advisory says proof-of-concept code can turn both into code execution in some scenarios. The project’s [GitHub advisory for the case-conversion overflow](https://github.com/ruby/ruby/security/advisories/GHSA-34m4-m9fh-gqp5) rates that first bug Critical.

The rest live in the regular expression engine. They include a double free and a heap overflow during pattern compilation, a heap overflow in Regexp#to_s, and two out-of-bounds reads during case-insensitive matching. The final read bug is the mildest of the set: the team says it can leak memory contents or crash a process, without a code-execution claim.

## Who is actually at risk

For most of the regex bugs, the advisory’s key phrase is “attacker-controlled patterns.” An app is exposed if it builds a regular expression from user input, such as a search box that accepts regex syntax, a filter rule typed into an admin panel, or a log tool that lets users write their own match rules. Apps that only run fixed patterns written by their own developers face far less risk from those bugs.

The case-conversion bugs are different. They need only a crafted string, not a crafted pattern, and calls such as upcase and downcase run on user-supplied text constantly in web apps, from usernames to email addresses. That makes them the more urgent of the two groups for anyone running Ruby on Rails or other Ruby web servers.

## Which versions to install

Affected releases are Ruby 3.3.13 and earlier, 3.4.0 through 3.4.12, and 4.0.0 through 4.0.9. The fixes are in 3.3.14, 3.4.13 and 4.0.10; [the Ruby 4.0.10 release notes](https://www.ruby-lang.org/en/news/2026/11/18/ruby-4-0-10-released/) list the security fixes alongside other bug fixes and download checksums. Ruby 3.2 and older have reached end of life and will get no patch, so teams still on them need to move to a supported branch.

This is the second regex-engine patch in under a month. [Ruby’s 2026 news archive](https://www.ruby-lang.org/en/news/2026/) shows that on October 23 the team shipped 4.0.9, 3.4.12 and 3.3.13 to fix bugs in Onigmo, the regular expression library inside Ruby, that GitLab had found could be used for remote code execution on its servers.

Credit for four of the seven new bugs goes to Stephan Lipp of Ada Logics together with Anthropic; two came through outside researchers, and the last was found by Ruby committers Hiroya Fujinami and Hiroshi Shibata. Ruby itself dates to 1995, according to [the encyclopedia entry on the Ruby language](https://en.wikipedia.org/wiki/Ruby_(programming_language)), and its C core is where these memory bugs live.

Badiyaa has tracked a busy month for web software patches, including [the nginx flaw that let attackers run code without logging in](https://badiyaa.com/nginx-http2-remote-code-execution/) and [jQuery’s 4.1.0 and 3.8.0 releases](https://badiyaa.com/jquery-4-1-0-3-8-0-release/). The Ruby team’s advisory was first published at midnight UTC on November 19.

## Sources

- [Security advisories: multiple vulnerabilities in Regexp and String case conversion](https://www.ruby-lang.org/en/news/2026/11/18/multiple-vulnerabilities-in-regexp-and-string/), Ruby core team, 2026

- [GHSA-34m4-m9fh-gqp5 security advisory](https://github.com/ruby/ruby/security/advisories/GHSA-34m4-m9fh-gqp5), ruby/ruby on GitHub, 2026

- [Ruby 4.0.10 Released](https://www.ruby-lang.org/en/news/2026/11/18/ruby-4-0-10-released/), Ruby core team, 2026

- [2026 news archive](https://www.ruby-lang.org/en/news/2026/), Ruby core team, 2026

- [Ruby (programming language)](https://en.wikipedia.org/wiki/Ruby_(programming_language)), Wikipedia, 2026

*Image: Rubén Rodríguez, CC BY 3.0 via Wikimedia Commons*

*This article was produced with AI assistance and reviewed by our Editorial Desk. [How we work](https://badiyaa.com/editorial-policy/).*
