CVE-2008-2726: Integer Overflow
Drew Yao of the Apple Product Security team reported an integer overflow leading to a bypass of memory re-allocation causing a heap overflow in the rbarysplice() function used by ruby interpreter for handling arrays. Problematic addition that may overflow:
if (beg >= RARRAY(ary)->len) { --> len = beg + rlen; if (len >= RARRAY(ary)->aux.capa) { REALLOCN(RARRAY(ary)->ptr, VALUE, len);
The addition may overflow causing len to be negative and due to that, REALLOCN is not called. This flaw can be used to crash and possibly execute arbitrary code with the privileges of Ruby application which use untrusted input in array operations.
Acknowledgements:
Red Hat would like to thank Drew Yao of the Apple Product Security team for reporting this issue.
Other sources
Integer overflow in the (1) rbarysplice function in Ruby 1.8.4 and earlier, 1.8.5 before 1.8.5-p231, 1.8.6 before 1.8.6-p230, 1.8.7 before 1.8.7-p22, and 1.9.0 before 1.9.0-2; and (2) the rbaryreplace function in 1.6.x allows context-dependent attackers to trigger memory corruption, aka the "beg + rlen" issue. NOTE: as of 20080624, there has been inconsistent usage of multiple CVE identifiers related to Ruby. The CVE description should be regarded as authoritative, although it is likely to change.
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
redhat/1.8.6.230to a version that resolves this vulnerability.Fixed in 1.
Event History
Frequently Asked Questions
What is the severity of CVE-2008-2726?
CVE-2008-2726 has a moderate severity rating due to potential memory corruption caused by integer overflow.
How do I fix CVE-2008-2726?
To fix CVE-2008-2726, upgrade Ruby to version 1.8.5-p231 or later, or to version 1.8.6-p230 or later.
What software is affected by CVE-2008-2726?
CVE-2008-2726 affects Ruby versions 1.8.4 and earlier, 1.8.5 before 1.8.5-p231, and several other specific versions up to 1.9.0-2.
Can CVE-2008-2726 lead to exploitation?
Yes, CVE-2008-2726 can be exploited by context-dependent attackers to trigger memory corruption.
What should I do if I'm using an affected version of Ruby due to CVE-2008-2726?
If using an affected version of Ruby, immediately update to a patched version to mitigate the vulnerability.