Ruby patches seven flaws, some of which allow remote code execution

Multiple vulnerabilities in Regexp and String case conversion

Ruby's regex engine and string case conversion contain seven vulnerabilities, including heap overflows, a double free, and out-of-bounds reads. Proofs of concept show several can trigger remote code execution. Ruby 4.0.10, 3.4.13, and 3.3.14 fix them. Ruby 3.2 and earlier are end-of-life and get no patches. CVE IDs are still pending, so the advisory uses GHSA identifiers.

We are aware of PoCs that prove some of them can be used to trigger remote code execution.
  1. tptacek

    There's what I think is probably an awesome bug here.

    Windows-1252 encoding has a representation for lowercase German sharp 's' (ß), but not one for the uppercase. If you upcase a string containing a sharp 's', it gets normalized to "SS", which increases the length of the string by one character. The 1252 case conversion code doesn't handle this; it looks like it checks for headroom in the buffer one character at a time. So if the last character of a string you upcase is ß, it looks like you get a one-byte overflow (of 'S').

    If that's really the bug (there's a claimed RCE POC), the heap grooming for it must be really fussy! I couldn't find any other character pairs that expand like this.

    You can feed strings in 1252 to a Rails program through multipart POSTs, which get to pick their encodings.

    The great thing about this bug, apart from how it illustrates how doomed we all are (if I'm right), is that it should by rights have the best vulnerability name of the year, because you get to work 'ß' into it.

  2. pentestercrab

    str = ("\x82\xA0" + ("A" * (2**32 + 4))).force_encoding(Encoding::Shift_JIS)

    puts "str.bytesize: #{str.bytesize}"

    puts "str.encoding: #{str.encoding}"

    puts "str.valid_encoding?: #{str.valid_encoding?}"

    new_str = str.downcase

    puts "new_str.bytesize: #{new_str.bytesize}"

    puts "new_str.bytes: #{new_str.bytes}"

    puts "new_str.encoding: #{new_str.encoding}"

    outputs on an unfixed version:

    str.bytesize: 4294967302

    str.encoding: Shift_JIS

    str.valid_encoding?: true

    new_str.bytesize: 6

    new_str.bytes: [130, 160, 97, 97, 97, 97]

    new_str.encoding: Shift_JIS

    also I'd suggest you check out CVE-2026-128084 (GHSA-4fqr-96q8-xrfx) if you are interested in C bugs impacting Ruby on Rails

  3. lousken

    I need a vacation

  4. nickcw

    > CVE identifiers have been requested for these vulnerabilities but have not been assigned yet, so this advisory refers to them by their GitHub Security Advisory (GHSA) identifiers.

    It sounds like they are using GitHub to assign CVEs. We do the same at the rclone project. GitHub are running at a 4 week delay assigning CVEs! They used to do it in 2-3 days.

  5. rvz

    These are all C-based memory corruption vulnerabilities.

    The reality of these type of bugs being found by autonomous AI models on established software should tell you by now that memory-unsafe languages are completely exposed.

    This is who maintainers you are up against:

    "Thanks to Stephan Lipp (Ada Logics) and Anthropic for reporting this issue."

    Imagine attackers using abliterated models at scale who don't disclose these issues.

    [0] https://github.com/ruby/ruby/security/advisories/GHSA-34m4-m...

  6. vintermann

    Fun fact, I ordered something online to an address in Ålesund once, it took a long time to arrive, package tracking showed the idiots (Deutsche Post as I recall) had shipped it to a place called Lesund instead. Ignoring the post code.

    Just some days ago I ordered some sheet music, and guess what, it was shipped to an address where ÆØÅ were replaced with ? too. Hopefully it will arrive.

    The amount of code out there that still simply breaks on non-ASCII characters (even Latin-1 characters!) is unbelievable. No wonder the AI vulnerability scanners are having a field day.

  7. mpetrovich

    You have a problem.

    “I know, I’ll use regular expressions to solve it,” you think.

    Now you have two problems.

  8. slopinthebag

    oh boy. if only we had a language that could prevent this from happening. oh well, i guess there is nothing we can do but patch these things once they're discovered.

More from this day

2026-11-19