Ruby has released security updates for seven vulnerabilities in its string case-conversion and regular-expression code. One of the flaws, known as Ruby2Shell (CVE-2026-132825), can cause a heap buffer overflow when Ruby changes the case of a crafted string. The other vulnerabilities affect regular-expression compilation, matching, and conversion.
Ruby’s security team says proof-of-concept exploits show that some of these issues can lead to remote code execution in certain scenarios. However, the risk depends on how an application uses Ruby, for example, whether it processes attacker-controlled strings or regular-expression patterns.
Ruby is a programming language used to build web applications, automation tools, and other software. It powers popular frameworks such as Ruby on Rails and is also included in self-hosted platforms and developer tools, so a vulnerability in Ruby itself can affect many kinds of applications.
Ruby 3.3.13 and earlier, 3.4.0-3.4.12, and 4.0.0-4.0.9 are all impacted by these vulnerabilities. The exact risk depends on how the application processes that input, but Ruby warns that some of the flaws can enable remote code execution in certain scenarios. The table below summarizes the advisories and potential impact.
|
Vulnerability |
Overview |
|
CVE-2026-132825 (Ruby2Shell) |
Changing the case of a crafted string can cause a one-byte heap buffer overflow, potentially leading to remote code execution in some scenarios. |
|
Sonatype-2026-012807 |
Compiling a crafted regular-expression pattern can trigger a double free, potentially leading to remote code execution when an application compiles attacker-controlled patterns. |
|
Sonatype-2026-012808 |
Case conversion can trigger an integer overflow and heap buffer overflow. Changing the case of a crafted string may lead to remote code execution. |
|
Sonatype-2026-012809 |
Matching against a crafted regular-expression pattern can cause an out-of-bounds read. Ruby reports that this flaw may lead to attacker-controlled memory corruption in some scenarios. |
|
Sonatype-2026-012810 |
Compiling a crafted regular-expression pattern can trigger an integer overflow and heap buffer overflow, potentially leading to remote code execution in applications that compile attacker-controlled patterns. |
|
Sonatype-2026-012811 |
Converting a crafted regular expression with Regexp#to_s can cause a heap buffer overflow, potentially exposing information or enabling remote code execution in some scenarios. |
|
Sonatype-2026-012812 |
Matching a crafted string with a case-insensitive backreference can cause an out-of-bounds read, potentially disclosing memory contents or crashing the process. |
Treat these Ruby vulnerabilities as an urgent patching issue, and organizations should upgrade to a fixed version as soon as possible. Sonatype’s Security Event on these vulnerabilities tracks current guidance and response recommendations.
Ruby2Shell highlights a familiar challenge in vulnerability response: knowing a fix is available doesn’t mean the risk is resolved. Organizations need to find every affected Ruby runtime, identify who owns the update, and make sure the patched release reaches production, including Ruby bundled in products and services.
Organizations should:
For ongoing details and links to current advisories, see the official Ruby security advisory.