Ruby has recently issued updates to address seven significant vulnerabilities related to memory safety within its regular expression engine and string case-conversion functionality. Notably, five of these vulnerabilities come with proof-of-concept (PoC) exploits that could potentially be used for remote code execution, according to the Ruby maintainers.
The development team has released patched versions, namely Ruby 4.0.10, 3.4.13, and 3.3.14, to mitigate these security risks. The impact on applications varies depending on whether an attacker can inject specially crafted patterns or strings into the affected components. As of now, there have been no reports of these vulnerabilities being actively exploited.
Details of the Identified Vulnerabilities
Among the identified vulnerabilities, three are classified as critical. They include:
- A one-byte heap overflow in string case conversions for certain encodings (GHSA-34m4-m9fh-gqp5).
- A double free when compiling specific crafted regular expressions (GHSA-7x2q-68qv-6p8x).
- A heap overflow during the compilation of oversized regular expressions (GHSA-3p8q-wmhx-vm2w).
These issues have been demonstrated to enable remote code execution. Additionally, three vulnerabilities are rated as high severity, and one is considered moderate, primarily affecting memory reads and potential process crashes.
Implications for Applications and Developers
The vulnerabilities are embedded within Ruby’s core codebase, affecting all applications that run on the impacted versions. An attack’s feasibility depends largely on how an application processes external inputs, particularly those involving regular expressions.
Applications that construct regular expressions from user input are at higher risk, while those using predefined patterns face less danger. The string case-conversion vulnerabilities are triggered when applications modify the case of input strings, necessitating thorough code reviews of such functionalities.
Recommendations and Future Actions
The Ruby project strongly advises updating to the latest patched versions: Ruby 4.0.10, 3.4.13, and 3.3.14. Versions earlier than Ruby 3.2 are no longer supported, and users are encouraged to migrate to a maintained version. The updates are critical as they directly affect the Ruby interpreter, not just external libraries or frameworks.
As of now, CVE identifiers for these vulnerabilities are pending. Until they are assigned, the GitHub advisory IDs remain the primary reference for tracking these issues. This release follows a similar patch in October, which addressed other vulnerabilities discovered by GitLab. These recent actions underscore the importance of maintaining robust security practices within software development.
