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
|
|
|
##
|
|
|
|
|
|
|
|
##
|
2010-02-19 05:18:43 +00:00
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
2007-02-18 00:10:39 +00:00
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
|
|
|
# Framework web site for more information on licensing and terms of use.
|
2009-04-13 14:33:26 +00:00
|
|
|
# http://metasploit.com/framework/
|
2007-02-18 00:10:39 +00:00
|
|
|
##
|
|
|
|
|
2005-07-14 07:32:11 +00:00
|
|
|
require 'msf/core'
|
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
class Metasploit3 < Msf::Exploit::Remote
|
2005-07-14 07:32:11 +00:00
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
include Msf::Exploit::Remote::Tcp
|
2005-07-14 07:32:11 +00:00
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
|
|
|
'Name' => 'Internal Aggressive Test Exploit',
|
2010-02-19 05:18:43 +00:00
|
|
|
'Description' =>
|
2005-07-14 07:32:11 +00:00
|
|
|
"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",
|
2008-05-26 06:34:12 +00:00
|
|
|
'StackAdjustment' => -3500,
|
2005-07-14 07:32:11 +00:00
|
|
|
},
|
2010-02-19 05:18:43 +00:00
|
|
|
'Targets' =>
|
2005-07-14 07:32:11 +00:00
|
|
|
[
|
|
|
|
# Target 0: Universal
|
2010-02-19 05:18:43 +00:00
|
|
|
[
|
2005-07-14 07:32:11 +00:00
|
|
|
'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' ],
|
2010-02-19 05:18:43 +00:00
|
|
|
'Payload' =>
|
2006-01-06 02:25:23 +00:00
|
|
|
{
|
|
|
|
'BadChars' => (0..255).to_a.map { |x| x.chr }.to_s
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
2010-02-19 05:18:43 +00:00
|
|
|
[ 'Test context encoder',
|
|
|
|
{
|
2007-08-31 04:01:30 +00:00
|
|
|
'Platform' => [ 'linux', 'win' ],
|
|
|
|
'Payload' =>
|
2010-02-19 05:18:43 +00:00
|
|
|
{
|
2007-08-31 04:01:30 +00:00
|
|
|
'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
|
|
|
|
|
2010-02-19 05:18:43 +00:00
|
|
|
|
|
|
|
def autofilter
|
|
|
|
false
|
|
|
|
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
|
|
|
|
|
2010-02-19 05:18:43 +00:00
|
|
|
end
|