[19603] in bugtraq
Re: CORRECTION to CODE: FormMail.pl can be used to send anonymous
daemon@ATHENA.MIT.EDU (Joel Sing)
Mon Mar 12 04:56:34 2001
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"; format=flowed
Message-ID: <5.0.2.1.0.20010312143459.02df1ad0@202.139.144.9>
Date: Mon, 12 Mar 2001 15:05:59 +1100
Reply-To: Joel Sing <jsing@ORIGIN.NET.AU>
From: Joel Sing <jsing@ORIGIN.NET.AU>
To: BUGTRAQ@SECURITYFOCUS.COM
In-Reply-To: <4.0.2.20010310174119.00993390@mail.shadowstorm.com>
Hi,
> I did a little playing with FormMail.pl after a run in with a spammer
>abusing our webserver. Apparently ALL FormMail.pl cgi-bin scripts can be
>used to spam anonymously. I found another server with FormMail.pl and
>tried the same exploit to send myself an email and it worked.
This appears to be correct. The current version has a configurable list of
referers that is supposed to prevent the script from being utilized from
unauthorized hosts. However there is an interesting assumption made in the
code:
if ($ENV{'HTTP_REFERER'}) {
foreach $referer (@referers) {
if ($ENV{'HTTP_REFERER'} =~ m|https?://([^/]*)$referer|i) {
$check_referer = 1;
last;
}
}
}
else {
$check_referer = 1;
}
If the referer doesn't exist the script assumes everything is okay,
presumably to allow older browsers or those that have referer turned off,
to access the script. This also means that a browser pointed directly to
the script can make use of it as there is no referer in this case.
Bit of a problem to fix... Since most browsers return the referer string it
would probably be safer to remove this assumption from the code and simply
inform the user of the problem if no referer is provided.
In any case it wouldn't be difficult to send a fake referer as it's only a
HTTP request header and the server is only believing what the client is
telling it. Write a simple Perl script that sends a manipulated GET request
with a fake referer header and you have yourself a nice spam mailer... :(
Cheers,
Joel
-------------------------------------------------------------------------
=> Joel Sing | jsing@origin.net.au | 0419 577 603 <=
-------------------------------------------------------------------------
DOS and Windows, a turtle and it's shell