TimThumb Cache Directory 'src' Parameter Arbitrary PHP File Upload - Nessus

High   Plugin ID: 56735

This page contains detailed information about the TimThumb Cache Directory 'src' Parameter Arbitrary PHP File Upload Nessus plugin including available exploits and PoCs found on GitHub, in Metasploit or Exploit-DB for verifying of this vulnerability.

Plugin Overview


ID: 56735
Name: TimThumb Cache Directory 'src' Parameter Arbitrary PHP File Upload
Filename: timthumb_cache_dir_arbitrary_upload.nasl
Vulnerability Published: 2011-08-02
This Plugin Published: 2011-11-08
Last Modification Time: 2022-04-11
Plugin Version: 1.20
Plugin Type: remote
Plugin Family: CGI abuses
Dependencies: wordpress_detect.nasl, wordpress_timthumb_detect.nbin
Required KB Items [?]: installed_sw/TimThumb, installed_sw/WordPress, www/PHP

Vulnerability Information


Severity: High
Vulnerability Published: 2011-08-02
Patch Published: 2011-07-29
CVE [?]: CVE-2011-4106
CPE [?]: cpe:/a:binarymoon:timthumb, cpe:/a:timthumb:timthumb, cpe:/a:wordpress:wordpress

Synopsis

The remote web server hosts a web application that allows an attacker to upload arbitrary PHP files.

Description

The version of TimThumb hosted on the remote web server allows an unauthenticated, remote attacker to upload arbitrary PHP files as specified by input to the 'src' parameter and retrieved from third- party sites to its cache directory. It's likely that these files can then be executed by requesting them by means of a specially crafted URL, which would result in arbitrary code execution subject to the privileges of the web server process.

Note that this could be by design or because of a vulnerability in the way TimThumb validates the third-party host. Regardless, it represents a security vulnerability as it could allow for arbitrary PHP code execution.

Solution

Upgrade to TimThumb version 2.0 or higher or refer to the advisories for software packages using TimThumb for upgrade instructions.

Public Exploits


Target Network Port(s): 80
Target Asset(s): Services/www
Exploit Available: True (D2 Elliot)
Exploit Ease: No exploit is required

Here's the list of publicly known exploits and PoCs for verifying the TimThumb Cache Directory 'src' Parameter Arbitrary PHP File Upload vulnerability:

  1. D2 Elliot: wordpress_verve_meta_boxes_1.2.8_file_upload.html
    [Wordpress Verve Meta Boxes 1.2.8 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.

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)

Go back to menu.

Plugin Source


This is the timthumb_cache_dir_arbitrary_upload.nasl nessus plugin source code. This script is Copyright (C) 2011-2022 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(56735);
  script_version("1.20");
  script_set_attribute(attribute:"plugin_modification_date", value:"2022/04/11");

  script_cve_id("CVE-2011-4106");
  script_bugtraq_id(48963);

  script_name(english:"TimThumb Cache Directory 'src' Parameter Arbitrary PHP File Upload");

  script_set_attribute(attribute:"synopsis", value:
"The remote web server hosts a web application that allows an attacker
to upload arbitrary PHP files.");
  script_set_attribute(attribute:"description", value:
"The version of TimThumb hosted on the remote web server allows an
unauthenticated, remote attacker to upload arbitrary PHP files as
specified by input to the 'src' parameter and retrieved from third-
party sites to its cache directory. It's likely that these files can
then be executed by requesting them by means of a specially crafted
URL, which would result in arbitrary code execution subject to the
privileges of the web server process.

Note that this could be by design or because of a vulnerability in the
way TimThumb validates the third-party host. Regardless, it represents
a security vulnerability as it could allow for arbitrary PHP code
execution.");
  script_set_attribute(attribute:"see_also", value:"https://www.binarymoon.co.uk/2011/08/timthumb-2/");
  # http://markmaunder.com/2011/08/02/technical-details-and-scripts-of-the-wordpress-timthumb-php-hack/
  script_set_attribute(attribute:"see_also", value:"http://www.nessus.org/u?1c76d435");
  script_set_attribute(attribute:"solution", value:
"Upgrade to TimThumb version 2.0 or higher or refer to the advisories
for software packages using TimThumb for upgrade instructions.");
  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_attribute(attribute:"exploitability_ease", value:"No exploit is required");
  script_set_attribute(attribute:"exploit_available", value:"false");
  script_set_attribute(attribute:"d2_elliot_name", value:"Wordpress Verve Meta Boxes 1.2.8 File Upload");
  script_set_attribute(attribute:"exploit_framework_d2_elliot", value:"true");
  script_set_attribute(attribute:"exploited_by_nessus", value:"true");

  script_set_attribute(attribute:"vuln_publication_date", value:"2011/08/02");
  script_set_attribute(attribute:"patch_publication_date", value:"2011/07/29");
  script_set_attribute(attribute:"plugin_publication_date", value:"2011/11/08");

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

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

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

  script_dependencies("wordpress_detect.nasl", "wordpress_timthumb_detect.nbin");
  script_require_keys("www/PHP", "installed_sw/WordPress", "installed_sw/TimThumb");
  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";
plugin = "TimThumb";
get_install_count(app_name:plugin, exit_if_zero:TRUE);

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

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

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

src_parameter = "http://blogger.com." + SCRIPT_NAME;

get_url = dir + "?src=" + src_parameter;
res = http_send_recv3(item:get_url, port:port, method:"GET", exit_on_fail:TRUE);
if (
  ">TimThumb" >< res[2] &&
  ">Query String : src="+src_parameter+"<" >< res[2] &&
  (
    "error reading file " >< res[2] ||
    "remote file not a valid image" >< res[2] ||
    "remote file for " >< res[2] ||
    "can not be accessed. It is likely that the file permissions are restricted" >< res[2] ||
    "error writing temporary file" >< res[2] ||
    "local file for " >< res[2]
  )
)
{
  if (report_verbosity > 0)
  {
    header = 'Nessus was able to verify the issue with the following request';
    trailer = 'Note that Nessus has determined using the URL above only that\n' +
      'TimThumb allows files to be retrieved from arbitrary third-party\n' +
      'sites. It has not tried to actually exploit the issue to execute\n' +
      'arbitrary code.';

    report = get_vuln_report(
      header  : header,
      trailer : trailer,
      items   : get_url,
      port    : port
    );
    security_hole(port:port, extra:report);
  }
  else security_hole(port);
}
else
  audit(AUDIT_WEB_APP_EXT_NOT_AFFECTED, app, install_url, plugin + " script");

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

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

Go back to menu.

How to Run


Here is how to run the TimThumb Cache Directory 'src' Parameter Arbitrary PHP File Upload 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 TimThumb Cache Directory 'src' Parameter Arbitrary PHP File Upload plugin ID 56735.
  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 timthumb_cache_dir_arbitrary_upload.nasl -t <IP/HOST>

Run the plugin with audit trail message on the console:

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

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

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

Go back to menu.

References


BID | SecurityFocus Bugtraq ID: See also: Similar and related Nessus plugins:
  • 76873 - TimThumb 'timthumb.php' < 2.8.14 WebShot 'src' Parameter Remote Command Execution
  • 76874 - TimThumb 'timthumb.php' WebShot 'src' Parameter Remote Command Execution
  • 130263 - Adobe ColdFusion File Upload (APSB18-33) (CVE-2018-15961)
  • 39790 - Adobe ColdFusion FCKeditor 'CurrentFolder' File Upload
  • 16061 - e107 Image Manager Unauthorized File Upload
  • 39806 - FCKeditor 'CurrentFolder' Arbitrary File Upload
  • 21780 - FCKeditor on Apache connector.php Crafted File Extension Arbitrary File Upload
  • 69273 - Joomla! 2.5.x < 2.5.14 / 3.x < 3.1.5 .php. File Upload RCE
  • 64470 - Collector Component for Joomla! File Upload RCE
  • 79420 - Creative Contact Form Component for Joomla! File Upload RCE
  • 25736 - Expose for Joomla! File Upload RCE
  • 118310 - jQuery-File-Upload Arbitrary File Upload Vulnerability (Remote Check)
  • 58654 - Lenovo ThinkManagement Console RunAMTCommand Operation -PutUpdateFileCore Command Parsing Arbitrary File Upload
  • 22367 - Limbo Contact Component (com_contact) contact.html.php contact_attach Unrestricted File Upload
  • 82078 - ManageEngine Desktop Central statusUpdate Arbitrary File Upload RCE (intrusive check)
  • 82079 - ManageEngine Desktop Central Arbitrary File Upload and RCE (Safe Check)
  • 71217 - ManageEngine Desktop Central AgentLogUploadServlet Arbitrary File Upload RCE (intrusive check)
  • 71218 - ManageEngine Desktop Central AgentLogUploadServlet Arbitrary File Upload
  • 143600 - ManageEngine ServiceDesk Plus < 10.0 Build 10012 Arbitrary File Upload
  • 63638 - MoinMoin twikidraw.py Traversal File Upload Arbitrary File Overwrite
  • 47581 - Novell 'modulemanager' Servlet Arbitrary File Upload (intrusive check)
  • 47582 - Novell 'modulemanager' Servlet Arbitrary File Upload (safe check)
  • 66914 - Novell ZENworks Control Center File Upload Remote Code Execution (intrusive check)
  • 35261 - OneOrZero Helpdesk tinfo.php Arbitrary File Upload
  • 49271 - OpenX Open Flash Chart ofc_upload_image.php File Upload Arbitrary Code Execution
  • 51119 - Sitefinity CMS Arbitrary File Upload
  • 22303 - TikiWiki jhot.php Arbitrary File Upload
  • 61517 - Umbraco codeEditorSave.asmx SaveDLRScript Operation Traversal File Upload Arbitrary Command Execution
  • 80083 - Visual Mining NetCharts Server Arbitrary File Upload
  • 105732 - Western Digital MyCloud Unauthenticated File Upload
  • 79421 - Creative Contact Form Plugin for WordPress File Upload RCE
  • 76526 - MailPoet Newsletters for WordPress Arbitrary File Upload
  • 105372 - WP Symposium Plugin Arbitrary File Upload
  • 160208 - WSO2 Multiple Products File Upload Remote Command Execution (CVE-2022-29464)

Version


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

Go back to menu.