Difference between revisions of "Matter"

From Embedded Lab Vienna for IoT & Security
Jump to navigation Jump to search
 
(5 intermediate revisions by one other user not shown)
Line 1: Line 1:
[[File:Matter_logo.jpg|thumb|Logo of Matter<ref name="logo"/>]]
[[File:Matter_logo.jpg|thumb|Logo of Matter<ref name="logo"/>]]


'''Matter''' ist ein offener Standard, der von der Arbeitsgruppe "Project Connected Home over IP" (kurz CHIP) seit 2019 entwickelt und im Oktober 2022 erstmals publiziert wurde. Er soll die Kommunikation zwischen Geräten diverser Hersteller wie Google, Samsung, Apple und Amazon ermöglichen und damit die Grenzen bestehender Smart-Home Netze erweitern.
'''Matter''' is an open standard that has been developed by the "Project Connected Home over IP" (CHIP) working group since 2019 and was first published in October 2022. It is intended to enable communication between devices from various manufacturers such as Google, Samsung, Apple and Amazon, thereby extending the boundaries of existing smart home networks.


== Protokoll ==
== Protocol ==


Es handelt sich um ein Application-Layer-Protokoll, welches auf Netzwerkprotokolle wie IPv6, Thread und BLE aufsetzt. Um von IP-Netzwerken auf z.B. Thread- oder BLE-basierte Geräte zugreifen zu können werden Bridges benötigt, welche die Netzwerklayer übersetzen.
It is an application layer protocol that is based on network protocols such as IPv6, Thread and BLE. Bridges are required to translate the network layers in order to be able to access Thread- or BLE-based devices from IP networks.
 
The Google Developer Center offers general documentation<ref name="matter-info" /> for Matter, which explains, for example, how a new device can connect to the Matter network.




[[File:Primer-matter-architecture.png|The Matter Stack in the TCP/IP and OSI Model]]
[[File:Primer-matter-architecture.png|The Matter Stack in the TCP/IP and OSI Model]]


== Matter Virtual Device ==
== Matter Virtual Device ==
Das Google Developer Center stellt Resourcen zur Entwicklung von Matter-basierten Geräten wie einer Sample App zum Verbinden von Matter-Geräten <ref name="sample-app" /> oder virtuellen Matter-Geräten <ref name="virtual-device" /> zum Testen der Schnittstellen bereit.
The Google Developer Center provides resources for the development of Matter-based devices such as a sample app for connecting Matter devices <ref name="sample-app" /> or virtual Matter devices <ref name="virtual-device" /> for testing the interfaces.


Ein Matter Virtual Device (MVD) ist eine Emulation eines Matter Devices und simuliert das Verhalten eines Gerätes z.B. das Ein-/Ausschalten eines Lichtschalters.
A Matter Virtual Device (MVD) is an emulation of a Matter device and simulates the behavior of a device, e.g. switching a light switch on/off.


=== Möglichkeiten ===
=== Possibilities ===
Das Virtual Device kann man über mehrere Wege bauen und starten. Dazu wurden insgesamt drei Möglichkeiten gefunden:
The virtual device can be built and started in several ways. A total of three possibilities have been found:


* Standalone
* Standalone
Line 23: Line 24:
* GitHub Repository
* GitHub Repository


Es hat sich herausgestellt, dass das Standalone am Besten geeignet ist, um schnell ein MVD einzurichten. Dazu wird eine Umgebung mit einem 64-bit x86 Prozessor und mindestens Debian 11, Ubuntu 20.04 oder MacOS benötigt.
It turned out that the standalone is the best way to quickly set up an MVD. This requires an environment with a 64-bit x86 processor and at least Debian 11, Ubuntu 20.04 or MacOS.


==== GitHub Repository ====
==== GitHub Repository ====


# git clone https://github.com/project-chip/connectedhomeip
# git clone https://github.com/project-chip/connectedhomeip
# Initialisieren des Matter-Projektes durch "source scripts/activate.sh"
# Initialize the Matter project using "source scripts/activate.sh"
Diese Variante wurde nicht weiter verfolgt, da das Repository rekursiv aufgelöst wird und das Klonen und Ausführen daher sehr viel Zeit in Anspruch nimmt.
This variant was not pursued further, as the repository is resolved recursively and execution takes a lot of time.


==== Docker Image Repository ====
==== Docker Image Repository ====


# docker pull us-docker.pkg.dev/nest-matter/docker-repo/virtual-device-image:latest
# docker pull us-docker.pkg.dev/nest-matter/docker-repo/virtual-device-image:latest
Dieser Ansatz lädt ein Docker Image herunter, welches größer als 10GB ist. Entpackt hat es dann mehr als 30GB und ist daher als schneller Ansatz für die Entwicklung mit Matter-Geräten ebenfalls nicht tauglich.
This approach downloads a Docker image that is larger than 10GB. Unpacked, it then has more than 30GB and is therefore also not suitable as a fast approach for development with Matter devices.


==== Standalone ====
==== Standalone ====
Das Standalone-Matter-Device wurde relativ neu von Google publiziert, lässt sich aber sehr einfach aufsetzen. Durch seine vergleichsweise geringe Größe mit weniger als 70MB ist es einfach herunterzuladen und ist innerhalb weniger Minuten lauffähig.
The standalone Matter device was published relatively recently by Google, but is very easy to set up. Due to its comparatively small size of less than 70MB, it is easy to download and can be up and running within a few minutes.


https://i.imgur.com/Rjqabwb.png
https://i.imgur.com/Rjqabwb.png


<b>Installationsschritte (Debian/Ubuntu)</b>
<b>Installation steps (Debian/Ubuntu)</b>
# wget https://dl.google.com/mvd/mvd_1.3.0_amd64.deb
# wget https://dl.google.com/mvd/mvd_1.3.0_amd64.deb
# sudo dpkg -i mvd_1.3.0_amd64.deb
# sudo dpkg -i mvd_1.3.0_amd64.deb
# mvd
# mvd


Es öffnet sich eine GUI, womit man ein MVD erstellen kann.
A GUI opens with which you can create an MVD.


[[File:MVD-Create.png|500px]]
[[File:MVD-Create.png|500px]]


Beim neuen Fenster kann man einige Einstellungen bezüglich des Gerätes konfigurieren:
In the new window, you can configure some settings for the device:


# Device Type - Man kann mehrere Arten von Smart Home Geräten simulieren
# Device Type - You can simulate several types of smart home devices
# Vendor ID - Eindeutige zertifierte ID für den Händler (Mögliche Werte in der Entwicklung: <b>0xFFF1, 0xFFF2, 0xFFF3 and 0xFFF4</b>)
# Vendor ID - Unique certified ID for the vendor (possible values in development: <b>0xFFF1, 0xFFF2, 0xFFF3 and 0xFFF4</b>)
# Product ID - Eindeutige zertifizierte ID für das Produkt (Mögliche Werte in der Entwicklung: <b>0x8000 bis 0x801F</b>)
# Product ID - Unique certified ID for the product (possible values in development: <b>0x8000 to 0x801F</b>)
# Discriminator - Im Fall, dass im Netzwerk das gleiche Produkt mehrmals auftritt, kann über den Discriminator unterschieden werden.
# Discriminator - If the same product occurs several times in the network, the discriminator can be used to differentiate between them.


=== Controller GUI ===
=== Controller GUI ===
Um mit dem Matter Device zu kommunizieren, wird eine GUI benötigt. Dazu gibt es wieder zwei Möglichkeiten:
A GUI is required to communicate with the Matter device. There are two options for this:


==== Internal GUI über RPC ====
==== Internal GUI via RPC ====
Das Standalone MVD wird mit einer integrierten GUI geliefert, wobei das Gerät auf einem anderen Port (RPC-Port: 33000) angesprochen wird, als den Matter Port (Matter-Port: 5540).
The standalone MVD is supplied with an integrated GUI, whereby the device is addressed on a different port (RPC port: 33000) than the Matter port (Matter port: 5540).
Sobald das MVD erstellt wurde, öffnet sich die Control-UI für das simulierte Gerät.
As soon as the MVD has been created, the control UI for the simulated device opens.


[[File:MVD-GUI.png|500px]]
[[File:MVD-GUI.png|500px]]


==== GUI über Mobile App ====
==== GUI via Mobile App ====
Das Google Developer Center hat ein CodeLab<ref name="sample-app" /> zur Verfügung gestellt, womit man eine simple Kotlin-App für die Steuerung von Matter Geräten entwickeln kann.
The Google Developer Center has provided a CodeLab<ref name="sample-app" /> with which you can develop a simple Kotlin app for controlling Matter devices.
Dazu kann man ein Skeleton herunterladen und das Tutorial begleitet den Entwickler, um etwaige fehlende Code-Stellen zu implementieren, die mit dem Kommentar "<b>// CODELAB:</b>" versehen sind.
You can download a skeleton and the tutorial accompanies the developer to implement any missing code sections, which are marked with the comment "<b>// CODELAB:</b>".
They also offer a fully comprehensive solution to compare one's own implementation.


Diese App wurde dann mittels USB-Debugging auf ein Handy gestartet.
This app was then launched onto a mobile phone using USB debugging.


[[File:MVD-KotlinCode.png|500px]]
[[File:MVD-KotlinCode.png|500px]]
Line 81: Line 83:


=== Connection ===
=== Connection ===
Um sich am Handy mit einem Matter Gerät zu verbinden, braucht man folgende Voraussetzungen:
To connect to a Matter device on your mobile phone, you need the following prerequisites:


<li>Android Version - Version >= 8.1</li>
<li>Android Version - Version >= 8.1</li>
<li>Google Play Service - Version >= 22.36.15</li>
<li>Google Play Service - Version >= 22.36.15</li>
<li>Google Home App - Installiert</li>
<li>Google Home App - Installed</li>


==== Steps ====
==== Steps ====
<li>Zur Überprüfung, ob das Handy bereit ist, Matter Geräte zu verbinden, wird geschaut ob unter <b>Einstellungen -> Google -> Devices and Sharing</b> die Auswahl <b>Matter devices</b> existiert.</li>
<li>To check whether the mobile phone is ready to connect Matter devices, check whether the selection <b>Matter devices</b> exists under <b>Settings -> Google -> Devices and Sharing</b>. </li>
<li>Falls nicht, sollte man versuchen die Google Home App neu zu installieren, da beim Download von dieser App gleichzeitig auch die benötigten Dependencies heruntergeladen werden, um sich mit einem Matter Gerät zu verbinden.</li>
<li>If not, you should try reinstalling the Google Home app, as downloading this app also downloads the dependencies required to connect to a Matter device.</li>


[[File:Matter-DevicesAndSharing.png|250px]]
[[File:Matter-DevicesAndSharing.png|250px]]
[[File:Matter-Devices.png|250px]]
[[File:Matter-Devices.png|250px]]


<li>Sofern dieser Schritt geschafft worden ist, wird im MVD-Controller GUI ein QR-Code generiert.</li>
<li>If this step has been completed, a QR code will be generated in the MVD controller GUI.</li>


[[File:MVD-QR.png|500px]]
[[File:MVD-QR.png|500px]]


<li>Auf der App wird auf das + Symbol geklickt und es öffnet sich ein neues Fenster, wo man mit der Kamera den QR-Code scannen kann.</li>
<li>Click on the + symbol on the app and a new window will open where you can scan the QR code with the camera.</li>


[[File:Matter-Scan.png|250px]]
[[File:Matter-Scan.png|250px]]


<li>Beim Verbinden des Gerätes sollte stehen, dass es Matter Credentials erstellt, Commissioned und schlussendlich auch verbunden ist.</li>
<li>When connecting the device it should say that Matter Credentials have been created, commissioned and finally connected.</li>


[[File:Matter-Connected.png|250px]]
[[File:Matter-Connected.png|250px]]


<li></li>
=== Security aspect ===
=== Security Aspekt ===


Dieses Thema wurde im Rahmen des Wahlfachprojektes 2 vorgestellt. Die Aufgabe bestand darin, mit dem MVD einen Angriff nachzustellen und zu zeigen, dass dieser daher bereits während der Entwicklung erkennt und mitigiert werden könnte. Aufgrund der Neuheit des Standards ist dieser aber noch nicht in der Breite etabliert und daher sind auch noch wenige Vulnerabilities und Exploits bekannt. Daher konnten wir nur eine DoS Attacke ausprobieren und damit den Zugriff auf das MVD verhindern. Eine Differenzierung, ob es dabei zu einem DoS des Gerätes selbst oder der ausführenden Plattform kam, konnte nicht evaluiert werden.
This topic was presented as part of elective project 2. The task was to recreate an attack using the MVD and show that it could be detected and mitigated during development. However, due to the newness of the standard, it is not yet widely established and therefore few vulnerabilities and exploits are known. Therefore, we could only try a DoS attack and thus prevent access to the MVD. It was not possible to evaluate whether a DoS occurred on the device itself or on the executing platform.




Line 116: Line 117:
<ref name="logo">https://commons.wikimedia.org/wiki/File:Matter_logo.jpg</ref>
<ref name="logo">https://commons.wikimedia.org/wiki/File:Matter_logo.jpg</ref>
<ref name="sample-app">https://developers.home.google.com/codelabs/matter-sample-app#1</ref>
<ref name="sample-app">https://developers.home.google.com/codelabs/matter-sample-app#1</ref>
<ref name="matter-info">https://developers.home.google.com/matter/primer</ref>
<ref name="virtual-device">https://developers.home.google.com/tools/virtual-device</ref>
<ref name="virtual-device">https://developers.home.google.com/tools/virtual-device</ref>
</references>
</references>


[[Category:Documentation]]
[[Category:Documentation]]
[[Category:Basic]]

Latest revision as of 18:37, 12 March 2024

Logo of Matter[1]

Matter is an open standard that has been developed by the "Project Connected Home over IP" (CHIP) working group since 2019 and was first published in October 2022. It is intended to enable communication between devices from various manufacturers such as Google, Samsung, Apple and Amazon, thereby extending the boundaries of existing smart home networks.

Protocol

It is an application layer protocol that is based on network protocols such as IPv6, Thread and BLE. Bridges are required to translate the network layers in order to be able to access Thread- or BLE-based devices from IP networks.

The Google Developer Center offers general documentation[2] for Matter, which explains, for example, how a new device can connect to the Matter network.


The Matter Stack in the TCP/IP and OSI Model

Matter Virtual Device

The Google Developer Center provides resources for the development of Matter-based devices such as a sample app for connecting Matter devices [3] or virtual Matter devices [4] for testing the interfaces.

A Matter Virtual Device (MVD) is an emulation of a Matter device and simulates the behavior of a device, e.g. switching a light switch on/off.

Possibilities

The virtual device can be built and started in several ways. A total of three possibilities have been found:

  • Standalone
  • Docker Image
  • GitHub Repository

It turned out that the standalone is the best way to quickly set up an MVD. This requires an environment with a 64-bit x86 processor and at least Debian 11, Ubuntu 20.04 or MacOS.

GitHub Repository

  1. git clone https://github.com/project-chip/connectedhomeip
  2. Initialize the Matter project using "source scripts/activate.sh"

This variant was not pursued further, as the repository is resolved recursively and execution takes a lot of time.

Docker Image Repository

  1. docker pull us-docker.pkg.dev/nest-matter/docker-repo/virtual-device-image:latest

This approach downloads a Docker image that is larger than 10GB. Unpacked, it then has more than 30GB and is therefore also not suitable as a fast approach for development with Matter devices.

Standalone

The standalone Matter device was published relatively recently by Google, but is very easy to set up. Due to its comparatively small size of less than 70MB, it is easy to download and can be up and running within a few minutes.

Rjqabwb.png

Installation steps (Debian/Ubuntu)

  1. wget https://dl.google.com/mvd/mvd_1.3.0_amd64.deb
  2. sudo dpkg -i mvd_1.3.0_amd64.deb
  3. mvd

A GUI opens with which you can create an MVD.

MVD-Create.png

In the new window, you can configure some settings for the device:

  1. Device Type - You can simulate several types of smart home devices
  2. Vendor ID - Unique certified ID for the vendor (possible values in development: 0xFFF1, 0xFFF2, 0xFFF3 and 0xFFF4)
  3. Product ID - Unique certified ID for the product (possible values in development: 0x8000 to 0x801F)
  4. Discriminator - If the same product occurs several times in the network, the discriminator can be used to differentiate between them.

Controller GUI

A GUI is required to communicate with the Matter device. There are two options for this:

Internal GUI via RPC

The standalone MVD is supplied with an integrated GUI, whereby the device is addressed on a different port (RPC port: 33000) than the Matter port (Matter port: 5540). As soon as the MVD has been created, the control UI for the simulated device opens.

MVD-GUI.png

GUI via Mobile App

The Google Developer Center has provided a CodeLab[3] with which you can develop a simple Kotlin app for controlling Matter devices. You can download a skeleton and the tutorial accompanies the developer to implement any missing code sections, which are marked with the comment "// CODELAB:". They also offer a fully comprehensive solution to compare one's own implementation.

This app was then launched onto a mobile phone using USB debugging.

MVD-KotlinCode.png

req0VHX.png

8jGIO3T.png


Connection

To connect to a Matter device on your mobile phone, you need the following prerequisites:

  • Android Version - Version >= 8.1
  • Google Play Service - Version >= 22.36.15
  • Google Home App - Installed
  • Steps

  • To check whether the mobile phone is ready to connect Matter devices, check whether the selection Matter devices exists under Settings -> Google -> Devices and Sharing.
  • If not, you should try reinstalling the Google Home app, as downloading this app also downloads the dependencies required to connect to a Matter device.
  • Matter-DevicesAndSharing.png Matter-Devices.png

  • If this step has been completed, a QR code will be generated in the MVD controller GUI.
  • MVD-QR.png

  • Click on the + symbol on the app and a new window will open where you can scan the QR code with the camera.
  • Matter-Scan.png

  • When connecting the device it should say that Matter Credentials have been created, commissioned and finally connected.
  • Matter-Connected.png

    Security aspect

    This topic was presented as part of elective project 2. The task was to recreate an attack using the MVD and show that it could be detected and mitigated during development. However, due to the newness of the standard, it is not yet widely established and therefore few vulnerabilities and exploits are known. Therefore, we could only try a DoS attack and thus prevent access to the MVD. It was not possible to evaluate whether a DoS occurred on the device itself or on the executing platform.