Difference between revisions of "Matter"

From Embedded Lab Vienna for IoT & Security
Jump to navigation Jump to search
 
(16 intermediate revisions by 2 users 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.


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.
== 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<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 21: Line 24:
* GitHub Repository
* GitHub Repository


Es hat sich herausgestellt, dass das Standalone am Besten geeignet ist, um schnell ein MVD einzurichten. Bei den anderen Möglihckeiten kann es sehr lange dauern.
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.
Das Set-U


==== GitHub Repository ====
==== GitHub Repository ====
1. git clone https://github.com/project-chip/connectedhomeip
 
2. Initialisieren des Matter-Projektes durch "source scripts/activate.sh"
# git clone https://github.com/project-chip/connectedhomeip
3. Ab hier aufgehört, da dieses Skript viel zu lange dauert.
# Initialize the Matter project using "source scripts/activate.sh"
// Bilder
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 ====
1. docker pull us-docker.pkg.dev/nest-matter/docker-repo/virtual-device-image:latest
 
2. Ab hier aufgehört, weil Gesamtimage 30.8 GB groß ist und nicht feasible für Constraint Devices
# docker pull us-docker.pkg.dev/nest-matter/docker-repo/virtual-device-image:latest
// Bilder
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 ====
https://developers.home.google.com/matter/tools/virtual-device#install_mvd
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


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


A GUI opens with which you can create an MVD.
[[File:MVD-Create.png|500px]]
In the new window, you can configure some settings for the device:
# Device Type - You can simulate several types of smart home devices
# Vendor ID - Unique certified ID for the vendor (possible values in development: <b>0xFFF1, 0xFFF2, 0xFFF3 and 0xFFF4</b>)
# Product ID - Unique certified ID for the product (possible values in development: <b>0x8000 to 0x801F</b>)
# Discriminator - If the same product occurs several times in the network, the discriminator can be used to differentiate between them.


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


==== Internal GUI über RPC ====
==== Internal GUI via RPC ====
Lorem Ipsum
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.


Bild
[[File:MVD-GUI.png|500px]]
 
==== GUI via Mobile App ====
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.
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.
 
This app was then launched onto a mobile phone using USB debugging.
 
[[File:MVD-KotlinCode.png|500px]]
 
https://i.imgur.com/req0VHX.png
 
https://i.imgur.com/8jGIO3T.png


==== GUI über Mobile App ====
Lorem Ipsum
Kotlin
Codelab




=== Connection ===
=== Connection ===
==== Prerequisites ====
To connect to a Matter device on your mobile phone, you need the following prerequisites:
Android Version
 
Google Play Version
<li>Android Version - Version >= 8.1</li>
Google Home App
<li>Google Play Service - Version >= 22.36.15</li>
<li>Google Home App - Installed</li>


==== Steps ====
==== Steps ====
Get QR Code or Code from Logs
<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>
Scan QR or put in manual Code
<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>
Connected
 
[[File:Matter-DevicesAndSharing.png|250px]]
[[File:Matter-Devices.png|250px]]
 
<li>If this step has been completed, a QR code will be generated in the MVD controller GUI.</li>
 
[[File:MVD-QR.png|500px]]


==== Security Aspekt ====
<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]]


<li>When connecting the device it should say that Matter Credentials have been created, commissioned and finally connected.</li>
[[File:Matter-Connected.png|250px]]
=== 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.




Line 79: 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: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.