2008-09-15 18:50:34 +00:00
|
|
|
##
|
2008-10-23 02:43:21 +00:00
|
|
|
# $Id$
|
2008-09-15 18:50:34 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
##
|
2010-02-19 05:18:43 +00:00
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
2008-09-15 18:50:34 +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/
|
2008-09-15 18:50:34 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
class Metasploit3 < Msf::Exploit::Remote
|
2008-09-15 18:50:34 +00:00
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
include Msf::Exploit::Remote::Tcp
|
2008-09-15 18:50:34 +00:00
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
|
|
|
'Name' => 'MIPS Aggressive Test Exploit',
|
2010-03-10 05:58:01 +00:00
|
|
|
'Description' => 'This module tests the exploitation of a test service',
|
2009-09-27 21:30:45 +00:00
|
|
|
'Author' => ['skape', 'Julien Tinnes <julien[at]cr0.org>'],
|
2008-09-15 18:50:34 +00:00
|
|
|
'License' => MSF_LICENSE,
|
2008-10-23 02:43:21 +00:00
|
|
|
'Version' => '$Revision$',
|
2008-09-15 18:50:34 +00:00
|
|
|
#'Arch' => ARCH_MIPSBE,
|
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'MaxNops' => 0,
|
|
|
|
#'BadChars' => "\x00",
|
|
|
|
#'StackAdjustment' => -3500,
|
|
|
|
},
|
2010-02-19 05:18:43 +00:00
|
|
|
'Targets' =>
|
2008-09-15 18:50:34 +00:00
|
|
|
[
|
|
|
|
# Target 0: Universal
|
2010-02-19 05:18:43 +00:00
|
|
|
[
|
2008-09-15 18:50:34 +00:00
|
|
|
'Mips big endian',
|
|
|
|
{
|
|
|
|
'Platform' => [ 'linux', 'win' ],
|
|
|
|
'Arch' => ARCH_MIPSBE
|
|
|
|
}
|
|
|
|
],
|
2010-02-19 05:18:43 +00:00
|
|
|
[
|
2008-09-15 18:50:34 +00:00
|
|
|
'Mips big endian cannot be encoded',
|
|
|
|
{
|
|
|
|
'Platform' => [ 'linux', 'win' ],
|
|
|
|
'Arch' => ARCH_MIPSBE,
|
2010-02-19 05:18:43 +00:00
|
|
|
'Payload' =>
|
2008-09-15 18:50:34 +00:00
|
|
|
{
|
|
|
|
'BadChars' => (0..255).to_a.map { |x| x.chr }.to_s
|
|
|
|
}
|
|
|
|
}
|
|
|
|
], [
|
|
|
|
'Mips big endian encoder needed',
|
|
|
|
{
|
|
|
|
'Platform' => [ 'linux', 'win' ],
|
|
|
|
'Arch' => ARCH_MIPSBE,
|
2010-02-19 05:18:43 +00:00
|
|
|
'Payload' =>
|
2008-09-15 18:50:34 +00:00
|
|
|
{
|
|
|
|
'BadChars' => "\x00"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
2010-02-19 05:18:43 +00:00
|
|
|
[
|
2008-09-15 18:50:34 +00:00
|
|
|
'Mips little endian',
|
|
|
|
{
|
|
|
|
'Platform' => [ 'linux', 'win' ],
|
|
|
|
'Arch' => ARCH_MIPSLE
|
|
|
|
}
|
|
|
|
],
|
2010-02-19 05:18:43 +00:00
|
|
|
[
|
2008-09-15 18:50:34 +00:00
|
|
|
'Mips little endian cannot be encoded',
|
|
|
|
{
|
|
|
|
'Platform' => [ 'linux', 'win' ],
|
|
|
|
'Arch' => ARCH_MIPSLE,
|
2010-02-19 05:18:43 +00:00
|
|
|
'Payload' =>
|
2008-09-15 18:50:34 +00:00
|
|
|
{
|
|
|
|
'BadChars' => (0..255).to_a.map { |x| x.chr }.to_s
|
|
|
|
}
|
|
|
|
}
|
|
|
|
], [
|
|
|
|
'Mips little endian encoder needed',
|
|
|
|
{
|
|
|
|
'Platform' => [ 'linux', 'win' ],
|
|
|
|
'Arch' => ARCH_MIPSLE,
|
2010-02-19 05:18:43 +00:00
|
|
|
'Payload' =>
|
2008-09-15 18:50:34 +00:00
|
|
|
{
|
|
|
|
'BadChars' => "\x00"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
'DefaultTarget' => 0))
|
|
|
|
|
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
OptBool.new('WaitForInput', [ false, "Wait for user input before returning from exploit", false ]),
|
|
|
|
OptInt.new('TestInteger', [ false, "Testing an integer value", nil ])
|
|
|
|
])
|
|
|
|
end
|
|
|
|
|
2010-02-19 05:18:43 +00:00
|
|
|
|
|
|
|
def autofilter
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
2008-09-15 18:50:34 +00:00
|
|
|
def check
|
|
|
|
return Exploit::CheckCode::Vulnerable
|
|
|
|
end
|
|
|
|
|
|
|
|
def exploit
|
|
|
|
# Show disassembled payload for context encoder test
|
|
|
|
if target.name =~ /context encoder/
|
|
|
|
#puts Rex::Assembly::Nasm.disassemble(payload.encoded[0,40])
|
|
|
|
#FIXME: do this with metasm for MIPS (import new metasm version which fixes current bug!)
|
|
|
|
end
|
|
|
|
|
|
|
|
connect
|
|
|
|
|
|
|
|
print_status("Sending #{payload.encoded.length} byte payload...[#{datastore['TestInteger']}]")
|
|
|
|
|
|
|
|
sock.put(payload.encoded)
|
|
|
|
|
|
|
|
if (datastore['WaitForInput'])
|
|
|
|
puts "Type something..."
|
|
|
|
gets
|
|
|
|
end
|
|
|
|
|
|
|
|
handler
|
|
|
|
end
|
|
|
|
|
2009-09-27 21:30:45 +00:00
|
|
|
end
|