lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date: 30 Jun 2008 20:46:27 -0000
From: snagg@...urenetwork.it
To: bugtraq@...urityfocus.com
Subject: Vuln name: Ruby rb_ary_fill() DOS

The advisory could be found here: http://securenetwork.it/ricerca/advisory/download/SN-2008-02.txt

Secure Network - Security Research Advisory

Vuln name: Ruby rb_ary_fill() DOS
Systems affected: ruby 1.8.x, 1.9.x
Systems not affected: -
Severity: Medium
Local/Remote: Local/Remote
Vendor URL: http://www.ruby-lang.org/
Author(s): Vincenzo "snagg" Iozzo - snagg@...urenetwork.it
Vendor disclosure: 23rd June 2008
Vendor acknowledged: 25th June 2008
Vendor patch release: 25th June 2008
Public disclosure: 30th June 2008
Advisory number: SN-2008-02
Advisory URL: http://www.securenetwork.it/advisories/

*** SUMMARY ***

Ruby is an interpreted language, used in a wide range of applications.
The specific issue is a Denial of Services vulnerability, caused by an integer overflow. However it doesn't allow arbitrary code execution.
On Ruby on Rails, an attacker may craft specific requests and by XSS (for example) can cause a legitimate user to crash the web server.


*** VULNERABILITY DETAILS ***

Integer overflow (Dos).
The vulnerability was found in rb_ary_fill().

Looking inside the application source code:
###### CUT HERE ######
 rb_ary_modify(ary);
    end = beg + len;
    if (end < 0) {
	rb_raise(rb_eArgError, "argument too big");
    }
    if (end > RARRAY(ary)->len) {
	if (end >= RARRAY(ary)->aux.capa) {
	    REALLOC_N(RARRAY(ary)->ptr, VALUE, end);
	    RARRAY(ary)->aux.capa = end;
	}

###### CUT HERE ######

The len value is incremented by one in a previous function and it is specified by the user. The lack of sanity check on the input, leads to an integer overflow here:

###### CUT HERE ######
 REALLOC_N(RARRAY(ary)->ptr, VALUE, end);
###### CUT HERE ######

This macro, in fact, will allocate end * VALUE. On 32bit architectures VALUE is 4. If an attacker  specifies a value of 0x3fffffff, this macro will allocate a memory region of 0, so that next time ary->ptr is accessed, it will raise a SIGSEGV.(NULL referencing)


*** EXPLOIT ***
a = []
a.fill("A",0..0x3fffffff)

*** FIX INFORMATION ***

http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/array.c?view=markup

*********************
*** LEGAL NOTICES ***
*********************

Secure Network (www.securenetwork.it) is an information security company,
which provides consulting and training services, and engages in security
research and development.

We are committed to open, full disclosure of vulnerabilities, cooperating
with software developers for properly handling disclosure issues.

This advisory is copyright 2008 Secure Network S.r.l. Permission is
hereby granted for the redistribution of this alert, provided that it is
not altered except by reformatting it, and that due credit is given. It
may not be edited in any way without the express consent of Secure Network
S.r.l. Permission is explicitly given for insertion in vulnerability
databases and similars, provided that due credit is given to Secure Network

The information in the advisory is believed to be accurate at the time of
publishing based on currently available information. This information is
provided as-is, as a free service to the community by Secure Network
research staff. There are no warranties with regard to this information.
Secure Network does not accept any liability for any direct, indirect,
or consequential loss or damage arising from use of, or reliance on,
this information.

If you have any comments or inquiries, or any issue with what is reported
in this advisory, please inform us as soon as possible.

E-mail: securenetwork@...urenetwork.it
GPG/PGP key: http://www.securenetwork.it/pgpkeys/Secure%20Network.asc
Phone: +39 02 24126788

Powered by blists - more mailing lists