Ruby 4.0.10 security fix: 7 Regexp and String bugs

SecurityRuby/Rails

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

AdvisoryBugTriggerImpact (advisory)Fix
GHSA-34m41-byte heap overflowcase conversion of a crafted stringRCE (PoC)#20005
GHSA-87fminteger overflow → heap overflowcase conversion of a crafted stringRCE (PoC)#20006
GHSA-7x2qdouble freecompiling a crafted patternRCE (PoC)#20001
GHSA-3p8qinteger overflow → heap overflowcompiling a crafted patternRCE (PoC)#20000
GHSA-7whjheap overflowRegexp#to_s on a crafted patternRCE (PoC)#20004
GHSA-wpqwout-of-bounds readcase-insensitive match, crafted patternmay allow RCE; PoC corrupts memory#20002
GHSA-pvgcout-of-bounds readcase-insensitive backreference, crafted stringleak / crash#20003

Who is affected

BranchAffectedFixed in
4.04.0.0 – 4.0.94.0.10
3.43.4.0 – 3.4.123.4.13
3.3 (security maintenance)≤ 3.3.133.3.14
3.2 and olderallno fix (end of life)

How the bugs work

Two entry points: an untrusted string through upcase or downcase, or an untrusted pattern through the Onigmo compiler or Regexp#to_s. Four bugs overflow a heap buffer and one is a double free; both corrupt the heap, and the advisory reports RCE proofs of concept for five. Two bugs read out of bounds. Fixed in 4.0.10, 3.4.13, 3.3.14.two ways in · GHSA ids · inputs and buffer are illustrationsUntrusted stringparams · JSON · headersUntrusted patternRegexp.new(params[:q])str.upcase / downcasecase conversionOnigmo compiles itor Regexp#to_s prints itHeap buffer overflow34m4: one byte past the end87fm: integer overflow firstno pattern neededHeap buffer overflow3p8q: integer overflow first7whj: Regexp#to_s overflowattacker pattern neededboth write past the end of the buffer (example: 8 bytes reserved)reserved buffer9thnext heap objectheader · pointersHeap corruption → code executionalso 7x2q: a double free while compilingPoCs reach RCE for 5 of 7 (advisory)Out-of-bounds readswpqw: may allow RCEpvgc: leak or crashFixed in4.0.10 · 3.4.13 · 3.3.143.2 and older: no fix
How the seven bugs group: four heap overflows write past a buffer into the next heap object, 7x2q frees memory twice, and two read out of bounds. Labels are GHSA ids; wording follows the ruby-lang.org advisory; the inputs and the 8-byte buffer are illustrations.
Two entry points: an untrusted string through upcase or downcase, or an untrusted pattern through the Onigmo compiler or Regexp#to_s. Four bugs overflow a heap buffer and one is a double free; both corrupt the heap, and the advisory reports RCE proofs of concept for five. Two bugs read out of bounds. Fixed in 4.0.10, 3.4.13, 3.3.14.two ways in · inputs are illustrationsUntrusted stringparams · JSON · headersUntrusted patternRegexp.new(params[:q])str.upcase / downcasecase conversionOnigmo compiles itor Regexp#to_s prints itHeap buffer overflow34m4: one byte past the end87fm: integer overflow firstno pattern neededHeap buffer overflow3p8q: integer overflow first7whj: Regexp#to_s overflowattacker pattern neededboth write past the buffer endreserved buffer9thnext heap objectheader · pointersHeap corruption → code executionalso 7x2q: a double free while compilingPoCs reach RCE for 5 of 7 (advisory)Out-of-bounds readswpqw: may allow RCEpvgc: leak or crashFixed in4.0.10 · 3.4.13 · 3.3.143.2 and older: no fix
How the seven bugs group: four heap overflows write past a buffer into the next heap object, 7x2q frees memory twice, and two read out of bounds. Labels are GHSA ids; wording follows the ruby-lang.org advisory; the inputs and the 8-byte buffer are illustrations.

What to do

Questions? Let's Chat :)

open source