Segv on unknown address in mrb_bint_to_s in mruby
Summary
OSV-2022-600: Segv on unknown address in mrb_bint_to_s. Affects mruby versions >= 714e8a57af690805b3edcffdffc42729833bc50a, < cfea0c28a045790388aedf53f1c9a5c43a683dd2. Fixed in cfea0c28a045790388aedf53f1c9a5c43a683dd2. 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 arises in the mrb_bint_to_s function, which is responsible for converting a binary integer to a string representation. This vulnerability can lead to a segmentation fault (segv) when an unknown address is encountered during the conversion process.
Vulnerability Detail
The vulnerability occurs in the mrb_bint_to_s function of mruby. When converting a binary integer to a string, the function encounters an unknown address, resulting in a segmentation fault. This can potentially lead to a crash or denial of service if exploited. The issue was reported through OSS-Fuzz, and the crash state indicates that the crash occurs in mrb_integer_to_str and int_to_s functions.
How To Fix
Minimum fixed version
cfea0c28a045790388aedf53f1c9a5c43a683dd2
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
As a workaround, developers can avoid using the mrb_bint_to_s function or any code that relies on it until the package is updated with the fix. This can help mitigate the risk of encountering the segmentation fault. Here is an example of how to avoid using mrb_bint_to_s:
# Instead of using mrb_bint_to_s
# Use a custom implementation to convert binary integers to strings
def custom_bint_to_s(value)
# Custom implementation logic here
end
Conclusion
In conclusion, the vulnerability in mruby's mrb_bint_to_s function can lead to a segmentation fault when encountering an unknown address during the conversion of a binary integer to a string. It is recommended to update the mruby package to a version that includes the fix or use the provided workaround until the fix is applied. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for mruby →
FAQ
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 mruby is related to the mrb_bint_to_s function, which can lead to a segmentation fault when encountering an unknown address during the conversion of a binary integer to a string.
The potential consequences of this vulnerability include crashes or denial of service if the issue is exploited. It can impact applications that rely on mruby and use the mrb_bint_to_s function.
To fix this vulnerability, it is recommended to update the mruby package to a version that includes the fix. The fix can be found in commit cfea0c28a045790388aedf53f1c9a5c43a683dd2 on the official mruby GitHub repository.
Yes, developers can avoid using the mrb_bint_to_s function or any code that relies on it until the package is updated with the fix. This can help mitigate the risk of encountering the segmentation fault.
References
Related vulnerabilities
Recent vulnerabilities recorded for mruby.