Negative-size-param in mrb_str_format in mruby
Summary
OSV-2022-1163: Negative-size-param in mrb_str_format. Affects mruby versions >= 4e9773ae3db701ff284171f916d3cd144d6fcae4, < 6bcbfed8bb955a4412e0ca79da0244f97076ba18. Fixed in 6bcbfed8bb955a4412e0ca79da0244f97076ba18. 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
mruby is an embeddable lightweight Ruby implementation written in C. It is designed to be easily integrated into other software projects and provides a minimalistic and efficient Ruby runtime environment. The mrb_str_format function in mruby is responsible for formatting strings. However, a vulnerability has been discovered in this function that allows an attacker to trigger a negative-size-param crash, leading to a denial-of-service condition or potential remote code execution.
Vulnerability Detail
The vulnerability in mrb_str_format arises from a negative-size-param crash. This crash occurs when the function is called with a negative size parameter, which can result in memory corruption or other undefined behavior. An attacker can exploit this vulnerability by crafting a malicious input that triggers the negative-size-param crash, potentially leading to a denial-of-service attack or remote code execution. The vulnerability was reported through the OSS-Fuzz project and has been assigned the identifier OSV-2022-1163.
How To Fix
Minimum fixed version
6bcbfed8bb955a4412e0ca79da0244f97076ba18
This is the first release that contains the fix.
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
There is no known workaround for this vulnerability. It is recommended to update the mruby package to a fixed version as soon as possible.
Conclusion
The vulnerability in mrb_str_format in mruby can be exploited to trigger a negative-size-param crash, potentially leading to a denial-of-service attack or remote code execution. It is crucial to update the mruby package to a fixed version as soon as possible to mitigate this vulnerability. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for mruby →
FAQ
mruby is an embeddable lightweight Ruby implementation written in C. It provides a minimalistic and efficient Ruby runtime environment that can be easily integrated into other software projects.
The mrb_str_format function in mruby is responsible for formatting strings. It takes a format string and a variable number of arguments and returns a formatted string.
A negative-size-param crash occurs when a function is called with a negative size parameter. This can lead to memory corruption or other undefined behavior.
This vulnerability can be exploited by an attacker to trigger a denial-of-service condition or potentially execute arbitrary code.
To fix this vulnerability, update the mruby package to a version that includes the fix. The fix was implemented in commit 6bcbfed8bb955a4412e0ca79da0244f97076ba18 in the mruby GitHub repository.
References
Related vulnerabilities
Recent vulnerabilities recorded for mruby.