Vulnerabilities > CVE-2003-1227 - Code Injection vulnerability in Gallery Project Gallery 1.4/1.4Pl1

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
gallery-project
CWE-94
nessus
exploit available

Summary

PHP remote file include vulnerability in index.php for Gallery 1.4 and 1.4-pl1, when running on Windows or in Configuration mode on Unix, allows remote attackers to inject arbitrary PHP code via a URL in the GALLERY_BASEDIR parameter, a different vulnerability than CVE-2002-1412. NOTE: this issue might be exploitable only during installation, or if the administrator has not run a security script after installation.

Vulnerable Configurations

Part Description Count
Application
Gallery_Project
2

Common Attack Pattern Enumeration and Classification (CAPEC)

  • Leverage Executable Code in Non-Executable Files
    An attack of this type exploits a system's trust in configuration and resource files, when the executable loads the resource (such as an image file or configuration file) the attacker has modified the file to either execute malicious code directly or manipulate the target process (e.g. application server) to execute based on the malicious configuration parameters. Since systems are increasingly interrelated mashing up resources from local and remote sources the possibility of this attack occurring is high. The attack can be directed at a client system, such as causing buffer overrun through loading seemingly benign image files, as in Microsoft Security Bulletin MS04-028 where specially crafted JPEG files could cause a buffer overrun once loaded into the browser. Another example targets clients reading pdf files. In this case the attacker simply appends javascript to the end of a legitimate url for a pdf (http://www.gnucitizen.org/blog/danger-danger-danger/) http://path/to/pdf/file.pdf#whatever_name_you_want=javascript:your_code_here The client assumes that they are reading a pdf, but the attacker has modified the resource and loaded executable javascript into the client's browser process. The attack can also target server processes. The attacker edits the resource or configuration file, for example a web.xml file used to configure security permissions for a J2EE app server, adding role name "public" grants all users with the public role the ability to use the administration functionality. The server trusts its configuration file to be correct, but when they are manipulated, the attacker gains full control.
  • Manipulating User-Controlled Variables
    This attack targets user controlled variables (DEBUG=1, PHP Globals, and So Forth). An attacker can override environment variables leveraging user-supplied, untrusted query variables directly used on the application server without any data sanitization. In extreme cases, the attacker can change variables controlling the business logic of the application. For instance, in languages like PHP, a number of poorly set default configurations may allow the user to override variables.

Exploit-Db

descriptionGallery 1.4 index.php Remote File Include Vulnerability. CVE-2003-1227. Webapps exploit for php platform
idEDB-ID:23238
last seen2016-02-02
modified2003-10-11
published2003-10-11
reporterpeter
sourcehttps://www.exploit-db.com/download/23238/
titleGallery 1.4 index.php Remote File Include Vulnerability

Nessus

NASL familyCGI abuses
NASL idGALLERY_INJECTION2.NASL
descriptionThe version of Gallery hosted on the remote web server is affected by a remote file inclusion vulnerability due to the application failing to properly sanitize user-supplied input to the
last seen2020-06-01
modified2020-06-02
plugin id11876
published2003-10-11
reporterThis script is Copyright (C) 2003-2019 and is owned by Tenable, Inc. or an Affiliate thereof.
sourcehttps://www.tenable.com/plugins/nessus/11876
titleGallery index.php GALLERY_BASEDIR Parameter Remote File Inclusion
code
#
# (C) Tenable Network Security, Inc.
#

include("compat.inc");

if (description)
{
  script_id(11876);
  script_version("1.29");
  script_cvs_date("Date: 2019/06/03 10:01:42");

  script_cve_id("CVE-2003-1227");
  script_bugtraq_id(8814);

  script_name(english:"Gallery index.php GALLERY_BASEDIR Parameter Remote File Inclusion");
  script_summary(english:"Checks for the presence of 'setup/index.php'");

  script_set_attribute(attribute:"synopsis", value:
"The remote web server is running a PHP application that is affected by
a remote file inclusion vulnerability.");
  script_set_attribute(attribute:"description", value:
"The version of Gallery hosted on the remote web server is affected by a
remote file inclusion vulnerability due to the application failing to
properly sanitize user-supplied input to the 'GALLERY_BASEDIR' parameter
of the 'index.php' script.  An attacker may use this flaw to inject
arbitrary code in the remote host and gain a shell with the privileges
of the web server user.");
  script_set_attribute(attribute:"see_also", value:"http://galleryproject.org/node/93");
  script_set_attribute(attribute:"solution", value:"Upgrade to Gallery 1.4-pl2 or 1.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:ND");
  script_set_cvss3_base_vector("CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:L");
  script_set_cvss3_temporal_vector("CVSS:3.0/E:F/RL:O/RC:X");
  script_set_attribute(attribute:"cvss_score_source", value:"CVE-2003-1227");
  script_set_attribute(attribute:"exploitability_ease", value:"No exploit is required");
  script_set_attribute(attribute:"exploit_available", value:"true");
  script_cwe_id(94);

  script_set_attribute(attribute:"vuln_publication_date", value:"2003/10/13");
  script_set_attribute(attribute:"patch_publication_date", value:"2003/10/12");
  script_set_attribute(attribute:"plugin_publication_date", value:"2003/10/11");

  script_set_attribute(attribute:"plugin_type", value:"remote");
  script_set_attribute(attribute:"cpe", value:"cpe:/a:gallery_project:gallery");
  script_end_attributes();

  script_category(ACT_ATTACK);
  script_family(english:"CGI abuses");
  script_copyright(english:"This script is Copyright (C) 2003-2019 and is owned by Tenable, Inc. or an Affiliate thereof.");

  script_dependencie("gallery_detect.nasl");
  script_exclude_keys("Settings/disable_cgi_scanning");
  script_require_keys("www/gallery", "www/PHP");
  script_require_ports("Services/www", 80);

  exit(0);
}

#
# The script code starts here
#

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      : "gallery",
  port         : port,
  exit_on_fail : TRUE
);

dir = install["dir"];

r = http_send_recv3(
  method : "GET",
  item   : dir + "/setup/index.php?GALLERY_BASEDIR=http://example.com/",
  port   : port,
  exit_on_fail : TRUE
);

if (egrep(pattern:"http://example.com//?util.php", string:r[2])) security_hole(port);
else audit(AUDIT_WEB_APP_NOT_AFFECTED,"Gallery", build_url(qs:dir,port:port));