CVE-2019-9585 eQ-3 Homematic CCU2 prior 2.47.10 and CCU3 prior 3.47.10 JSON API has Improper Access Control for Interface.***Metadata related operations, resulting in the ability to read, set and deletion of Metadata

Overview

  • CVE: CVE-2019-9585
  • Author: psytester
  • Title: eQ-3 Homematic CCU2 prior 2.47.10 and CCU3 prior 3.47.10 JSON API has Improper Access Control for Interface.***Metadata related operations, resulting in the ability to read, set and deletion of Metadata
  • Vulnerability Type: CWE-284: Improper Access Control
  • CVSSv3 Base Score: 9.9
  • CVSSv3 Vector: CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:H/A:L
  • Publishing Date: 26.07.2019
  • Updated: –
  • Vendor: eQ-3 AG
  • Product: Homematic CCU2 and CCU3
  • Vendor contacted: 12.04.2019
  • Vendor confirmation: N.A.
  • Vendor patch: CCU2 2.47.10 and CCU3 3.47.10
  • Vendor Reference: [HMCCU-261] in changelog of CCU2 and CCU3
  • Affected Firmware version of CCU2: 2.35.16, 2.41.5, 2.41.8, 2.41.9, 2.45.6, 2.45.7 tested
  • Affected Firmware version of CCU3: 3.41.11, 3.43.16, 3.45.5, 3.45.7 tested

Background

From vendor’s website for CCU2:
HomeMatic Central Control Unit CCU2

Homematic Central Control Unit is the central element of your Homematic system, offering a whole range of control, monitoring and configuration options for all the Homematic devices in your installation
[….]

From vendor’s website for CCU3:
The Central Control Unit CCU3 is the central element for local control of the Homematic IP smart home system. It represents the next generation of our proven Homematic Central Control Units CCU1 and CCU2. Operation via the Central Control Unit CCU3 can be used alternatively to the Homematic IP Access Point. While the Access Point establishes the connection to the free Homematic IP cloud and enables operation of the smart home system via a smartphone app, the Central Control Unit CCU3 works locally via a browser-based web interface (WebUI). Thanks to local configuration and operation as well as the option to create direct device connections, reliable and fail-proof operation of the smart home system is guaranteed at all times – even in the event of Internet failures.
[….]

Past eQ-3 press release about taking security updates seriously (in German only):
[…]
eQ-3 ist es wichtig, dass auch solche Lücken geschlossen werden, die für die meisten Installationen keine Rolle spielen.
[…]
Obwohl nur Nutzer betroffen sind, die gegen Sicherheitshinweise von eQ-3 verstoßen oder seit mehreren Jahren keine Sicherheitsupdates installiert haben, gibt eQ-3 solchen Fällen hohe Priorität und behebt entsprechende Sicherheitslücken schnellstmöglich nach Bekanntwerden in neuen Software-Versionen und Hotfixes.
[…]

Issue Description

While analyzing the implementation of the CCU2 and CCU3, an Improper Access Control vulnerability has been identified, which can be exploited in order to retrieve, modify or delete internal MetaData.
The system provides a JSON API. While some methods require a dedicated user access level identified by provided sessionID, a number of methods can also be used with any string as sessionID.

A code review of the file /www/api/methods.conf revealed that the Interface.setMetadata / Interface.getMetadata and Interface.removeMetadata method can be used without valid authentication.
They require the session_id parameter, but due to LEVEL NONE the SessionID value is never checked.

Interface.setMetadata {
  LEVEL NONE
  SCRIPT_FILE interface/setmetadata.tcl
  INFO {Setzt ein Metadatum zu einem Object}
  ARGUMENTS {_session_id_ objectId dataId value}
}
 

Interface.getMetadata {
  LEVEL NONE
  SCRIPT_FILE interface/getmetadata.tcl
  INFO {Gibt ein Metadatum zu einem Object zurück}
  ARGUMENTS {_session_id_ objectId dataId}
}

Interface.removeMetadata {
  LEVEL NONE
  SCRIPT_FILE interface/removemetadata.tcl
  INFO {Entfernt ein Metadatum eines Objects}
  ARGUMENTS {_session_id_ objectId dataId}
}

Example method call without valid sessionID:

curl -X POST -k -i 'https://1.2.3.4/api/homematic.cgi' --data '{
  "version": "1.1",
  "method": "Interface.getMetadata",
  "params": {
    "_session_id_": "@unknownvalue@",
    "objectId": ".....",
	"dataId": "....."
  }
}'

If those Metadata gots corrupt by an attack, the WebUI is no longer able to show or modify the details of a device. Settings–>Devices–> select “HM-RCV-50 BidCoS-RF” and press “Set” button might show up such error message:

Das Gerät mit der Seriennummer 'BidCoS-RF' vom Interface 'systemHacked' konnte nicht abgefragt werden!

CVE

CVE-2019-9585

CVSSv3 Base Score

CVSSv3 Base Score: 9.9

CVSSv3 Vector: CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:H/A:L

Credit

psytester

Not owning an original CCU2 or CCU3, but you want to analyze the CCU ‘for free’?
You can download
piVCCU for running the original CCU3 Firmware in lxc container on RaspberryPi
RaspberryMatic for running the opensource OCCU based release on different boards

Disclaimer

The information provided is released “as is” without warranty of any kind. The publisher disclaims all warranties, either express or implied, including all warranties of merchantability. No responsibility is taken for the correctness of this information. In no event shall the publisher be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages, even if the publisher has been advised of the possibility of such damages.

The contents of this advisory are copyright (c) 2019 by psytester and may be distributed freely provided that no fee is charged for this distribution and proper credit is given.

Written on July 26, 2019