Heap-use-after-free vulnerability in mruby
Summary
OSV-2023-366: Heap-use-after-free in gc_mark_children. Affects mruby versions >= 672495555bb741aefbde2f31a523f7ed8666d2c6, < b47c8b738ae3e400ec02269fae9857222218e9d5. Fixed in b47c8b738ae3e400ec02269fae9857222218e9d5. 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 open-source lightweight implementation of the Ruby programming language. It is designed to be embedded in other applications and provides a minimalistic and efficient interpreter. The vulnerability in question is a heap-use-after-free issue that has been identified in the gc_mark_children function of mruby. This function is responsible for marking objects during garbage collection. The vulnerability can potentially lead to a crash due to a read of 4 bytes from a freed heap memory region.
Vulnerability Detail
The heap-use-after-free vulnerability in gc_mark_children can be triggered during incremental garbage collection or a full garbage collection process. An attacker could potentially exploit this vulnerability to execute arbitrary code or cause a denial-of-service condition. The vulnerability was reported through the OSS-Fuzz project, and the affected versions of mruby can be found in the provided OSS-Fuzz report link.
How To Fix
Minimum fixed version
b47c8b738ae3e400ec02269fae9857222218e9d5
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 specific workaround available for this vulnerability. It is recommended to follow the steps mentioned in the 'how_to_fix' section to update the mruby package to a fixed version.
Conclusion
The heap-use-after-free vulnerability in mruby's gc_mark_children function can have serious security implications. It is crucial to update the mruby package to a version that includes the fix or apply the necessary patches to mitigate the risk. For further support and assistance in vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for mruby →
FAQ
mruby is a lightweight implementation of the Ruby programming language designed for embedding in other applications.
A heap-use-after-free vulnerability occurs when a program attempts to access memory that has already been freed. This can lead to crashes or potentially allow an attacker to execute arbitrary code.
An attacker could exploit this vulnerability by crafting a malicious input that triggers the heap-use-after-free condition, potentially leading to arbitrary code execution or denial-of-service.
Yes, a fix for this vulnerability is available in commit b47c8b738ae3e400ec02269fae9857222218e9d5 or later. Users should update their mruby installation to a version that includes this fix.
More information about this vulnerability can be found in the provided OSS-Fuzz report: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=58577
References
Related vulnerabilities
Recent vulnerabilities recorded for mruby.