Skip to content

Commit 65287e4

Browse files
committed
Land rapid7#3773 - Fix windows cmd redirection in firefox payloads
2 parents 280e16c + 1bb6573 commit 65287e4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/msf/core/payload/firefox.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,13 @@ def run_cmd_source
169169
.get("TmpD", Components.interfaces.nsIFile);
170170
stdout.append(stdoutFile);
171171
172+
var shell;
172173
if (windows) {
173-
var shell = shPath+" "+cmd;
174+
shell = shPath+" "+cmd.trim();
174175
shell = shPath+" "+shell.replace(/\\W/g, shEsc)+" >"+stdout.path+" 2>&1";
175176
var b64 = svcs.btoa(shell);
176177
} else {
177-
var shell = shPath+" "+cmd.replace(/\\W/g, shEsc);
178+
shell = shPath+" "+cmd.replace(/\\W/g, shEsc);
178179
shell = shPath+" "+shell.replace(/\\W/g, shEsc) + " >"+stdout.path+" 2>&1";
179180
}
180181
var process = Components.classes["@mozilla.org/process/util;1"]

0 commit comments

Comments
 (0)