Skip to content
feed: live
0dayNews
threat intel

Ruby 4.0.10, 3.4.13, 3.3.14 fix 7 memory-safety flaws

Ruby patched seven regex and string case-conversion memory flaws. Maintainers say five have RCE proofs of concept. No attacks reported yet. Here is who should patch first.

Ruby 4.0.10, 3.4.13, 3.3.14 fix 7 memory-safety flaws
Image: AI-generated — conceptual illustration, not incident evidence / 0dayNews AI Cover · Generated on-site infrastructure — no external license
fuseMarisol "Fuse" Delgado·Published ·2 min read

Ruby shipped fixed releases on November 18 for seven memory-safety flaws in its regular expression engine and string case-conversion code. The maintainers say proof-of-concept exploits exist showing that five of them can lead to remote code execution. The advisories report no attacks so far, according to The Hacker News.

What to do

Upgrade to Ruby 4.0.10, 3.4.13 or 3.3.14. The affected ranges:

  • Ruby 4.0.0 through 4.0.9: fixed in 4.0.10.
  • Ruby 3.4.0 through 3.4.12: fixed in 3.4.13.
  • Ruby 3.3.13 and earlier: fixed in 3.3.14.
  • Ruby 3.2 and earlier is end of life, per the report, so the answer there is to move to a supported branch.

The flaws sit in Ruby’s own code, so every application on an affected version carries them. Whether anyone can reach them depends on what your application feeds into that code.

Patch this first

Prioritize anything that builds a regular expression from input an outsider controls and then compiles or runs it. That is the exposure for most of the regex flaws. Matching untrusted text against a pattern your developers wrote is a much lower risk, with one exception covered below.

Second, look at code that changes the case of imported or outside text. Two of the flaws trigger on case conversion alone, with no regex involved.

The exception is the moderate-rated out-of-bounds read. It fires when an application matches a crafted subject string against a fixed pattern that uses a case-insensitive backreference. The advisory says it may disclose memory contents or crash the process.

The seven flaws

Maintainers rated three critical, three high and one moderate:

  • Critical: a one-byte heap overflow during case changes in certain single-byte encodings such as ISO-8859-1 or Windows-1252. RCE proof of concept exists.
  • Critical: a double free when compiling a crafted regex that uses a character-class intersection. RCE proof of concept exists.
  • Critical: a heap overflow when the size of a compiled regex overflows during compilation. RCE proof of concept exists.
  • High: a heap overflow when a case change produces a result larger than 4 GiB. RCE proof of concept exists, but the size needed puts it out of reach for most requests.
  • High: a heap overflow when a crafted compiled regex is turned back into text with Regexp#to_s. RCE proof of concept exists.
  • High: an out-of-bounds read during case-insensitive matching. The proof of concept shows attacker-controlled memory corruption. Maintainers say RCE is possible but not shown.
  • Moderate: the backreference read described above.

The advisories are tracked under GitHub advisory IDs, and the report does not list CVE numbers for them. The project credits Stephan Lipp of Ada Logics and Anthropic with four of the findings, and baba__yaga, aphantom, Hiroya Fujinami and Hiroshi SHIBATA with the other three. The announcement and advisories do not include the proof-of-concept code.

Honest timeline

Nobody has reported exploitation yet, but proof-of-concept code existing for five of these means the gap between patch and attack could be short. Patch exposed services that take user-supplied patterns first. Everything else can follow in your normal window, but do not let it sit.

Found this useful? Share it.