Vulnerabilities > CVE-2002-0061 - OS Command Injection vulnerability in Apache Http Server

047910
CVSS 0.0 - NONE
Attack vector
UNKNOWN
Attack complexity
UNKNOWN
Privileges required
UNKNOWN
Confidentiality impact
UNKNOWN
Integrity impact
UNKNOWN
Availability impact
UNKNOWN
apache
CWE-78
nessus
exploit available

Summary

Apache for Win32 before 1.3.24, and 2.0.x before 2.0.34-beta, allows remote attackers to execute arbitrary commands via shell metacharacters (a | pipe character) provided as arguments to batch (.bat) or .cmd scripts, which are sent unfiltered to the shell interpreter, typically cmd.exe.

Vulnerable Configurations

Part Description Count
Application
Apache
78

Common Attack Pattern Enumeration and Classification (CAPEC)

  • Command Line Execution through SQL Injection
    An attacker uses standard SQL injection methods to inject data into the command line for execution. This could be done directly through misuse of directives such as MSSQL_xp_cmdshell or indirectly through injection of data into the database that would be interpreted as shell commands. Sometime later, an unscrupulous backend application (or could be part of the functionality of the same application) fetches the injected data stored in the database and uses this data as command line arguments without performing proper validation. The malicious data escapes that data plane by spawning new commands to be executed on the host.
  • Command Delimiters
    An attack of this type exploits a programs' vulnerabilities that allows an attacker's commands to be concatenated onto a legitimate command with the intent of targeting other resources such as the file system or database. The system that uses a filter or a blacklist input validation, as opposed to whitelist validation is vulnerable to an attacker who predicts delimiters (or combinations of delimiters) not present in the filter or blacklist. As with other injection attacks, the attacker uses the command delimiter payload as an entry point to tunnel through the application and activate additional attacks through SQL queries, shell commands, network scanning, and so on.
  • Exploiting Multiple Input Interpretation Layers
    An attacker supplies the target software with input data that contains sequences of special characters designed to bypass input validation logic. This exploit relies on the target making multiples passes over the input data and processing a "layer" of special characters with each pass. In this manner, the attacker can disguise input that would otherwise be rejected as invalid by concealing it with layers of special/escape characters that are stripped off by subsequent processing steps. The goal is to first discover cases where the input validation layer executes before one or more parsing layers. That is, user input may go through the following logic in an application: In such cases, the attacker will need to provide input that will pass through the input validator, but after passing through parser2, will be converted into something that the input validator was supposed to stop.
  • Argument Injection
    An attacker changes the behavior or state of a targeted application through injecting data or command syntax through the targets use of non-validated and non-filtered arguments of exposed services or methods.
  • OS Command Injection
    In this type of an attack, an adversary injects operating system commands into existing application functions. An application that uses untrusted input to build command strings is vulnerable. An adversary can leverage OS command injection in an application to elevate privileges, execute arbitrary commands and compromise the underlying operating system.

Exploit-Db

descriptionApache Win32 1.3.x/2.0.x Batch File Remote Command Execution Vulnerability. CVE-2002-0061. Remote exploit for windows platform
idEDB-ID:21350
last seen2016-02-02
modified2002-03-21
published2002-03-21
reporterSPAX
sourcehttps://www.exploit-db.com/download/21350/
titleApache Win32 1.3.x/2.0.x Batch File Remote Command Execution Vulnerability

Nessus

NASL familyWeb Servers
NASL idAPACHE_BAT_EXEC.NASL
descriptionApache for Win32 prior to 1.3.24 and 2.0.x prior to 2.0.34-beta is shipped with a default script,
last seen2020-06-01
modified2020-06-02
plugin id10938
published2002-04-18
reporterThis script is Copyright (C) 2002-2018 Matt Moore
sourcehttps://www.tenable.com/plugins/nessus/10938
titleApache on Windows < 1.3.24 / 2.0.x < 2.0.34 DOS Batch File Arbitrary Command Execution
code
#
# This script was written by Matt Moore <[email protected]>
#
#   - Added Synopsis, Reference, CVSS Vector
#   - Modified Description

# Changes by Tenable:
# - Standardized title (4/2/2009)
# - Added Synopsis, Referece, CVSS Vector/Modified Description (4/8/2009)


include("compat.inc");

if (description)
{
 script_id(10938);
 script_version("1.36");
 script_set_attribute(attribute:"plugin_modification_date", value:"2020/06/12");

 script_cve_id("CVE-2002-0061");
 script_bugtraq_id(4335);

 script_name(english:"Apache on Windows < 1.3.24 / 2.0.x < 2.0.34 DOS Batch File Arbitrary Command Execution");
 script_summary(english:"Tests for presence of Apache Command execution via .bat vulnerability");

 script_set_attribute(attribute:"synopsis", value:
"The remote web server is affected by a remote command execution
vulnerability.");
 script_set_attribute(attribute:"description", value:
"Apache for Win32 prior to 1.3.24 and 2.0.x prior to 2.0.34-beta is
shipped with a default script, '/cgi-bin/test-cgi.bat', that allows an
attacker to remotely execute arbitrary commands on the host subject to
the permissions of the affected application. 

An attacker can send a pipe character '|' with commands appended as
parameters, which are then executed by Apache.");
 script_set_attribute(attribute:"see_also", value:"https://seclists.org/bugtraq/2002/Mar/334");
 script_set_attribute(attribute:"see_also", value:"http://www.apacheweek.com/issues/02-03-29#apache1324");
 script_set_attribute(attribute:"solution", value:"Upgrade to Apache web server 1.3.24 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:POC/RL:OF/RC:C");
 script_set_cvss3_base_vector("CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L");
 script_set_cvss3_temporal_vector("CVSS:3.0/E:P/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:"vuln_publication_date", value:"2002/03/21");
 script_set_attribute(attribute:"plugin_publication_date", value:"2002/04/18");

 script_set_attribute(attribute:"plugin_type", value:"remote");
 script_set_attribute(attribute:"cpe", value:"cpe:/a:apache:http_server");
 script_set_attribute(attribute:"exploited_by_nessus", value:"true");
  script_end_attributes();

 script_category(ACT_ATTACK);

 script_copyright(english:"This script is Copyright (C) 2002-2020 Matt Moore");
 script_family(english:"Web Servers");

 script_dependencie("http_version.nasl", "os_fingerprint.nasl");
 script_require_ports("Services/www", 80);
 script_require_keys("installed_sw/Apache");
 exit(0);
}

# Check makes request for cgi-bin/test-cgi.bat?|echo - which should return
# an HTTP 500 error containing the string 'ECHO is on'
# We just check for 'ECHO' (capitalized), as this should remain the same across
# most international versions of Windows(?)

include("global_settings.inc");
include("misc_func.inc");
include("http_func.inc");

port = get_http_port(default:80, embedded:TRUE);
if (!get_port_state(port)) exit(0, "Port "+port+" is not open.");
if ( get_kb_item("Services/www/" + port + "/embedded") ) exit(0, "The web server listening on port "+port+" is embedded.");

banner = get_http_banner(port:port);
if (!banner) exit(1, "Failed to get the banner from the web server listening on port "+port+".");
if ("Server:" >!< banner) exit(0, "The banner from port " + port + " does not have a Server response header.");
if (preg(string:banner, pattern:'Server:.*(Apache-Coyote|Tomcat)')) exit(0, "The web server listening on port " + port + " is Apache Tomcat, not Apache.");
if (preg(pattern:"^Server:.*Apache", string:banner)) exit(0, "The web server listening on port " + port + " is not Apache.");

if (report_paranoia < 2)
{
  os = get_kb_item("Host/OS");
  if (isnull(os)) exit(0, "It was not possible to determine if the host is running Windows.");
  if ("Windows" >!< os) exit(0, "The host does not appear to be running Windows.");
}

soc = http_open_socket(port);
if (!soc) exit(1, "Failed to open a socket on port "+port+".");

url = "/cgi-bin/test-cgi.bat?|echo";
req = http_get(item:url, port:port);
send(socket:soc, data:req);
res = http_recv(socket:soc);
http_close_socket(soc);

if (preg(pattern:"^HTTP/[0-9]\.[0-9] 500 ", string:res)) exit(0, "The web server listening on port "+port+" did not return a 500 response code as expected.");
if ("ECHO" >< res)
{
  if (report_verbosity > 0)
  {
    report = '\n' + "Nessus was able to execute the command 'ECHO' on the remote host using" +
             '\n' + 'the following URL :' +
             '\n' +
             '\n' + '  ' + build_url(port:port, qs:url) +
             '\n';
    if (report_verbosity > 1)
    {
      report += '\n' + 'This produced the following results :' +
                '\n' + 
                '\n' + res;
    }
    security_hole(port:port, extra:report);
  }
  else security_hole(port);
  exit(0);
}
else exit(0, "The web server listening on port "+port+" is not affected.");

Packetstorm

data sourcehttps://packetstormsecurity.com/files/download/25903/Apache.Win32.txt
idPACKETSTORM:25903
last seen2016-12-05
published2002-03-22
reporterOry Segal
sourcehttps://packetstormsecurity.com/files/25903/Apache.Win32.txt.html
titleApache.Win32.txt

Statements

contributorMark J Cox
lastmodified2008-07-02
organizationApache
statementFixed in Apache HTTP Server 1.3.24: http://httpd.apache.org/security/vulnerabilities_13.html