Heap-use-after-free in mrb_bint_new_str in mruby
Summary
OSV-2022-550: Heap-use-after-free in mrb_bint_new_str. Affects mruby versions >= 872020bb3d85ba4066ec19cfcad375e51fdf024b, < a40842eb73164254f465ce5bac74045200e5acb0. Fixed in a40842eb73164254f465ce5bac74045200e5acb0. 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 runtime environment for executing Ruby code. This vulnerability affects the mrb_bint_new_str function in mruby, which is responsible for creating a new string object. The vulnerability allows an attacker to exploit a heap-use-after-free bug, potentially leading to arbitrary code execution or a denial of service.
Vulnerability Detail
The vulnerability arises from a heap-use-after-free bug in the mrb_bint_new_str function of mruby. This bug occurs when the function attempts to access memory that has already been freed, leading to undefined behavior. An attacker can potentially exploit this vulnerability by crafting a malicious input that triggers the bug, allowing them to execute arbitrary code or crash the application. The vulnerability was discovered through OSS-Fuzz, a continuous fuzzing service for open-source software.
How To Fix
Minimum fixed version
a40842eb73164254f465ce5bac74045200e5acb0
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 apply the fix mentioned in the 'how_to_fix' section as soon as possible.
Conclusion
In conclusion, the mrb_bint_new_str function in mruby is vulnerable to a heap-use-after-free bug. This vulnerability can be exploited by attackers to execute arbitrary code or crash the application. It is crucial to update to a version of mruby that includes the fix to mitigate the risk. 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 runtime environment for executing Ruby code.
A heap-use-after-free bug occurs when a program attempts to access memory that has already been freed. This can lead to undefined behavior and can be exploited by attackers to execute arbitrary code or crash the application.
This vulnerability was discovered through OSS-Fuzz, a continuous fuzzing service for open-source software. OSS-Fuzz helps identify bugs and vulnerabilities by generating and executing random inputs to find potential issues.
The potential consequences of this vulnerability include arbitrary code execution or denial of service. An attacker could exploit the heap-use-after-free bug to execute their own code within the context of the vulnerable application or cause the application to crash.
No, there is no known workaround for this vulnerability. It is recommended to apply the fix mentioned in the 'how_to_fix' section to resolve the issue.
References
Related vulnerabilities
Recent vulnerabilities recorded for mruby.