Skip to content

Commit cea8605

Browse files
HD Moorekernelsmith
authored andcommitted
Fix rapid7#5596 by catching RuntimeError from Rex::Poly
1 parent 827d241 commit cea8605

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

modules/encoders/x86/shikata_ga_nai.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,9 @@ def generate_shikata_block(state, length, cutoff)
281281
begin
282282
# Generate a permutation saving the ECX, ESP, and user defined registers
283283
loop_inst.generate(block_generator_register_blacklist, nil, state.badchars)
284-
rescue EncodingError => e
285-
raise EncodingError
284+
rescue RuntimeError, EncodingError => e
285+
# The Rex::Poly block generator can raise RuntimeError variants
286+
raise EncodingError, e.to_s
286287
end
287288
end
288289

0 commit comments

Comments
 (0)