Buffer Over-read Vulnerability in Ruby Package: CVE-2022-28739
Summary
ALPINE-CVE-2022-28739: There is a buffer over-read in Ruby before 2.6.10, 2.7.x before 2.7.6, 3.x before 3.0.4, and 3.1.x before 3.1.2. Affects ruby versions < 2.7.6-r0. Fixed in 2.7.6-r0. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
Ruby is a dynamic, open-source programming language with a focus on simplicity and productivity. It is widely used for web development, particularly in conjunction with the Ruby on Rails framework. The language supports multiple programming paradigms, including functional and object-oriented programming. However, certain versions of Ruby are vulnerable to a buffer over-read issue that can lead to unintended behavior during string-to-float conversions.
Vulnerability Detail
The vulnerability, identified as CVE-2022-28739, is a buffer over-read that affects Ruby versions prior to 2.6.10, 2.7.x before 2.7.6, 3.x before 3.0.4, and 3.1.x before 3.1.2. This issue arises during the conversion of strings to floating-point numbers, specifically in the methods Kernel#Float and String#to_f. If exploited, this vulnerability could allow an attacker to read sensitive data from memory, potentially leading to information disclosure.
How To Fix
Minimum fixed version
2.7.6-r0
This is the first release that contains the fix.
sudo apk add --upgrade ruby
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
As a temporary workaround, avoid using the affected methods (Kernel#Float and String#to_f) with untrusted input until the package is updated. Validate and sanitize all input data before processing.
Conclusion
The buffer over-read vulnerability in Ruby, identified as CVE-2022-28739, poses a significant risk to applications using affected versions of the language. Immediate action is required to update to the patched versions to mitigate potential security threats. Utilizing tools like Vulert can help monitor and alert for such vulnerabilities in real-time.
See every vulnerability recorded for ruby →
FAQ
CVE-2022-28739 is a buffer over-read vulnerability in Ruby that affects multiple versions, allowing potential information disclosure.
You can use the Vulert playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.
Exploitation of this vulnerability could lead to sensitive data being read from memory, posing a risk to application security.
Affected versions include Ruby before 2.6.10, 2.7.x before 2.7.6, 3.x before 3.0.4, and 3.1.x before 3.1.2.
Use the command apk add ruby=2.7.6-r0 for Alpine v3.12, v3.13, and v3.14, or apk add ruby=3.1.2-r0 for Alpine v3.15 and later.
References
Related vulnerabilities
Recent vulnerabilities recorded for ruby.