Ruby 4.0.10 security fix: 7 Regexp and String bugs
Released 2026-11-18. The fixes come in v4.0.10, v3_4_13 and v3_3_14. CVE numbers are not assigned yet, so each fix is listed by its GHSA id. Details per bug: ruby-lang.org’s security advisory.
The seven bugs
| Advisory | Bug | Trigger | Impact (advisory) | Fix |
|---|---|---|---|---|
| GHSA-34m4 | 1-byte heap overflow | case conversion of a crafted string | RCE (PoC) | #20005 |
| GHSA-87fm | integer overflow → heap overflow | case conversion of a crafted string | RCE (PoC) | #20006 |
| GHSA-7x2q | double free | compiling a crafted pattern | RCE (PoC) | #20001 |
| GHSA-3p8q | integer overflow → heap overflow | compiling a crafted pattern | RCE (PoC) | #20000 |
| GHSA-7whj | heap overflow | Regexp#to_s on a crafted pattern | RCE (PoC) | #20004 |
| GHSA-wpqw | out-of-bounds read | case-insensitive match, crafted pattern | may allow RCE; PoC corrupts memory | #20002 |
| GHSA-pvgc | out-of-bounds read | case-insensitive backreference, crafted string | leak / crash | #20003 |
Who is affected
| Branch | Affected | Fixed in |
|---|---|---|
| 4.0 | 4.0.0 – 4.0.9 | 4.0.10 |
| 3.4 | 3.4.0 – 3.4.12 | 3.4.13 |
| 3.3 (security maintenance) | ≤ 3.3.13 | 3.3.14 |
| 3.2 and older | all | no fix (end of life) |
How the bugs work
- The two case-conversion bugs need no attacker-supplied pattern: calling
upcaseordowncaseon input a user sent you is enough. For GHSA-pvgc (case-insensitive backreference matching), the advisory names only a crafted string as the trigger. - The four pattern bugs need an attacker-controlled regex. That covers
Regexp.new(params[...])and search or filter features that let users write patterns. - Four of the seven were reported by Stephan Lipp (Ada Logics) together with Anthropic.
- 4.0.10 also contains 35 more String/encoding fixes, mostly use-after-free, out-of-bounds and overflow bugs, many hit when a string changes during a method call. 14 of them are peterzhu2118’s. The release also has fixes in Regexp, core classes, IO, the VM/GC, the parser, YJIT/ZJIT and default gems. The full list is in the v4.0.10 release notes.
What to do
- Upgrade to 4.0.10, 3.4.13 or 3.3.14. On 3.2 or older there is no patched release: move to 3.3.14 or newer.
- Docker:
ruby:4.0.10,-slimand-alpineare already published. Bump.ruby-versionand theFROMline, rebuild, and deploy.