2007-02-18 00:10:39 +00:00
|
|
|
##
|
2007-08-31 04:01:30 +00:00
|
|
|
# $Id$
|
2007-02-18 00:10:39 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
##
|
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
|
|
|
# Framework web site for more information on licensing and terms of use.
|
|
|
|
# http://metasploit.com/projects/Framework/
|
|
|
|
##
|
|
|
|
|
|
|
|
|
2005-07-14 07:32:11 +00:00
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
module Msf
|
2006-10-10 06:44:15 +00:00
|
|
|
module Exploits
|
|
|
|
module Test
|
2005-07-14 07:32:11 +00:00
|
|
|
|
2006-10-10 06:44:15 +00:00
|
|
|
class Aggressive < Msf::Exploit::Remote
|
2005-07-14 07:32:11 +00:00
|
|
|
|
|
|
|
include Exploit::Remote::Tcp
|
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
|
|
|
'Name' => 'Internal Aggressive Test Exploit',
|
|
|
|
'Description' =>
|
|
|
|
"This module tests the exploitation of a test service.",
|
|
|
|
'Author' => 'skape',
|
2006-01-21 22:10:20 +00:00
|
|
|
'License' => MSF_LICENSE,
|
2007-02-18 00:10:39 +00:00
|
|
|
'Version' => '$Revision$',
|
2006-08-26 02:13:25 +00:00
|
|
|
'Arch' => 'x86',
|
2005-07-14 07:32:11 +00:00
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'Space' => 1000,
|
|
|
|
'MaxNops' => 0,
|
2005-07-18 04:07:56 +00:00
|
|
|
'BadChars' => "\x00",
|
2005-07-26 02:01:27 +00:00
|
|
|
'Prepend' => "\x81\xc4\x54\xf2\xff\xff", # add esp, -3500
|
2005-07-14 07:32:11 +00:00
|
|
|
},
|
|
|
|
'Targets' =>
|
|
|
|
[
|
|
|
|
# Target 0: Universal
|
|
|
|
[
|
|
|
|
'Any Platform',
|
|
|
|
{
|
2005-07-15 22:30:04 +00:00
|
|
|
'Platform' => [ 'linux', 'win' ]
|
|
|
|
}
|
2005-07-14 07:32:11 +00:00
|
|
|
],
|
2006-01-06 02:25:23 +00:00
|
|
|
[
|
|
|
|
'Test encoder specific',
|
|
|
|
{
|
|
|
|
'Platform' => [ 'linux', 'win' ],
|
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'EncoderType' => Msf::Encoder::Type::AlphanumUpper,
|
|
|
|
'EncoderOptions' =>
|
|
|
|
{
|
|
|
|
'BufferRegister' => 'EBX',
|
|
|
|
'BufferOffset' => 4
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Cannot be encoded',
|
|
|
|
{
|
|
|
|
'Platform' => [ 'linux', 'win' ],
|
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'BadChars' => (0..255).to_a.map { |x| x.chr }.to_s
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
2007-08-31 04:01:30 +00:00
|
|
|
[ 'Test context encoder',
|
|
|
|
{
|
|
|
|
'Platform' => [ 'linux', 'win' ],
|
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'BadChars' => "\x00"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
2005-07-14 07:32:11 +00:00
|
|
|
],
|
|
|
|
'DefaultTarget' => 0))
|
2006-01-06 02:25:23 +00:00
|
|
|
|
|
|
|
register_options(
|
|
|
|
[
|
2007-10-02 03:24:21 +00:00
|
|
|
OptBool.new('WaitForInput', [ false, "Wait for user input before returning from exploit", false ]),
|
|
|
|
OptInt.new('TestInteger', [ false, "Testing an integer value", nil ])
|
2006-01-06 02:25:23 +00:00
|
|
|
])
|
2005-07-14 07:32:11 +00:00
|
|
|
end
|
|
|
|
|
2005-07-14 20:36:34 +00:00
|
|
|
def check
|
|
|
|
return Exploit::CheckCode::Vulnerable
|
|
|
|
end
|
|
|
|
|
2005-07-14 07:32:11 +00:00
|
|
|
def exploit
|
2007-08-31 04:01:30 +00:00
|
|
|
# Show disassembled payload for context encoder test
|
|
|
|
if target.name =~ /context encoder/
|
|
|
|
puts Rex::Assembly::Nasm.disassemble(payload.encoded[0,40])
|
|
|
|
end
|
|
|
|
|
2005-07-15 23:46:05 +00:00
|
|
|
connect
|
|
|
|
|
2007-10-02 03:24:21 +00:00
|
|
|
print_status("Sending #{payload.encoded.length} byte payload...[#{datastore['TestInteger']}]")
|
2005-07-16 07:32:11 +00:00
|
|
|
|
2005-07-15 23:46:05 +00:00
|
|
|
sock.put(payload.encoded)
|
2006-01-06 02:25:23 +00:00
|
|
|
|
|
|
|
if (datastore['WaitForInput'])
|
|
|
|
puts "Type something..."
|
|
|
|
gets
|
|
|
|
end
|
|
|
|
|
2005-07-15 23:46:05 +00:00
|
|
|
handler
|
2005-07-14 07:32:11 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
2006-10-10 06:44:15 +00:00
|
|
|
end
|
|
|
|
end
|