Segv on unknown address in mpz_add in mruby
Summary
OSV-2022-628: Segv on unknown address in mpz_add. Affects mruby versions >= e04184185ab43b94980550e850d8813a415fa438, < 26ce85bd5de515906e01fdeeac774316628ad599. Fixed in 26ce85bd5de515906e01fdeeac774316628ad599. 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 to provide scripting capabilities. The mpz_add function is part of the GNU Multiple Precision Arithmetic Library (GMP) used by mruby for arbitrary precision arithmetic operations. This vulnerability in mpz_add can lead to a segmentation fault (segv) when an unknown address is encountered during addition or subtraction operations.
Vulnerability Detail
The vulnerability arises from an unknown address causing a segv in the mpz_add function. This can occur during arithmetic operations involving large numbers. An attacker could potentially exploit this vulnerability to crash the application or execute arbitrary code. The issue was reported through the OSS-Fuzz project and has been assigned the identifier OSV-2022-628.
How To Fix
Minimum fixed version
26ce85bd5de515906e01fdeeac774316628ad599
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 consider implementing input validation and sanitization to prevent the use of large numbers that may trigger the vulnerability. Additionally, monitoring and logging segv crashes can help identify potential attacks or instances of this vulnerability being triggered.
Conclusion
The vulnerability in mpz_add in mruby can result in a segv when an unknown address is encountered during arithmetic operations. It is recommended to update mruby to a version that includes the fix for this vulnerability. Developers can also consider implementing input validation and monitoring segv crashes as additional measures. For further support on 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.
mpz_add is a function in the GNU Multiple Precision Arithmetic Library (GMP) used by mruby for adding two arbitrary precision integers.
An attacker could exploit this vulnerability by providing input that triggers the segv in mpz_add, potentially leading to a crash or arbitrary code execution.
Yes, the vulnerability has been fixed in mruby. Updating to a version that includes the fix will address the issue.
Developers can implement input validation and sanitization to prevent the use of large numbers that may trigger the vulnerability. Monitoring and logging segv crashes can also help detect potential attacks.
References
Related vulnerabilities
Recent vulnerabilities recorded for mruby.