Skip to content

Commit ebacb26

Browse files
committed
Land rapid7#3838, msfvenom badchar fix
2 parents 8a0f86f + d9a713b commit ebacb26

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/msf/core/payload_generator.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,9 @@ def run_encoder(encoder_module, shellcode)
364364
iterations.times do |x|
365365
shellcode = encoder_module.encode(shellcode.dup, badchars, nil, platform_list)
366366
cli_print "#{encoder_module.refname} succeeded with size #{shellcode.length} (iteration=#{x})"
367-
raise EncoderSpaceViolation, "encoder has made a buffer that is too big" if shellcode.length > space
367+
if shellcode.length > space
368+
raise EncoderSpaceViolation, "encoder has made a buffer that is too big"
369+
end
368370
end
369371
shellcode
370372
end

msfvenom

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ require 'msf/core/payload_generator'
9999
end
100100

101101
opt.on('-b', '--bad-chars <list>', String, 'The list of characters to avoid example: \'\x00\xff\'') do |b|
102-
opts[:badchars] = b
102+
opts[:badchars] = Rex::Text.hex_to_raw(b)
103103
end
104104

105105
opt.on('-i', '--iterations <count>', Integer, 'The number of times to encode the payload') do |i|

0 commit comments

Comments
 (0)