Bug 451828 - (CVE-2008-2726) CVE-2008-2726 ruby: integer overflow in rb_ary_splice/update/replace() - beg + rlen
CVE-2008-2726 ruby: integer overflow in rb_ary_splice/update/replace() - beg ...
Status: CLOSED ERRATA
Product: Security Response
Classification: Other
Component: vulnerability (Show other bugs)
unspecified
All Linux
medium Severity medium
: ---
: ---
Assigned To: Red Hat Product Security
source=vendorsec,reported=20080605,pu...
: Security
: CVE-2008-2728 (view as bug list)
Depends On: 451926 451927 451928 451929 451930 451931 452293 452294 452295
Blocks:
  Show dependency treegraph
 
Reported: 2008-06-17 13:32 EDT by Tomas Hoger
Modified: 2016-03-04 07:26 EST (History)
2 users (show)

See Also:
Fixed In Version: 1.8.6.230-1.fc9
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-07-26 02:02:47 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Tomas Hoger 2008-06-17 13:32:51 EDT
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
rb_ary_splice() 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) {
         REALLOC_N(RARRAY(ary)->ptr, VALUE, len);

The addition may overflow causing len to be negative and due to that, REALLOC_N
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.
Comment 1 Tomas Hoger 2008-06-17 13:40:55 EDT
Drew Yao's proposed patch is the same as for CVE-2008-2725:

https://bugzilla.redhat.com/show_bug.cgi?id=451821#c1
Comment 4 Tomas Hoger 2008-06-20 14:52:49 EDT
Public now, lifting embargo:
http://preview.ruby-lang.org/en/news/2008/06/20/arbitrary-code-execution-vulnerabilities

Upstream released fixed versions:
1.8.5-p231, 1.8.6-p230, 1.8.7-p22, 1.9.0-2

Patches applied upstream:
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=17460
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=17472
Comment 8 Fedora Update System 2008-06-24 22:50:40 EDT
ruby-1.8.6.230-1.fc8 has been pushed to the Fedora 8 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 9 Fedora Update System 2008-06-24 22:52:15 EDT
ruby-1.8.6.230-1.fc9 has been pushed to the Fedora 9 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 10 Tomas Hoger 2008-07-01 03:00:36 EDT
*** Bug 451836 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.