TL;DR
- A SQLi exists in the probe code of all Connectwise Automate versions before 2020.7 or 2019.12 (with patch applied)
- SQLi allows arbitrary update to any data in the database
- Data extraction is also possible
- Combined with CVE-2020-15027 any instance with network probe enabled is vulnerable to full takeover
- Patched in 2020.7 and in a hotfix for 2019.12
Introduction
A SQL Injection in the probe implementation to save data to a custom table exists due to inadequate server side validation. As the code creates dynamic SQL for the insert statement and utilizes the user supplied table name with little validation, the table name can be modified to allow arbitrary update commands to be run. Usage of other SQL injection techniques such as timing attacks, it is possible to perform full data extraction as well.
Summary
- Risk: Critical
- Patched: Yes
- CVE: CVE-2020-15027
- Complexity: Medium (Requires access to a probe computer)
- Type: SQL Injection
Scoring
- CVSS 3.1 Base Score: 8.5
- CVSS 3.1 Vector String: CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:H/E:F/RL:O/RC:C/CR:H/IR:H/AR:H/MAV:N/MAC:H/MPR:H/MUI:N/MS:C/MC:H/MI:H/MA:H
- CVSS 3.1 Temporal Score: 7.9
- CVSS 3.1 Environmental Score: 7.5
Timeline
- 2020-06-11
- Detail provided to Connectwise
- Automatic ticket received
- 2020-06-12
- Vendor Acknowledges receipt
- 2020-07-02
- Patch released in 2020.7 and hotfix for 2019.12
- 2020-07-08
- Information on vulnerability released
Details
The connectwise probe supports saving data to a custom table. The server side implementation which supports that custom data implementation lacks sufficient validation of user provided data in consutruction of the SQL commands. As a result arbitrary update commands can be run against the database.
For example, sending this payload will error out and cause the MySQL version to be returned:
<LTS><Meta><ci>@COMPID@</ci><pw>@PW@</pw><v>200.81</v><cid>59</cid><lid>88</lid><cmd>109</cmd><scmd /><status>0</status></Meta><Data><deviceid>1682</deviceid><tablename>probe_events` SET eventmessage=1 OR UPDATEXML(1,CONCAT(0x7e,(VERSION())),0) OR '1' WHERE probeid =2 AND eventtime = '2020-05-22 00:25:48' #</tablename><datacount>1</datacount><keycount>1</keycount><keycolumn1>eventtime</keycolumn1><keydata1>2020-05-22 00:25:48</keydata1><column1>eventmessage</column1><data1>1</data1></Data><Status><ProbeScanState>Discovery Scan completed in 0 hrs 29 mins 56 secs.</ProbeScanState></Status></LTS>