Web Server HTTP Dangerous Method Detection - Nessus

High   Plugin ID: 10498

This page contains detailed information about the Web Server HTTP Dangerous Method Detection Nessus plugin including available exploits and PoCs found on GitHub, in Metasploit or Exploit-DB for verifying of this vulnerability.

Plugin Overview


ID: 10498
Name: Web Server HTTP Dangerous Method Detection
Filename: http_methods.nasl
Vulnerability Published: 1994-01-01
This Plugin Published: 2000-08-30
Last Modification Time: 2018-08-08
Plugin Version: 1.50
Plugin Type: remote
Plugin Family: Web Servers
Dependencies: http_version.nasl

Vulnerability Information


Severity: High
Vulnerability Published: 1994-01-01
Patch Published: N/A
CVE [?]: N/A
CPE [?]: N/A

Synopsis

The remote web server allows the PUT and/or DELETE method.

Description

The PUT method allows an attacker to upload arbitrary web pages on the server. If the server is configured to support scripts like ASP, JSP, or PHP it will allow the attacker to execute code with the privileges of the web server.

The DELETE method allows an attacker to delete arbitrary content from the web server.

Solution

Disable the PUT and/or DELETE method in the web server configuration.

Public Exploits


Target Network Port(s): 80
Target Asset(s): Services/www
Exploit Available: True (Metasploit Framework)
Exploit Ease: Exploits are available

Here's the list of publicly known exploits and PoCs for verifying the Web Server HTTP Dangerous Method Detection vulnerability:

  1. Metasploit: exploit/windows/iis/iis_webdav_upload_asp
    [Microsoft IIS WebDAV Write Access Code Execution]

Before running any exploit against any system, make sure you are authorized by the owner of the target system(s) to perform such activity. In any other case, this would be considered as an illegal activity.

Risk Information


CVSS V2 Vector [?]: AV:N/AC:L/Au:N/C:P/I:P/A:P/E:U/RL:OF/RC:C
CVSS Base Score:7.5 (High)
Impact Subscore:6.4
Exploitability Subscore:10.0
CVSS Temporal Score:5.5 (Medium)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:5.5 (Medium)
CVSS V3 Vector: CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L/E:U/RL:O/RC:C
CVSS Base Score:7.3 (High)
Impact Subscore:3.4
Exploitability Subscore:3.9
CVSS Temporal Score:6.4 (Medium)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:6.4 (Medium)

Go back to menu.

Plugin Source


This is the http_methods.nasl nessus plugin source code. This script is Copyright (C) 2000-2018 Tenable Network Security, Inc.

#
# (C) Tenable Network Security, Inc.
#

include("compat.inc");

if (description)
{
 script_id(10498);
 script_version("1.50");
 script_cvs_date("Date: 2018/08/08 12:52:14");

 script_bugtraq_id(12141);
 script_xref(name:"OWASP", value:"OWASP-CM-008");
 
 script_name(english:"Web Server HTTP Dangerous Method Detection");
 script_summary(english:"Verifies the access rights to the web server (PUT, DELETE)");

 script_set_attribute(attribute:"synopsis", value:
"The remote web server allows the PUT and/or DELETE method.");
 script_set_attribute(attribute:"description", value:
"The PUT method allows an attacker to upload arbitrary web pages on 
the server. If the server is configured to support scripts like ASP,
JSP, or PHP it will allow the attacker to execute code with the
privileges of the web server.

The DELETE method allows an attacker to delete arbitrary content from
the web server.");
 script_set_attribute(attribute:"see_also", value:"https://tools.ietf.org/html/rfc7231#section-4.3.4");
 script_set_attribute(attribute:"see_also", value:"https://tools.ietf.org/html/rfc7231#section-4.3.5");
 script_set_attribute(attribute:"solution", value:
"Disable the PUT and/or DELETE method in the web server configuration.");
 script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:N/C:P/I:P/A:P");
 script_set_cvss_temporal_vector("CVSS2#E:U/RL:OF/RC:C");
 script_set_cvss3_base_vector("CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L");
 script_set_cvss3_temporal_vector("CVSS:3.0/E:U/RL:O/RC:C");
 script_set_attribute(attribute:"exploitability_ease", value:"Exploits are available");
 script_set_attribute(attribute:"exploit_available", value:"true");
 script_set_attribute(attribute:"metasploit_name", value:'Microsoft IIS WebDAV Write Access Code Execution');
 script_set_attribute(attribute:"exploit_framework_metasploit", value:"true");

 script_set_attribute(attribute:"plugin_publication_date", value:"2000/08/30");
 script_set_attribute(attribute:"vuln_publication_date", value:"1994/01/01");

 script_set_attribute(attribute:"plugin_type", value:"remote");
 script_end_attributes();

 script_category(ACT_ATTACK);
 script_copyright(english:"This script is Copyright (C) 2000-2018 Tenable Network Security, Inc.");
 script_family(english:"Web Servers");

 script_dependencie("http_version.nasl");
 script_require_ports("Services/www", 80);
 exit(0);
}

include("global_settings.inc");
include("misc_func.inc");
include("http.inc");
include("audit.inc");

# the file data we'll upload
put_data = "Nessus was here.";

##
# Try to generate a filename that does't exist on the
# remote HTTP server. We'll try 20 times before giving up.
#
# @param port the port to send the HTTP request
# @return a filename or NULL
##
function generate_filename(port)
{
  var i = 0;
  var filename = NULL;

  for ( ; i < 20; i++)
  {
    filename = rand_str(length:12);

    # exit on fail here because if we hit some type of
    # critical failure while generating our test filename
    # then there is no reason to keep going
    var request_file = http_send_recv3(
      method:"GET",
      port:port,
      item:"/" + filename,
      exit_on_fail:TRUE);

    if (!empty_or_null(request_file) && "404" >< request_file[0])
    {
      return filename;
    }
  }

  return NULL;
}

##
# Tries to upload a file to the remote server using PUT. Tests
# if we were successful using GET.
#
# @param port the port the HTTP server is on
# @param filename the filename we are atempting to upload
# @return TRUE if the upload was successful and FALSE otherwise
##
function test_put(port, filename)
{
  # blindly send the PUT
  http_send_recv3(
    method:"PUT",
    port:port,
    item:"/" + filename,
    add_headers: make_array("Content-Type", "text/html"),
    data:put_data);

  # check if the file exists
  var request_file = http_send_recv3(
    method:"GET",
    port:port,
    item:"/" + filename);

  if (!empty_or_null(request_file) && "200" >< request_file[0] &&
    request_file[2] == put_data)
  {
    # set kb items we can use downstream
    set_kb_item(name:'www/put_upload', value:TRUE);
    set_kb_item(name:'www/' + port + '/put_upload', value:TRUE);
    return TRUE;
  }

  return FALSE;
}

# This plugin intinitally ignores the HTTP OPTIONS response.
# Just because PUT/DELETE are listed as Allowed doesn't mean
# that these methods will *actually* write files to disk.
# As such, relying on that output will only result in FP.
#
# This plugin also reflects the fact that if we fail PUT then
# we can't test DELETE.
#
# Finally, if PUT works but DELETE doesn't then we've left
# a file on the server... which should be ACT_DESTRUCTIVE
# but it appears that this script has always been ACT_ATTACK

port = get_http_port(default:80);

# generate a filename we can work with
name = generate_filename(port:port);
if (isnull(name))
{
  exit(1, "Failed to generate a random filename to test with.");
}

if (test_put(port:port, filename:name) == FALSE)
{
  audit(AUDIT_WEB_SERVER_NOT_AFFECTED, port);
}

# We successfully created a file on the remote
# server. Let's try to delete it.
http_send_recv3(
  method:"DELETE",
  port:port,
  item:"/" + name);

final_request = http_send_recv3(
    method:"GET",
    port:port,
    item:"/" + name);

report = '\nThe remote web server on port ' + port + ' supports file upload using ' +
         '\nthe HTTP PUT method. Nessus was able to create a file: ' +
         '\n\n' + build_url(port:port, host:get_host_name(), qs:name);
if (!empty_or_null(final_request) && "404" >< final_request[0])
{
  report += '\n\nNessus was then able to delete the file using HTTP DELETE.\n';
  set_kb_item(name:'www/delete_upload', value:TRUE);
  set_kb_item(name:'www/' + port + '/delete_upload', value:TRUE);
}
else
{
  report += '\n\nUnfortunately, Nessus was unable to delete the file using' +
    'the HTTP DELETE method.\n';
}

security_report_v4(port:port, severity:SECURITY_HOLE, extra:report);

The latest version of this script can be found in these locations depending on your platform:

  • Linux / Unix:
    /opt/nessus/lib/nessus/plugins/http_methods.nasl
  • Windows:
    C:\ProgramData\Tenable\Nessus\nessus\plugins\http_methods.nasl
  • Mac OS X:
    /Library/Nessus/run/lib/nessus/plugins/http_methods.nasl

Go back to menu.

How to Run


Here is how to run the Web Server HTTP Dangerous Method Detection as a standalone plugin via the Nessus web user interface (https://localhost:8834/):

  1. Click to start a New Scan.
  2. Select Advanced Scan.
  3. Navigate to the Plugins tab.
  4. On the top right corner click to Disable All plugins.
  5. On the left side table select Web Servers plugin family.
  6. On the right side table select Web Server HTTP Dangerous Method Detection plugin ID 10498.
  7. Specify the target on the Settings tab and click to Save the scan.
  8. Run the scan.

Here are a few examples of how to run the plugin in the command line. Note that the examples below demonstrate the usage on the Linux / Unix platform.

Basic usage:

/opt/nessus/bin/nasl http_methods.nasl -t <IP/HOST>

Run the plugin with audit trail message on the console:

/opt/nessus/bin/nasl -a http_methods.nasl -t <IP/HOST>

Run the plugin with trace script execution written to the console (useful for debugging):

/opt/nessus/bin/nasl -T - http_methods.nasl -t <IP/HOST>

Run the plugin with using a state file for the target and updating it (useful for running multiple plugins on the target):

/opt/nessus/bin/nasl -K /tmp/state http_methods.nasl -t <IP/HOST>

Go back to menu.

References


BID | SecurityFocus Bugtraq ID: OWASP | Open Web Application Security Project:
  • CM-008
See also: Similar and related Nessus plugins:
  • 92539 - HTTP_PROXY Environment Variable Namespace Collision Vulnerability (httpoxy)
  • 10930 - Multiple Web Server on Windows MS/DOS Device Request Remote DOS
  • 12055 - MS04-007: ASN.1 Vulnerability Could Allow Code Execution (828028) (uncredentialed check) (HTTP)
  • 10759 - Web Server HTTP Header Internal IP Disclosure
  • 10297 - Web Server Directory Traversal Arbitrary File Access
  • 10320 - Web Server Long URL Handling Remote Overflow DoS
  • 10815 - Web Server Generic XSS
  • 22254 - Web Server Expect Header XSS

Version


This page has been produced using Nessus Professional 10.1.2 (#68) LINUX, Plugin set 202205072148.
Plugin file http_methods.nasl version 1.50. For more plugins, visit the Nessus Plugin Library.

Go back to menu.