Use-after-poison vulnerability in rb_gc_writebarrier in Ruby
Summary
OSV-2023-292: Use-after-poison in rb_gc_writebarrier. Affected versions are not published. No fix is published. 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, object-oriented programming language known for its simplicity and productivity. It is widely used for web development, scripting, and system administration tasks. The rb_gc_writebarrier function in Ruby is responsible for garbage collection and memory management. However, a use-after-poison vulnerability has been discovered in this function, which can lead to a crash or potential code execution.
Vulnerability Detail
The use-after-poison vulnerability in rb_gc_writebarrier allows an attacker to read uninitialized or freed memory, potentially leading to information disclosure or arbitrary code execution. This vulnerability can be triggered by calling certain functions, such as rb_set_class_path_string and rb_define_class_id_under, which interact with the rb_gc_writebarrier function. Exploiting this vulnerability can result in a denial of service or the execution of malicious code.
How To Fix
No fixed version is published for this vulnerability.
Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →
Workaround
As a temporary workaround, users can avoid calling the vulnerable functions rb_set_class_path_string and rb_define_class_id_under until the Ruby package is updated. By avoiding these functions, the use-after-poison vulnerability can be mitigated.
Conclusion
The use-after-poison vulnerability in rb_gc_writebarrier in Ruby can have serious consequences, including crashes and potential code execution. It is crucial to update your Ruby installation to the latest patched version to mitigate the risk. If you have any further questions or need assistance with vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for ruby →
FAQ
This vulnerability can potentially lead to a crash or code execution, allowing an attacker to compromise the affected system.
You can use the Vulert Playground at Vulert Scanner to check if your Ruby application is affected by this vulnerability. Simply upload your package-lock.json file to the playground and it will provide real-time alerts for open-source vulnerabilities.
Yes, the Ruby development team has released a fix for this vulnerability in the latest versions. It is recommended to update your Ruby installation to the latest patched version.
Yes, as a temporary workaround, you can avoid calling the vulnerable functions rb_set_class_path_string and rb_define_class_id_under until the Ruby package is updated.
You can find more information about this vulnerability in the OSS-Fuzz report at https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=57782
References
Related vulnerabilities
Recent vulnerabilities recorded for ruby.