Vulnerabilities > CVE-2009-4140 - Remote PHP Code Execution vulnerability in Open Flash Chart 'ofc_upload_image.php'

047910
CVSS 7.5 - HIGH
Attack vector
NETWORK
Attack complexity
LOW
Privileges required
NONE
Confidentiality impact
PARTIAL
Integrity impact
PARTIAL
Availability impact
PARTIAL
network
low complexity
teethgrinder-co-uk
matomo
nessus
exploit available
metasploit

Summary

Unrestricted file upload vulnerability in ofc_upload_image.php in Open Flash Chart v2 Beta 1 through v2 Lug Wyrm Charmer, as used in Piwik 0.2.35 through 0.4.3, Woopra Analytics Plugin before 1.4.3.2, and possibly other products, when register_globals is enabled, allows remote authenticated users to execute arbitrary code by uploading a file with an executable extension through the name parameter with the code in the HTTP_RAW_POST_DATA parameter, then accessing it via a direct request to the file in tmp-upload-images/.

Vulnerable Configurations

Part Description Count
Application
Teethgrinder.Co.Uk
8
Application
Matomo
3

Exploit-Db

  • descriptionOpenEMR PHP File Upload Vulnerability. CVE-2009-4140,CVE-2011-4275. Remote exploit for php platform
    idEDB-ID:24529
    last seen2016-02-02
    modified2013-02-20
    published2013-02-20
    reportermetasploit
    sourcehttps://www.exploit-db.com/download/24529/
    titleOpenEMR PHP File Upload Vulnerability
  • descriptionOpenEMR 4.1.1 (ofc_upload_image.php) Arbitrary File Upload Vulnerability. CVE-2009-4140,CVE-2011-4275. Webapps exploit for php platform
    idEDB-ID:24492
    last seen2016-02-02
    modified2013-02-13
    published2013-02-13
    reporterLiquidWorm
    sourcehttps://www.exploit-db.com/download/24492/
    titleOpenEMR 4.1.1 ofc_upload_image.php Arbitrary File Upload Vulnerability
  • descriptionCiviCRM for Joomla 4.2.2 - Remote Code Injection. CVE-2009-4140,CVE-2011-4275. Webapps exploit for php platform
    fileexploits/php/webapps/24969.txt
    idEDB-ID:24969
    last seen2016-02-03
    modified2013-04-22
    platformphp
    port
    published2013-04-22
    reporteriskorpitx
    sourcehttps://www.exploit-db.com/download/24969/
    titleCiviCRM for Joomla 4.2.2 - Remote Code Injection
    typewebapps
  • descriptionOpen Flash Chart 2 - Arbitrary File Upload. CVE-2009-4140,CVE-2011-4275. Remote exploit for php platform
    idEDB-ID:29210
    last seen2016-02-03
    modified2013-10-26
    published2013-10-26
    reportermetasploit
    sourcehttps://www.exploit-db.com/download/29210/
    titleOpen Flash Chart 2 - Arbitrary File Upload
  • descriptionZonPHP 2.25 - Remote Code Execution (RCE) Vulnerability. CVE-2009-4140,CVE-2011-4275. Webapps exploit for php platform
    idEDB-ID:29091
    last seen2016-02-03
    modified2013-10-20
    published2013-10-20
    reporterHalim Cruzito
    sourcehttps://www.exploit-db.com/download/29091/
    titleZonPHP 2.25 - Remote Code Execution RCE Vulnerability
  • descriptionPiwik Open Flash Chart Remote Code Execution Vulnerability. CVE-2009-4140,CVE-2011-4275. Webapps exploit for php platform
    idEDB-ID:10532
    last seen2016-02-01
    modified2009-12-17
    published2009-12-17
    reporterBraeden Thomas
    sourcehttps://www.exploit-db.com/download/10532/
    titlePiwik Open Flash Chart Remote Code Execution Vulnerability

Metasploit

Nessus

NASL familyCGI abuses
NASL idOPENX_OFC_UPLOAD_IMAGE.NASL
descriptionThe third-party Open Flash Chart component included with the version of OpenX hosted on the remote web server allows an unauthenticated attacker to upload arbitrary files to the affected system, by default in a web-accessible directory. While Nessus has not verified this, it is likely that an attacker could exploit this to upload a script with, say, PHP code and then browse to that file, causing arbitrary code to be executed on the remote system subject to the privileges of the web server user id.
last seen2020-06-01
modified2020-06-02
plugin id49271
published2010-09-17
reporterThis script is Copyright (C) 2010-2019 and is owned by Tenable, Inc. or an Affiliate thereof.
sourcehttps://www.tenable.com/plugins/nessus/49271
titleOpenX Open Flash Chart ofc_upload_image.php File Upload Arbitrary Code Execution
code
#
# (C) Tenable Network Security, Inc.
#


include("compat.inc");


if (description)
{
  script_id(49271);
  script_version("1.20");
  script_cvs_date("Date: 2019/09/03 10:57:21");

  script_cve_id("CVE-2009-4140");
  script_bugtraq_id(37314);

  script_name(english:"OpenX Open Flash Chart ofc_upload_image.php File Upload Arbitrary Code Execution");
  script_summary(english:"Tries to upload an invalid file through OpenX's OFC plugin");

  script_set_attribute(
    attribute:"synopsis",
    value:
"A PHP application hosted on the remote web server allows uploading
arbitrary files."
  );
  script_set_attribute(
    attribute:"description",
    value:
"The third-party Open Flash Chart component included with the version
of OpenX hosted on the remote web server allows an unauthenticated
attacker to upload arbitrary files to the affected system, by default
in a web-accessible directory.

While Nessus has not verified this, it is likely that an attacker
could exploit this to upload a script with, say, PHP code and then
browse to that file, causing arbitrary code to be executed on the
remote system subject to the privileges of the web server user id."
  );
  script_set_attribute(attribute:"see_also", value:"http://www.nessus.org/u?e959029c");
  script_set_attribute(
    attribute:"see_also",
    value:"http://blog.sucuri.net/2010/09/openx-users-time-to-upgrade.html"
  );
  script_set_attribute(
    attribute:"see_also",
    value:"http://blog.openx.org/09/security-update/"
  );
  script_set_attribute(
    attribute:"solution",
    value:
"Either remove the 'ofc_upload_image.php' script in
'admin/plugins/videoReport/lib/ofc2' or upgrade to version 2.8.7 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_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:"OpenX 2.8.6 File Upload");
  script_set_attribute(attribute:"exploit_framework_d2_elliot", value:"true");
  script_set_attribute(attribute:"metasploit_name", value:'OpenEMR PHP File Upload Vulnerability');
  script_set_attribute(attribute:"exploit_framework_metasploit", value:"true");

script_set_attribute(attribute:"vuln_publication_date", value:"2009/10/19");
  script_set_attribute(attribute:"patch_publication_date", value:"2010/09/14");
  script_set_attribute(attribute:"plugin_publication_date", value:"2010/09/17");

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

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

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

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

  exit(0);
}


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



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


install = get_install_from_kb(appname:'openx', port:port, exit_on_fail:TRUE);
dir = install['dir'];
url = dir + '/www/admin/plugins/videoReport/lib/ofc2/ofc_upload_image.php';


# Make sure the page exists before trying to POST to it.
res = http_send_recv3(method:"GET", item:url, port:port, exit_on_fail:TRUE);
if (!res[2] || "Saving your image to:" >!< res[2])
  exit(0, 'The OpenX install at '+build_url(port:port, qs:url)+' is not affected.');


# Try to exploit it.
#
# select one:
name = "";                             # will display an error message.
# name = SCRIPT_NAME+'-'+unixtime();     # will actually write to a file.

postdata =
  '<?php\n' +
  '\n' +
  'echo "'+SCRIPT_NAME+'\\n";\n' +
  '# phpinfo();\n' +
  '\n' +
  '?>';

res = http_send_recv3(
  port         : port,
  method       : 'POST',
  item         : url + '?name='+name,
  data         : postdata,
  content_type : 'text/plain',
  exit_on_fail : TRUE
);


# There's a problem if we see our "name" in the output.
if (
  res[2] &&
  egrep(pattern:'^Saving your image to:.+/'+name, string:res[2])
)
{
  if (report_verbosity > 0)
  {
    report =
      '\nNessus was able to verify the issue exists using the following request :' +
      '\n' +
      '\n' + crap(data:"-", length:30)+' snip '+ crap(data:"-", length:30) +
      '\n' + http_last_sent_request() +
      '\n' + crap(data:"-", length:30)+' snip '+ crap(data:"-", length:30) + '\n';
    security_hole(port:port, extra:report);
  }
  else security_hole(port);

  exit(0);
}
else exit(0, 'The OpenX install at '+build_url(port:port, qs:url)+' is not affected.');

Packetstorm

data sourcehttps://packetstormsecurity.com/files/download/123783/open_flash_chart_upload_exec.rb.txt
idPACKETSTORM:123783
last seen2016-12-05
published2013-10-26
reporterBraeden Thomas
sourcehttps://packetstormsecurity.com/files/123783/Open-Flash-Chart-2-Arbitrary-File-Upload.html
titleOpen Flash Chart 2 Arbitrary File Upload

Seebug

bulletinFamilyexploit
descriptionBUGTRAQ ID: 37314 CVE(CAN) ID: CVE-2009-4140 Piwik是一款利用Php+MySQL技术构建的开源网页访问统计系统。 Piwik中使用了open-flash-chart模块执行制表操作,该模块没有正确的过滤提交给ofc_upload_image.php文件的name和HTTP_RAW_POST_DATA参数便用于创建文件: &lt;? $default_path = '../tmp-upload-images/'; if (!file_exists($default_path)) mkdir($default_path, 0777, true); $destination = $default_path . basename( $_GET[ 'name' ] ); // This should be sanitised before use. echo 'Saving your image to: '. $destination; // and it tells us where it's saving it to, sigh. $jfh = fopen($destination, 'w') or die(&quot;can't open file&quot;); // The vulnerable code is right here. fwrite($jfh, $HTTP_RAW_POST_DATA); // and here, &lt;?phpinfo();?&gt;, &lt;?system($_GET['cmd']);?&gt; fclose($jfh); ?&gt; 在启用了register_globals的情况下,通过认证的远程攻击者可以通过上传带有PHP扩展名的文件并通过直接请求tmp-upload-images/来访问该文件导致执行任意代码。 Piwik 0.2.35 - 0.4.3 厂商补丁: Piwik ----- 目前厂商已经发布了升级补丁以修复这个安全问题,请到厂商的主页下载: http://piwik.org/blog/2009/10/piwik-response-to-secunia-advisory-sa37078/
idSSV:15141
last seen2017-11-19
modified2009-12-25
published2009-12-25
reporterRoot
sourcehttps://www.seebug.org/vuldb/ssvid-15141
titlePiwik ofc_upload_image.php远程PHP代码执行漏洞