#!/usr/bin/perl # ------------------------------------------------------------------------ # ------------------------------------------------------------------------ # Infinity CGI Exploit Scanner v3.11 Beta # Copyright (C) 2000 Azrael, All Rights Reserved # ------------------------------------------------------------------------ # This script is to be used for educational use only. I (Azrael) accept # absolutely no responsibility for the information that may be possibly # attained through the use of this script and/or the actions that may # take place because of someone's usage of this script. # ------------------------------------------------------------------------ # Visit http://infinityproject.cjb.net for more updates on the scanner and/or # a better version available. # You can contact me at infinity@wwdg.com # ------------------------------------------------------------------------ # ------------------------------------------------------------------------ # How to setup the script: # - Make sure you got the scanner blocker script (dontscan.cgi) as well # - you need to chmod the script to 755 (u+rwx,g+rx,o+rx) # - you need to chmod 666 (a+rw) the scanner counter datafile if you enable counting # - you need to make the file explog.txt (or whatever you put in the config below) # - you need to chmod the file explog.txt (or whatever you put in config) to 666 (a+rw) # - you need to make the file dontscan.txt (or whatever you put in the config below) # - you need to chmod the file dontscan.txt (or whatever you put in the config) to 666 (a+rw) # - if you enable vulnerability loggin: # - you need to make the file vulnlog.txt (or whatever you put in the config below) # - you need to chmod the file vulnlog.txt (or whatever you ptu in teh config below) to 666 (a+rw) # Make sure perl 5.005 or higher is installed # Make sure the first line of this script points to the location of perl (which perl) # All questions should be directed to infinityproject.cjb.net wwwboard # ------------------------------------------------------------------------ # The form to put on your website: # # Infinity Exploit Scanner 3.11 Beta - CGI Version

#

# Host: # Port:

# Advanced Error Checking
# Bypass IDS Security

# #

# # ------------------------------------------------------------------------ # Setup Variables # ------------------------------------------------------------------------ $yoursiteaddy = "www.yourdoamin.com"; # Your website address # Customize the colors of the output. Remember, special characters like # @, ", | etc... need a \ before them. $bodycolors = ""; $specialcolors = "cccccef"; # colors of special text in the output $nslookuplocation = "/usr/bin/nslookup"; # Location of nslookup binary (which nslookup) $logvulns = 0; # Log vulnerabilities - 1 is yes, 0 is no. WARNING - This can get big! $countscans = 1; # Turn this to 1 if you want to enable the scanner counter # If you enable countscans to 1, you must specify the location of the data file to use $counterlocation = "/pathto/expcount.txt"; $exploglocation = "/pathto/explog.txt"; # logfile $dontscanlocation = "/pathto/dontscan.txt"; # blocked sites list $vulnloglocation = "/pathto/vulnlog.txt"; # vulnerability logfile # Error code headers to check for with Advanced Error Checking: @errchkingarray = ("404 Not Found", "404 Error", "302 Object Moved", "script produced no output", "Item was not found", "Error Occurred While Processing Request"); # ------------------------------------------------------------------------ use Socket; $| = 1; $isitdone = "0"; $errsfound = 0; &header(); print ""; print "


Many thanks to rain.forest.puppy for the new ideas (see whisker). Check out his site!

[ Infinity Scanner 3.11 Beta - CGI Exploit Scanner ] Copyright 2000 Azrael, All Rights Reserved."; print "

"; } sub pingserver() { ($host, $port) = @_; print "

  • Looking Up $host..."; if(!gethostbyname($host)) { print "FAILED"; &footer(); exit; } else { print "OK

    "; } } sub fingerprint() { ($host, $port) = @_; print "

  • Fingerprinting for Valid Extensions...OK

      "; @extstocheck = (".cfm", ".cgi", ".sh", ".exe", ".htr", ".pl"); foreach $extcheck (@extstocheck) { socket(CLIENT, PF_INET, SOCK_STREAM, getprotobyname('tcp')); connect(CLIENT, $serverAddr); send(CLIENT,"GET sflj02wulsjdflkj203ursljf$extcheck HTTP/1.0\n\n",0); $check=; @output=; close(CLIENT); ($http,$code,$therest) = split(/ /,$check); print "
    • Checking $extcheck..."; if($code eq "200") { print "FAILED - Results for this extension may be invalid
      "; } else { print "PASSED
      "; } } print "

    "; } sub fastdircheck() { ($fastdircheck) = @_; socket(CLIENT, PF_INET, SOCK_STREAM, getprotobyname('tcp')); connect(CLIENT, $serverAddr); send(CLIENT,"GET $fastdircheck HTTP/1.0\n\n",0); $check=; @output=; close(CLIENT); ($http,$code,$therest) = split(/ /,$check); if($code eq "200" or $code eq "403" or $code eq "302") { $ifgotit = "yes"; } else { $ifgotit = "no" }; return($ifgotit); } sub determinedirs () { ($host, $port) = @_; print "

  • Determining Valid CGI Directories..."; @dirstocheck = ("/cgis/", "/cgi-bin/", "/cgi/", "/cgibin/", "/cgi-local/", "/cgilocal/", "/cgi-win/", "/cgiwin/"); foreach $dircheck (@dirstocheck) { socket(CLIENT, PF_INET, SOCK_STREAM, getprotobyname('tcp')); connect(CLIENT, $serverAddr); send(CLIENT,"GET $dircheck HTTP/1.0\n\n",0); $check=; @output=; close(CLIENT); ($http,$code,$therest) = split(/ /,$check); if($code eq "200" or $code eq "403" or $code eq "302") { push(@gooddirs, "$dircheck"); } } if ($#gooddirs >= 0) { print "OK

      "; } else { print "NONE FOUND

        "; } foreach $founddir (@gooddirs) { print "
      • Found Directory: $founddir
        "; } print "

      "; } sub determineservertype() { ($host, $port) = @_; print "

    • Determining Server Type..."; socket(CLIENT, PF_INET, SOCK_STREAM, getprotobyname('tcp')); if(connect(CLIENT, $serverAddr)) { send(CLIENT,"HEAD / HTTP/1.0\n\n",0); @serveroutput=; close(CLIENT); $servertype = ""; foreach $line (@serveroutput) { if($line =~ "Server\:") { $serverresponseline = $line; if(lc($line) =~ "iis") { $servertype = "iis"; } if(lc($line) =~ "apache") { $servertype = "apache"; } if(lc($line) =~ "netscape") { $servertype = "netscape"; } if(lc($line) =~ "website") { $servertype = "website"; } if(lc($line) =~ "netware") { $servertype = "netware"; } if(lc($line) =~ "neowebscript") { $servertype = "neowebscript"; } if(lc($line) =~ "thttpd") { $servertype = "thttpd"; } if(lc($line) =~ "machttp") { $servertype = "machttp"; } if(lc($line) =~ "webstar") { $servertype = "webstar"; } if(lc($line) =~ "homedoor") { $servertype = "homedoor"; } if(lc($line) =~ "netcloak") { $servertype = "netcloak"; } if(lc($line) =~ "netpresenz") { $servertype = "netpresenz"; } if(lc($line) =~ "domino") { $servertype = "domino"; } if(lc($line) =~ "sambar") { $servertype = "sambar"; } if(lc($line) =~ "zeus") { $servertype = "zeus"; } if(lc($line) =~ "alibaba") { $servertype = "alibaba"; } if(lc($line) =~ "frontpage") { $servertype = "frontpage"; } if(lc($line) =~ "quid") { $servertype = "quid"; } if(lc($line) =~ "teamtrack") { $servertype = "teamtrack"; } if(lc($line) =~ "dwhttpd") { $servertype = "dwhttpd"; } if(lc($line) =~ "icq") { $servertype = "icq"; } if(lc($line) =~ "folkweb") { $servertype = "folkweb"; } if(lc($line) =~ "fnord") { $servertype = "fnord"; } if(lc($line) =~ "serverseven") { $servertype = "serverseven"; } if(lc($line) =~ "stronghold") { $servertype = "stronghold"; } if(lc($line) =~ "agranat-emweb") { $servertype = "agranat-emweb"; } if(lc($line) =~ "ncsa") { $servertype = "ncsa"; } if(lc($line) =~ "cern") { $servertype = "cern"; } if(lc($line) =~ "process") { $servertype = "process"; } if(lc($line) =~ "rushhour") { $servertype = "rushhour"; } if(lc($line) =~ "aolserver") { $servertype = "aolserver"; } if(lc($line) =~ "commerce-builder") { $servertype = "commerce-builder"; } if(lc($line) =~ "wn") { $servertype = "wn"; } if(lc($line) =~ "oracle") { $servertype = "oracle"; } if(lc($line) =~ "emwac") { $servertype = "emwac"; } if(lc($line) =~ "webquest") { $servertype = "webquest"; } if(lc($line) =~ "open-market-webserver") { $servertype = "open-market-webserver"; } if(lc($line) =~ "open-market-secure-webserver") { $servertype = "open-market-secure-webserver"; } if(lc($line) =~ "goserve") { $servertype = "goserve"; } if(lc($line) =~ "plexus") { $servertype = "plexus"; } if(lc($line) =~ "eit") { $servertype = "eit"; } if(lc($line) =~ "spry") { $servertype = "spry"; } if(lc($line) =~ "osu") { $servertype = "osu"; } if(lc($line) =~ "roxen") { $servertype = "roxen"; } if(lc($line) =~ "phttpd") { $servertype = "phttpd"; } if(lc($line) =~ "falcon") { $servertype = "falcon"; } if(lc($line) =~ "mathopd") { $servertype = "mathopd"; } if(lc($line) =~ "boa") { $servertype = "boa"; } if(lc($line) =~ "javawebserver") { $servertype = "javawebserver"; } if(lc($line) =~ "zbserver") { $servertype = "zbserver"; } if(lc($line) =~ "frontier") { $servertype = "frontier"; } if(lc($line) =~ "gosite") { $servertype = "gosite"; } if(lc($line) =~ "aserve") { $servertype = "aserve"; } if(lc($line) =~ "os2httpd") { $servertype = "os2httpd"; } if(lc($line) =~ "powerweb") { $servertype = "powerweb"; } if(lc($line) =~ "boulevard") { $servertype = "boulevard"; } if(lc($line) =~ "webforone") { $servertype = "webforone"; } if(lc($line) =~ "webshare") { $servertype = "webshare"; } if(lc($line) =~ "enterpriseweb") { $servertype = "enterpriseweb"; } if(lc($line) =~ "cosmos") { $servertype = "cosmos"; } if(lc($line) =~ "glaci") { $servertype = "glaci"; } if(lc($line) =~ "cl-http") { $servertype = "cl-http"; } if(lc($line) =~ "i/net") { $servertype = "i/net"; } if(lc($line) =~ "webdisk") { $servertype = "webdisk"; } if(lc($line) =~ "hyperwave") { $servertype = "hyperwave"; } if(lc($line) =~ "telefinder") { $servertype = "telefinder"; } if(lc($line) =~ "viking") { $servertype = "viking"; } if(lc($line) =~ "omnihttpd") { $servertype = "omnihttpd"; } if(lc($line) =~ "xitami") { $servertype = "xitami"; } if(lc($line) =~ "avenida") { $servertype = "avenida"; } if(lc($line) =~ "spinnaker") { $servertype = "spinnaker"; } if(lc($line) =~ "wildcat") { $servertype = "wildcat"; } if(lc($line) =~ "vqserver") { $servertype = "vqserver"; } } } if($servertype eq "") { $servertype = "all"; print "FAILED

      "; } else { print "OK

      • $serverresponseline

      "; } } else { &dienice("Unable to connect to host"); } } sub scan() { ($host, $port, $errorcode, $extratext, $thedir, $thehole, $holeinfo) = @_; print "

        "; socket(CLIENT, PF_INET, SOCK_STREAM, getprotobyname('tcp')); gethostbyname($host) or print "No IP address"; if(!gethostbyname($host)) { print "
        Can't Resolve DNS/IP\n"; } if(connect(CLIENT, $serverAddr)) { $thewholeenchelada = "$thedir$thehole"; if($idsbypass eq "yes") { $thewholeenchelada =~ s/([-a-zA-Z0-9.])/sprintf("%%%x",ord($1))/ge; } send(CLIENT,"GET $thewholeenchelada HTTP/1.0\n\n",0); $check=; @output=; ($http,$code,$therest) = split(/ /,$check); if("$code" =~ "$errorcode" && "$therest" =~ "$extratext") { print "

      • Vulnerability Found: $holeinfo\n
        Location: $thedir$thehole\n\n"; if($errchk eq "yes") { $errsfound = 0; foreach $lineof (@output) { foreach $errtochk (@errchkingarray) { if($lineof =~ $errtochk) { print "
        Warning: Error Code \"$errtochk\" ! Results may be invalid.\n\n"; $errsfound++; } } } } $number++; if($errsfound == 0) { push(@vulnArray, "$thedir$thehole"); } } } print "
      "; close (CLIENT); } sub dienice() { ($msg) = @_; print "\n\nError:\n

      $msg"; exit; }