Amazon Linux AMI : ruby20 / ruby22,ruby23,ruby24 (ALAS-2018-983)

critical Nessus Plugin ID 108846

Synopsis

The remote Amazon Linux AMI host is missing a security update.

Description

Path traversal when writing to a symlinked basedir outside of the root

RubyGems version Ruby 2.2 series: 2.2.9 and earlier, Ruby 2.3 series:
2.3.6 and earlier, Ruby 2.4 series: 2.4.3 and earlier, Ruby 2.5 series: 2.5.0 and earlier, prior to trunk revision 62422 contains a Directory Traversal vulnerability in install_location function of package.rb that can result in path traversal when writing to a symlinked basedir outside of the root. This vulnerability appears to have been fixed in 2.7.6. (CVE-2018-1000073)

Improper verification of signatures in tarball allows to install mis-signed gem :

RubyGems version Ruby 2.2 series: 2.2.9 and earlier, Ruby 2.3 series:
2.3.6 and earlier, Ruby 2.4 series: 2.4.3 and earlier, Ruby 2.5 series: 2.5.0 and earlier, prior to trunk revision 62422 contains a Improper Verification of Cryptographic Signature vulnerability in package.rb that can result in a mis-signed gem could be installed, as the tarball would contain multiple gem signatures.. This vulnerability appears to have been fixed in 2.7.6. (CVE-2018-1000076)

Infinite loop vulnerability due to negative size in tar header causes Denial of Service

RubyGems version Ruby 2.2 series: 2.2.9 and earlier, Ruby 2.3 series:
2.3.6 and earlier, Ruby 2.4 series: 2.4.3 and earlier, Ruby 2.5 series: 2.5.0 and earlier, prior to trunk revision 62422 contains a infinite loop caused by negative size vulnerability in ruby gem package tar header that can result in a negative size could cause an infinite loop.. This vulnerability appears to have been fixed in 2.7.6. (CVE-2018-1000075)

Command injection in lib/resolv.rb:lazy_initialize() allows arbitrary code execution :

The 'lazy_initialize' function in lib/resolv.rb did not properly process certain filenames. A remote attacker could possibly exploit this flaw to inject and execute arbitrary commands. (CVE-2017-17790)

Missing URL validation on spec home attribute allows malicious gem to set an invalid homepage URL :

RubyGems version Ruby 2.2 series: 2.2.9 and earlier, Ruby 2.3 series:
2.3.6 and earlier, Ruby 2.4 series: 2.4.3 and earlier, Ruby 2.5 series: 2.5.0 and earlier, prior to trunk revision 62422 contains a Improper Input Validation vulnerability in ruby gems specification homepage attribute that can result in a malicious gem could set an invalid homepage URL. This vulnerability appears to have been fixed in 2.7.6. (CVE-2018-1000077)

XSS vulnerability in homepage attribute when displayed via gem server

RubyGems version Ruby 2.2 series: 2.2.9 and earlier, Ruby 2.3 series:
2.3.6 and earlier, Ruby 2.4 series: 2.4.3 and earlier, Ruby 2.5 series: 2.5.0 and earlier, prior to trunk revision 62422 contains a Cross Site Scripting (XSS) vulnerability in gem server display of homepage attribute that can result in XSS. This attack appear to be exploitable via the victim must browse to a malicious gem on a vulnerable gem server. This vulnerability appears to have been fixed in 2.7.6. (CVE-2018-1000078)

Unsafe Object Deserialization Vulnerability in gem owner allowing arbitrary code execution on specially crafted YAML

RubyGems version Ruby 2.2 series: 2.2.9 and earlier, Ruby 2.3 series:
2.3.6 and earlier, Ruby 2.4 series: 2.4.3 and earlier, Ruby 2.5 series: 2.5.0 and earlier, prior to trunk revision 62422 contains a Deserialization of Untrusted Data vulnerability in owner command that can result in code execution. This attack appear to be exploitable via victim must run the `gem owner` command on a gem with a specially crafted YAML file. This vulnerability appears to have been fixed in 2.7.6. (CVE-2018-1000074)

Path traversal issue during gem installation allows to write to arbitrary filesystem locations

RubyGems version Ruby 2.2 series: 2.2.9 and earlier, Ruby 2.3 series:
2.3.6 and earlier, Ruby 2.4 series: 2.4.3 and earlier, Ruby 2.5 series: 2.5.0 and earlier, prior to trunk revision 62422 contains a Directory Traversal vulnerability in gem installation that can result in the gem could write to arbitrary filesystem locations during installation. This attack appear to be exploitable via the victim must install a malicious gem. This vulnerability appears to have been fixed in 2.7.6. (CVE-2018-1000079)

If a script accepts an external input and outputs it without modification as a part of HTTP responses, an attacker can use newline characters to deceive the clients that the HTTP response header is stopped at there, and can inject fake HTTP responses after the newline characters to show malicious contents to the clients.(CVE-2017-17742)

The Dir.mktmpdir method introduced by tmpdir library accepts the prefix and the suffix of the directory which is created as the first parameter. The prefix can contain relative directory specifiers '../', so this method can be used to target any directory. So, if a script accepts an external input as the prefix, and the targeted directory has inappropriate permissions or the ruby process has inappropriate privileges, the attacker can create a directory or a file at any directory.(CVE-2018-6914)

If an attacker sends a large request which contains huge HTTP headers, WEBrick try to process it on memory, so the request causes the out-of-memory DoS attack.(CVE-2018-8777)

String#unpack receives format specifiers as its parameter, and can be specified the position of parsing the data by the specifier @. If a big number is passed with @, the number is treated as the negative value, and out-of-buffer read is occurred. So, if a script accepts an external input as the argument of String#unpack, the attacker can read data on heaps.(CVE-2018-8778)

UNIXServer.open accepts the path of the socket to be created at the first parameter. If the path contains NUL (\0) bytes, this method recognize that the path is completed before the NUL bytes. So, if a script accepts an external input as the argument of this method, the attacker can make the socket file in the unintentional path. And, UNIXSocket.open also accepts the path of the socket to be created at the first parameter without checking NUL bytes like UNIXServer.open.
So, if a script accepts an external input as the argument of this method, the attacker can accepts the socket file in the unintentional path.(CVE-2018-8779)

Dir.open, Dir.new, Dir.entries and Dir.empty? accept the path of the target directory as their parameter. If the parameter contains NUL (\0) bytes, these methods recognize that the path is completed before the NUL bytes. So, if a script accepts an external input as the argument of these methods, the attacker can make the unintentional directory traversal.(CVE-2018-8780)

Solution

Run 'yum update ruby20' to update your system.

Run 'yum update ruby22' to update your system.

Run 'yum update ruby23' to update your system.

Run 'yum update ruby24' to update your system.

See Also

https://alas.aws.amazon.com/ALAS-2018-983.html

Plugin Details

Severity: Critical

ID: 108846

File Name: ala_ALAS-2018-983.nasl

Version: 1.4

Type: local

Agent: unix

Published: 4/6/2018

Updated: 7/10/2019

Supported Sensors: Agentless Assessment, Frictionless Assessment Agent, Frictionless Assessment AWS, Nessus Agent, Nessus

Risk Information

VPR

Risk Factor: Medium

Score: 6.7

CVSS v2

Risk Factor: High

Base Score: 7.5

Vector: CVSS2#AV:N/AC:L/Au:N/C:P/I:P/A:P

CVSS v3

Risk Factor: Critical

Base Score: 9.8

Vector: CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Vulnerability Information

CPE: p-cpe:/a:amazon:linux:ruby20, p-cpe:/a:amazon:linux:ruby20-debuginfo, p-cpe:/a:amazon:linux:ruby20-devel, p-cpe:/a:amazon:linux:ruby20-doc, p-cpe:/a:amazon:linux:ruby20-irb, p-cpe:/a:amazon:linux:ruby20-libs, p-cpe:/a:amazon:linux:ruby22, p-cpe:/a:amazon:linux:ruby22-debuginfo, p-cpe:/a:amazon:linux:ruby22-devel, p-cpe:/a:amazon:linux:ruby22-doc, p-cpe:/a:amazon:linux:ruby22-irb, p-cpe:/a:amazon:linux:ruby22-libs, p-cpe:/a:amazon:linux:ruby23, p-cpe:/a:amazon:linux:ruby23-debuginfo, p-cpe:/a:amazon:linux:ruby23-devel, p-cpe:/a:amazon:linux:ruby23-doc, p-cpe:/a:amazon:linux:ruby23-irb, p-cpe:/a:amazon:linux:ruby23-libs, p-cpe:/a:amazon:linux:ruby24, p-cpe:/a:amazon:linux:ruby24-debuginfo, p-cpe:/a:amazon:linux:ruby24-devel, p-cpe:/a:amazon:linux:ruby24-doc, p-cpe:/a:amazon:linux:ruby24-irb, p-cpe:/a:amazon:linux:ruby24-libs, p-cpe:/a:amazon:linux:rubygem20-bigdecimal, p-cpe:/a:amazon:linux:rubygem20-io-console, p-cpe:/a:amazon:linux:rubygem20-psych, p-cpe:/a:amazon:linux:rubygem22-bigdecimal, p-cpe:/a:amazon:linux:rubygem22-io-console, p-cpe:/a:amazon:linux:rubygem22-psych, p-cpe:/a:amazon:linux:rubygem23-bigdecimal, p-cpe:/a:amazon:linux:rubygem23-did_you_mean, p-cpe:/a:amazon:linux:rubygem23-io-console, p-cpe:/a:amazon:linux:rubygem23-json, p-cpe:/a:amazon:linux:rubygem23-psych, p-cpe:/a:amazon:linux:rubygem24-bigdecimal, p-cpe:/a:amazon:linux:rubygem24-did_you_mean, p-cpe:/a:amazon:linux:rubygem24-io-console, p-cpe:/a:amazon:linux:rubygem24-json, p-cpe:/a:amazon:linux:rubygem24-psych, p-cpe:/a:amazon:linux:rubygem24-xmlrpc, p-cpe:/a:amazon:linux:rubygems20, p-cpe:/a:amazon:linux:rubygems20-devel, p-cpe:/a:amazon:linux:rubygems22, p-cpe:/a:amazon:linux:rubygems22-devel, p-cpe:/a:amazon:linux:rubygems23, p-cpe:/a:amazon:linux:rubygems23-devel, p-cpe:/a:amazon:linux:rubygems24, p-cpe:/a:amazon:linux:rubygems24-devel, cpe:/o:amazon:linux

Required KB Items: Host/local_checks_enabled, Host/AmazonLinux/release, Host/AmazonLinux/rpm-list

Patch Publication Date: 5/10/2018

Vulnerability Publication Date: 12/20/2017

Reference Information

CVE: CVE-2017-17742, CVE-2017-17790, CVE-2018-1000073, CVE-2018-1000074, CVE-2018-1000075, CVE-2018-1000076, CVE-2018-1000077, CVE-2018-1000078, CVE-2018-1000079, CVE-2018-6914, CVE-2018-8777, CVE-2018-8778, CVE-2018-8779, CVE-2018-8780

ALAS: 2018-983