Vulnerabilities > CVE-1999-0509
Attack vector
NETWORK Attack complexity
LOW Privileges required
NONE Confidentiality impact
COMPLETE Integrity impact
COMPLETE Availability impact
COMPLETE Summary
Perl, sh, csh, or other shell interpreters are installed in the cgi-bin directory on a WWW site, which allows remote attackers to execute arbitrary commands.
Common Weakness Enumeration (CWE)
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.
Nessus
NASL family CGI abuses NASL id PERL_CGI.NASL description The last seen 2020-06-01 modified 2020-06-02 plugin id 10173 published 1999-06-22 reporter This script is Copyright (C) 1999-2018 Tenable Network Security, Inc. source https://www.tenable.com/plugins/nessus/10173 title Web Server /cgi-bin Perl Interpreter Access code # # (C) Tenable Network Security, Inc. # include("compat.inc"); if (description) { script_id(10173); script_version("1.34"); script_cvs_date("Date: 2018/07/24 18:56:10"); script_cve_id("CVE-1999-0509"); script_name(english:"Web Server /cgi-bin Perl Interpreter Access"); script_summary(english:"checks for the presence of /cgi-bin/perl"); script_set_attribute(attribute:"synopsis", value:"It is possible to execute arbitrary commands on the remote system."); script_set_attribute(attribute:"description", value: "The 'Perl' CGI is installed and can be launched as a CGI. This is equivalent to giving a free shell to an attacker, with the http server privileges (usually root or nobody)." ); script_set_attribute(attribute:"solution", value:"Remove it from /cgi-bin"); script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:N/C:C/I:C/A:C"); script_set_cvss_temporal_vector("CVSS2#E:U/RL:OF/RC:C"); script_set_attribute(attribute:"exploitability_ease", value:"No exploit is required"); script_set_attribute(attribute:"exploit_available", value:"false"); script_cwe_id(94); script_set_attribute(attribute:"vuln_publication_date", value:"1995/01/01"); script_set_attribute(attribute:"plugin_publication_date", value:"1999/06/22"); script_set_attribute(attribute:"plugin_type", value:"remote"); script_end_attributes(); script_category(ACT_GATHER_INFO); script_copyright(english:"This script is Copyright (C) 1999-2018 Tenable Network Security, Inc."); script_family(english:"CGI abuses"); script_dependencie("http_version.nasl", "find_service1.nasl", "no404.nasl"); 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); no404 = get_kb_item(strcat("www/no404/", port)); l = list_uniq(make_list("/", cgi_dirs())); url_l = make_list(); foreach d (l) { foreach prog (make_list("perl", "perl.exe")) { u = strcat(d, "/", prog, "?-v"); w = http_send_recv3(port: port, item: u, method:"GET", exit_on_fail: 1); s = w[2]; if (strlen(s) < 2048 && '\0' >!< s && # Exclude binary exec "This is perl " >< s && "Larry Wall" >< s && "Artistic License" >< s) { e = get_vuln_report(items: u, port: port); security_hole(port: port, extra: e); exit(0); } } } if (max_index(url_l) > 0) { e = get_vuln_report(items: url_l, port: port); security_hole(port: port, extra: e); exit(0); } exit(0, "No vulnerable CGI was found on port "+port+".");
NASL family CGI abuses NASL id SHELLS.NASL description The remote web server has one of these shells installed in /cgi-bin : ash, bash, csh, ksh, sh, tcsh, zsh Leaving executable shells in the cgi-bin directory of a web server may allow an attacker to execute arbitrary commands on the target machine with the privileges of the HTTP daemon. last seen 2020-06-01 modified 2020-06-02 plugin id 10252 published 1999-07-13 reporter This script is Copyright (C) 1999-2018 Tenable Network Security, Inc. source https://www.tenable.com/plugins/nessus/10252 title Web Server /cgi-bin Shell Access code # # (C) Tenable Network Security, Inc. # include("compat.inc"); if (description) { script_id(10252); script_version("1.35"); script_cvs_date("Date: 2018/07/27 18:38:14"); script_cve_id("CVE-1999-0509"); script_name(english:"Web Server /cgi-bin Shell Access"); script_summary(english:"Checks for the presence of various shells in /cgi-bin"); script_set_attribute(attribute:"synopsis", value:"Arbitrary commands can be run on the remote server."); script_set_attribute(attribute:"description", value: "The remote web server has one of these shells installed in /cgi-bin : ash, bash, csh, ksh, sh, tcsh, zsh Leaving executable shells in the cgi-bin directory of a web server may allow an attacker to execute arbitrary commands on the target machine with the privileges of the HTTP daemon."); script_set_attribute(attribute:"solution", value:"Remove all the shells from /cgi-bin."); 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:U/RL:OF/RC:C"); script_set_attribute(attribute:"exploitability_ease", value:"No exploit is required"); script_set_attribute(attribute:"exploit_available", value:"false"); script_cwe_id(94); script_set_attribute(attribute:"vuln_publication_date", value:"1995/01/01"); script_set_attribute(attribute:"plugin_publication_date", value:"1999/07/13"); script_set_attribute(attribute:"potential_vulnerability", value:"true"); script_set_attribute(attribute:"plugin_type", value:"remote"); script_end_attributes(); script_category(ACT_GATHER_INFO); script_copyright(english:"This script is Copyright (C) 1999-2018 Tenable Network Security, Inc."); script_family(english:"CGI abuses"); script_dependencie("http_version.nasl"); script_exclude_keys("Settings/disable_cgi_scanning"); script_require_keys("Settings/ParanoidReport"); script_require_ports("Services/www", 80); exit(0); } include("audit.inc"); include("global_settings.inc"); include("misc_func.inc"); include("http.inc"); if (report_paranoia < 2) audit(AUDIT_PARANOID); sh = make_list("ash", "bash", "csh", "ksh", "sh", "tcsh", "zsh"); port = get_http_port(default:80); foreach dir (cgi_dirs()) { foreach s (sh) { ok = is_cgi_installed3(item:string(dir, "/", s), port:port); if(ok) { security_hole(port); exit(0); } } }