> ## Content Index
> Fetch the complete content index at: https://ettayeb.fr/llms.txt
> Use this file to discover other available public pages before exploring further.

# Ruby fixes seven memory-safety flaws in regex and strings, five with code-execution PoCs
- URL: https://ettayeb.fr/en/devops/ruby-regex-string-memory-flaws-november-2026-en/
- Published: 2026-11-19T00:00:00.000Z
- Updated: 2026-11-23T15:24:38.000Z
- Description: On November 18, 2026, the Ruby team released 4.0.10, 3.4.13, and 3.3.14 to fix seven memory-safety flaws in its regular-expression engine and string case-conversion code, five of them with proof-of-concept remote code execution.
- Author: Walid ETTAYEB
- Tags: DevOps, ruby, regex, memory-safety, rce, rails, #en, #Import 2026-11-23 14:52

**November 18, 2026.** The **Ruby** team releases **4.0.10**, **3.4.13**, and **3.3.14**, three versions that fix seven memory-safety flaws in the **regular-expression** engine and the string **case-conversion** code. **November 18, 2026.** The maintainers note that for **five** of these flaws, *proofs-of-concept* show that crafted input runs code on the machine. **November 18, 2026.** The advisories report **no attacks** in the wild so far. Why it matters: these flaws live in **Ruby itself**, so every application running an affected version carries them — including the whole **Rails** ecosystem. Updating a gem does not replace a vulnerable interpreter.

## Seven memory flaws: three critical, three high, one moderate

The batch spans **three critical**, **three high**, and **one moderate** flaw, each documented in a separate **GitHub** advisory. The three critical ones are a **one-byte heap overflow** in case conversion for certain single-byte encodings such as **ISO-8859-1** or **Windows-1252** (**GHSA-34m4-m9fh-gqp5**), a **double free** when compiling a regex that uses a character-class intersection (`&&`) (**GHSA-7x2q-68qv-6p8x**), and a **heap overflow** when a compiled regex’s size overflows during compilation (**GHSA-3p8q-wmhx-vm2w**). All three carry a code-execution proof-of-concept.

The three high-severity flaws follow the same pattern. **GHSA-87fm-7w84-j2px** is a heap overflow when a case change produces a result larger than **4 GiB** — exploitable in theory, but the size needed puts it out of reach of most requests. **GHSA-7whj-cfh7-xgm4** is an overflow when **Ruby** turns a compiled regex back into text via `Regexp#to_s`. **GHSA-wpqw-5qxg-m68r** is an out-of-bounds read during case-insensitive matching, whose *PoC* shows attacker-controlled memory corruption. The moderate one, **GHSA-pvgc-g7gj-pv6h**, reads out of bounds during a case-insensitive backreference and may "disclose memory contents or crash the process."

## What is actually exposed: attacker input must reach the regex

The detail that decides real-world exposure is **reachability**. The regex flaws need an application that **builds a regular expression from attacker-controlled input**, then compiles or runs it. Matching untrusted text against a pattern developers wrote themselves does not carry the same risk — with one exception: the moderate flaw fires when the application matches a **crafted subject string** against a fixed pattern that uses a case-insensitive backreference.

The two case-conversion flaws do not involve regexes at all: they fire when the application changes the case of a **crafted string**. Concretely, any code that runs `upcase`, `downcase`, or another case conversion over imported text — usernames, headers, CSV files, form fields — deserves a look. The practical verdict: exposure depends less on "do I use Ruby" than on "does my application let external input reach these primitives."

Two nuances complete the exposure picture. **GHSA-87fm-7w84-j2px**, which needs a case change producing more than **4 GiB**, is technically exploitable but out of reach of most requests: treat it as latent risk, not an immediate vector. The moderate **GHSA-pvgc-g7gj-pv6h** is different: it can leak memory contents during a simple case-insensitive match against a crafted string — an **information-disclosure** risk that does not need code execution to cause harm, and that even hits applications whose patterns are hard-coded.

## Fix the interpreter, not just the gems

The fix lives in **the interpreter**, not in application code. Updating **gems** or the *framework* does not replace a vulnerable **Ruby**: the version that matters is the one running on **application servers**, background **workers**, and inside **container images**. Every executable must be updated, then restarted.

The affected ranges are clean. **Ruby 4.0.0 through 4.0.9** is fixed in **4.0.10**; **3.4.0 through 3.4.12** in **3.4.13**; **3.3.13 and earlier** in **3.3.14**. **Ruby 3.2 and earlier** is **end-of-life** and will get **no fix** — the project recommends moving to a supported line. Note that branch **3.3** moves from "security maintenance" to "legacy maintenance" with **3.3.14**, and its support ends in **late March 2027**. If you are on **3.3**, this fix is the right moment to plan the migration to **3.4** or **4.0** rather than defer it.

On provenance, four of the seven flaws were reported by **Stephan Lipp** of **Ada Logics**, in connection with **Anthropic**; the other three by **baba\_\_yaga**, **aphantom**, **Hiroya Fujinami**, and **Hiroshi SHIBATA**. The detail matters: **memory safety** in language runtimes is becoming a systematic audit target, and the concentration of *use-after-free* and *overflow* bugs in a mature regex engine like **Ruby**’s shows that this code, written decades ago, has not finished giving up its bugs.

In practice, start by listing the runtimes in service: `ruby -v` on every host, the version pinned in `Dockerfile`s and base images, the one running in background **Sidekiq** or **Resque** workers, and the one in **CI** environments. The classic trap is the app server updated while the build image or a *worker* container stays on an older release. For **Rails** teams, deployment usually means a version bump in the base image followed by a full process restart — not a plain `reload`, which would leave the old binaries in memory.

The most common use case that exposes these flaws is the dynamically built pattern: a search where the user supplies part of the expression, a filter translated into a regex, a validator compiling `Regexp.new(input)` over an untrusted string. That kind of code, common in **Rails** applications that accept filters or advanced searches, turns a runtime flaw into code execution. The audit should therefore target `Regexp.new`, `Regexp.compile`, and case conversions over imported text — not just "do I use Ruby," but "where does external input reach these primitives."

## The verdict

**If you run Ruby in production, update the interpreter to 4.0.10, 3.4.13, or 3.3.14, then restart the workers.** The risk concentrates on applications that let external input build a regex or reach a case conversion — but five code-execution *PoCs* already exist, and the absence of observed exploitation is only a snapshot. The fix costs a runtime upgrade; the compromise costs the server running it.

**If you are still on Ruby 3.2, do not look for a workaround: there will not be one.** The branch is end-of-life and these flaws will never be fixed there. Isolate what cannot migrate immediately, and budget the move to a supported line before **3.3** support ends in **March 2027**. This batch is a dated, sourced reminder that a scripting language has a native core — and that core gets updated like any other binary.

## References

- [The Hacker News — Ruby Releases Fixes for 7 Regex and String Flaws, Warns 5 Have Proof-of-Concept RCE (November 19, 2026)](https://thehackernews.com/2026/11/ruby-releases-fixes-for-7-regex-and.html?ref=ettayeb.fr)
- [Ruby — Security announcements (4.0.10, 3.4.13, 3.3.14, November 18, 2026)](https://www.ruby-lang.org/en/news/?ref=ettayeb.fr)
- [GitHub Advisory Database — GHSA-34m4-m9fh-gqp5, GHSA-7x2q-68qv-6p8x, GHSA-3p8q-wmhx-vm2w](https://github.com/advisories?ref=ettayeb.fr)