CVE-2026-97229
Description
A flaw was found in Ruby. When compiling a specially crafted regular expression with the methods Regexp.new, Regexp.union, Regexp.compile, or via a string interpolation such as /#{input}/, an integer overflow in the size of the compiled pattern can occur. This integer overflow causes memory corruption, potentially resulting in arbitrary code execution.
Statement
Red Hat has rated the impact of these flaws as Moderate for the Ruby packages shipped in Red Hat Enterprise Linux. The Ruby packages provide a language interpreter and standard library and do not accept external input on their own; these flaws are reachable only when an application compiles a regular expression constructed from attacker-controlled input.
Upstream Ruby has published a security advisory for these issues and scopes the flaws narrowly, stating that they "are reached only when an application compiles a regular expression from a string that an attacker controls, for example by passing it to Regexp.new, Regexp.union or Regexp.compile", and that "applications that only use regular expressions written by their own developers are not affected". Upstream further notes that Ruby "has generally considered it unsafe to compile and use a regular expression created from untrusted input".
The CVE identifiers for these flaws were assigned by GitLab, where the issues were originally reported and where remote code execution was demonstrated against GitLab's own application. Ruby did not request separate identifiers and has asked downstream distributors to track these issues under GitLab's CVE IDs.
Mitigation
To mitigate this vulnerability, do not compile regular expressions from untrusted sources. Standard safeguards such as Regexp.timeout or limiting the length of the input pattern do not protect against this issue.
Common Vulnerability Scoring System (CVSS) Score Details
Info alert:Important note
CVSS scores for open source components depend on vendor-specific factors (e.g. version or build chain). Therefore, Red Hat's score and impact rating can be different from NVD and other vendors. Red Hat remains the authoritative CVE Naming Authority (CNA) source for its products and services (see Red Hat classifications).
CVSS v3 Score Breakdown
| Red Hat | NVD | cve.org | |
|---|---|---|---|
| Base Score | 9.8 | N/A | 10 |
| Attack Vector | Network | N/A | Network |
| Attack Complexity | Low | N/A | Low |
| Privileges Required | None | N/A | None |
| User Interaction | None | N/A | None |
| Scope | Unchanged | N/A | Changed |
| Confidentiality | High | N/A | High |
| Integrity Impact | High | N/A | High |
| Availability Impact | High | N/A | High |
Vector
Red Hat: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
cve.org: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
Frequently Asked Questions
Not sure what something means? Check out our Security Glossary.
Want to get errata notifications? Sign up here.