Drew Yao of the Apple Product Security team reported an integer overflow leading to a memory mis-allocation and heap overflow in the rbarystore() function used by ruby interpreter for handling arrays. This 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.
Drew Yao of the Apple Product Security team reported an integer overflow leading to a memory mis-allocation and heap overflow in the rbstrbufappend() function used by ruby interpreter for handling strings. This can be used to crash and possibly execute arbitrary code with the privileges of Ruby application which use untrusted input in string operations.
Acknowledgements:
Red Hat would like to thank Drew Yao of the Apple Product Security team for reporting this issue.
Algorithmic complexity vulnerability in the WEBrick::HTTPUtils.splitheadervalue function in WEBrick::HTTP::DefaultFileHandler in WEBrick in Ruby 1.8.5 and earlier, 1.8.6 through 1.8.6-p286, 1.8.7 through 1.8.7-p71, and 1.9 through r18423 allows context-dependent attackers to cause a denial of service (CPU consumption) via a crafted HTTP request that is processed by a backtracking regular expression.
Drew Yao of the Apple Product Security team reported an integer overflow leading to a memory mis-allocation and heap overflow in the rbarysplice() function used by ruby interpreter for handling arrays. Problematic reallocation is:
if (len >= RARRAY(ary)->aux.capa) { --> REALLOCN(RARRAY(ary)->ptr, VALUE, len); RARRAY(ary)->aux.capa = len; }
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.
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.
Drew Yao of the Apple Product Security team reported that the rbstrformat() function uses alloca() memory allocation function in insecure way, causing memory address returned by alloca() to be out of stack memory space. This can be used to crash and possibly execute arbitrary code with the privileges of Ruby application which use untrusted input in string operations.
Acknowledgements:
Red Hat would like to thank Drew Yao of the Apple Product Security team for reporting this issue.
A vulnerability was found on WEBrick, a part of Ruby's standard library. WEBrick lets attackers to inject malicious escape sequences to its logs, making it possible for dangerous control characters to be executed on a victim's terminal emulator.
We already have a fix for it. Releases for every active branches are to follow this announce. But for a meantime, we recommend you to avoid looking at your WEBrick logs, until you update your WEBrick process. Detailed description
Terminal escape sequences are used to allow various forms of interaction between a terminal and a inside process. The problem is that those sequences are not intended to be issued by untrusted sources; such as network inputs. So if a remote attacker could inject escape sequences into WEBrick logs, and a victim happen to consult them through his/her terminal, the attacker could take advantages of various weaknesses in terminal emulators.
http://www.ruby-lang.org/en/news/2010/01/10/webrick-escape-sequence-injection/
Description of problem:
Ruby upstream has announced multiple security vulnerabilities related with not proper Ruby access restriction to critical variables and methods at various safe levels:
a, untracevar is permitted at safe level 4. Affects: rhel-2.1->rhel-5.3 Proposed patch: http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=17692
b, $PROGRAMNAME may be modified at safe level 4. Doesn't Affect: rhel-2.1->rhel-4.8 Affects: rhel-5.2.z, rhel-5.3 Proposed patch: ? c, Insecure methods may be called at safe level 1-3 Affects: rhel-2.1->rhel-5.3 Proposed patch: http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=17696
d, Syslog operations are permitted at safe level 4. Affects: rhel-2.1->rhel-5.3 Proposed patch: http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=17809
Version-Release number of selected component (if applicable): All versions of the Ruby package as shipped with Red Hat Enterprise Linux 2.1, 3, 4 and 5.
How reproducible: Always
Steps to Reproduce: See reproducers.
Additional info -- public mention of this issue:
http://www.ruby-lang.org/en/news/2008/08/08/multiple-vulnerabilities-in-ruby/
Common Vulnerabilities and Exposures assigned an identifier CVE-2008-3657 to the following vulnerability:
The dl module in Ruby 1.8.5 and earlier, 1.8.5 through 1.8.6-p286, 1.8.7 through 1.8.7-p71, and 1.9 through r18423 does not check "taintness" of inputs, which allows context-dependent attackers to bypass safe levels and execute dangerous functions by accessing a library using DL.dlopen.
Refences: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=494401 http://www.ruby-lang.org/en/news/2008/08/08/multiple-vulnerabilities-in-ruby/
A race condition was found in the way the secure implementation of Ruby fileutils' remove system entries method (removeentrysecure()), removed directory trees. A local attacker could use this flaw to conduct symbolic link attacks, leading to removal of arbitrary files or directories on the system.
References: [1] http://www.ruby-lang.org/en/news/2011/02/18/fileutils-is-vulnerable-to-symlink-race-attacks/
Upstream patch (against trunk): [2] http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=30896
Common Vulnerabilities and Exposures assigned an identifier CVE-2008-3905 to the following vulnerability:
resolv.rb in Ruby 1.8.5 and earlier, 1.8.6 before 1.8.6-p287, 1.8.7 before 1.8.7-p72, and 1.9 r18423 and earlier uses sequential transaction IDs and constant source ports for DNS requests, which makes it easier for remote attackers to spoof DNS responses, a different vulnerability than CVE-2008-1447.
References: http://www.ruby-lang.org/en/news/2008/08/08/multiple-vulnerabilities-in-ruby/ http://www.openwall.com/lists/oss-security/2008/09/04/9
Upstream patch: http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=18424
A security flaw was found in the Ruby method, translating message of the exception into string representation. An attacker could use this flaw to modify arbitrary untainted strings into their tainted equivalents by tricking the safe level mechanism of this method.
References: [1] http://www.ruby-lang.org/en/news/2011/02/18/exception-methods-can-bypass-safe/
Upstream patch (against ruby18 branch): [2] http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=30903
The BigDecimal library in Ruby 1.8.6 before p369 and 1.8.7 before p173 allows context-dependent attackers to cause a denial of service (application crash) via a string argument that represents a large number, as demonstrated by an attempted conversion to the Float data type.
Ruby before 1.8.6-p114 does not reset the random seed upon forking, which makes it easier for context-dependent attackers to predict the values of random numbers by leveraging knowledge of the number sequence obtained in a different child process, a related issue to CVE-2003-0900.
The REXML module in Ruby 1.8.6 through 1.8.6-p287, 1.8.7 through 1.8.7-p72, and 1.9 allows context-dependent attackers to cause a denial of service (CPU consumption) via an XML document with recursively nested entities, aka an "XML entity explosion."
Common Vulnerabilities and Exposures assigned an identifier CVE-2008-1891 to the following vulnerability:
Directory traversal vulnerability in WEBrick in Ruby 1.9.0 and earlier, when using NTFS or FAT filesystems, allows remote attackers to read arbitrary CGI files via a trailing (1) + (plus), (2) %2b (encoded plus), (3) . (dot), (4) %2e (encoded dot), or (5) %20 (encoded space) character in the URI, possibly related to the WEBrick::HTTPServlet::FileHandler and WEBrick::HTTPServer.new functionality and the :DocumentRoot option.
Refences: http://aluigi.altervista.org/adv/webrickcgi-adv.txt http://www.frsirt.com/english/advisories/2008/1245/references http://secunia.com/advisories/29794 http://xforce.iss.net/xforce/xfdb/41824
The regular expression engine (regex.c) in Ruby 1.8.5 and earlier, 1.8.6 through 1.8.6-p286, 1.8.7 through 1.8.7-p71, and 1.9 through r18423 allows remote attackers to cause a denial of service (infinite loop and crash) via multiple long requests to a Ruby socket, related to memory allocation failure, and as demonstrated against Webrick.
A flaw was discovered in a way various ruby net:: modules verify commonName (CN) attribute of SSL certificate provided by server against requested hostname, which makes it easier for remote attackers to intercept SSL transmissions via a man-in-the-middle attack or spoofed site.
Issue was originally reported for net::http(s) module and was assigned CVE id CVE-2007-5162. However, similar issue also affects other modules: net::ftptls, net::telnets, net::imap and CVS versions of net::pop and net::smtp.
Upstream SVN commit: http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=13656
Common Vulnerabilities and Exposures assigned an identifier CVE-2007-5162 to the following vulnerability:
The connect method in lib/net/http.rb in the (1) Net::HTTP and (2) Net::HTTPS libraries in Ruby 1.8.5 and 1.8.6 does not verify that the commonName (CN) field in a server certificate matches the domain name in an HTTPS request, which makes it easier for remote attackers to intercept SSL transmissions via a man-in-the-middle attack or spoofed web site.
References:
http://www.isecpartners.com/advisories/2007-006-rubyssl.txt http://www.securityfocus.com/bid/25847 http://www.securityfocus.com/archive/1/480987
Patch applied to trunk:
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=13499 (original advisory links to other commits in other svn branches)