security/sensor-threat.html · security/sensor-threat.rst 공식 원문 ↗

Zephyr 3.7.0 · Security

Sensor Device Threat Model

Sensor에서 cloud까지 data와 update가 이동하는 모든 경계를 자산·공격·보호 조건으로 연결합니다.

Official pathsecurity/sensor-threat.html
Source filesecurity/sensor-threat.rst
Source versionZephyr 3.7.0
TranslationFull · reviewed

본문 기준: Zephyr 3.7.0 LTS3 · 이후 유지보수 패치는 별도입니다.

Part 1

요약·해설

이 threat model은 단순히 TLS 사용을 권하는 문서가 아닙니다. Immutable bootloader에서 시작해 signed atomic update, client secret 격리, certificate·time 검증, entropy source, provisioning과 폐기까지 device lifecycle 전체의 trust condition을 정의합니다.

Assets

8 protected assets

Boundaries

Flash · Bus · TLS · Time

Requirements

18 traceable threats

Part 2

접을 수 있는 영어 원문 전체

영어 원문 전체 펼치기
원문 SHA-256 3D0077D98CB967B888C914FC71626BE21DAAE78DF812398D125FA91B81CF1CFB
.. _sensor-threat:

Sensor Device Threat Model
##########################

This document describes a threat model for an IoT sensor device.
Spelling out a threat model helps direct development effort, and can
be used to help prioritize these efforts as well.

This device contains a sensor of some type (for example temperature, or a
pressure in a pipe), which sends this data to an SoC running a
microcontroller. This microcontroller connects to a cloud service, and
relays this sensor data to this service. The cloud service is also able
to send configuration data to the device, as well as software update
images. A general diagram can be seen in Figure 1:

.. figure:: ../../../security/media/sensor-model.svg

   Figure 1. Sensor General Diagram

In this sensor device, the sensor connects with the SoC via an SPI bus,
and the SoC has a network interface that it uses to communicate with the
cloud service. The particulars of these interfaces can impact the threat
model in unexpected ways, and variants on this will need to be
considered (for example, using a separate network interface SoC
connected via some type of bus).

This model also focuses on communicating via the MQTT-over-TLS protocol,
as this seems to be in wide use [1]_.

Assets
======

One aspect of the threat model to consider are assets involved in the
operation of the device. The following list enumerates the assets
included in this model:

1. **The bootloader**. This is a small code/data image contained in
   on-device flash that is the first code to run. In order to establish
   a root of trust, this image must be immutable. This model assumes
   that the SoC provides a mechanism to protect a region of the flash
   from future writes, and that this will be done after this image is
   programmed into the device, early in production [th-imboot]_.

2. **The application firmware image**. This asset consists of the
   remainder of the firmware run by the microcontroller. The distinction
   is made because this part of the image will need to be updated
   periodically as security vulnerabilities are discovered. Requirements
   for updates to this image are:

   a. The image shall only be replaced with an authorized image
      [th-authrepl]_.

   b. When an authorized replacement image is available, the update
      shall be done in a timely manner [th-timely-update]_.

   c. The image update shall be seen as atomic, meaning that when the
      image is run, the flash shall contain either the update image in
      its entirety, or the old image in its entirety
      [th-atomic-update]_.

3. **Root certificate list**. In order to authenticate the cloud service
   (server), the IoT device must have a list of root certificates that
   are allowed to sign the certificate on the server. For cloud-provider
   based services, this list will generally be provided by the service
   provider. Because the root certificates can expire, and possibly be
   revoked, this list will need to be periodically updated
   [th-root-certs]_, [th-root-check]_.

4. **Client secrets**. To authenticate the client to the service, the
   client must possess some kind of secret. This is generally a private
   key, usually either an RSA key or an EC private key. When
   establishing communication with the server, the device will use
   this secret either as part of the TLS establishment, or to sign a
   message used in the communication.

   This secret is generally generated by the service provider, or by
   software running elsewhere, and must be securely installed on the
   device. Policy may dictate that this secret be replaced
   periodically, which will require a way to update the client secret.
   Typically, the service will allow two or three active keys to allow
   this update to proceed while the old key is used.

   These secrets must be protected from read, and the smallest amount
   of code necessary shall have access to them. [th-secret-storage]_

5. **Current date/time**. TLS certificate verification requires
   knowledge of the current date and time in order to determine if the
   current time falls within the certificate's current validity time.
   Also, token based client authentication will generally require the
   client to sign a message containing a time window that the token is
   valid. Certificate validation requires the device's notion of date and
   time to be accurate within a day or so. Token generation generally
   requires the time to be accurate within 5-10 minutes.

   It may be possible to approximate secure time by querying an
   external time server.  Secure NTP is possibly beyond the
   capabilities of an IoT device.  The main risks of having incorrect
   time are denial of service (the device rejects valid certificates),
   and the generation of tokens with invalid times.  It could be
   possible to trick the device into generating tokens that are valid in
   the future, but the attacker would also have to spoof the server's
   certificate to be able to intercept this. [th-time]_

6. **Sensor data**. The data received from the sensor itself, and
   delivered to the service shall be delivered without modification or
   tampering.

7. **Device configuration**. Various configuration data, such as the
   hostname of the service to connect to, the address of a time server,
   frequency and parameters of when sensor data is sent to the service,
   and other need to be kept by the device. This configuration data will
   need to be updated periodically as the configuration changes. Updates
   should be allowed only from authorized parties. [th-conf]_

8. **Logs**. In order to assist with analysis of security issues, the
   device shall log information about security-pertinent events. IoT
   devices generally have limited storage, and as such, these logs need
   to be carefully selected. It may also be possible to send these log
   events to the cloud service where they can be stored in a more
   resource-available environment. Types of events that should be logged
   include:

   a. **Firmware image updates**. The system should log the download of
      new images, and when an image is successfully updated.

   b. **Client secret changes**. Changes and new client secrets should be
      logged.

   c. **Changes to the device configuration**.

   [th-logs]_

Communication
=============

In addition to assets, the threat model also considers the locations
where data or assets are communicated between entities of the system.

1. **Flash contents**. The flash device contains several regions. The
   contents of flash can be modified programmatically by the SoC's CPU.

   a. **The bootloader**. As described in the Assets section, the
      bootloader is a small section of the flash device containing the
      code initially run. This section shall be written early in the
      lifecycle of the device, and the flash device then configured to
      permanently disallow modification of this section. This
      configuration should also prevent modification via external
      interfaces, such as JTAG or SWD debuggers.

      The bootloader is responsible for verifying the signature of the
      application image as well as updating the application image from
      the update image when an update is needed.

      The bootloader shall verify the signature of the update image
      before installing it.

      The bootloader shall only accept an update image with a newer
      version number than the current image.

   b. **The application image**. The application image contains the code
      executed during normal operation of the device. Before running
      this image, the bootloader shall verify a digital signature of the
      image, to avoid running an image that has been tampered with. The
      flash/system shall be configured such that after the bootloader
      has completed, the CPU will be unable to write to the application
      image.

   c. **The update image**. This is an area of flash that holds a new
      version of the application image. This image will be downloaded
      and stored by the application during normal operation. When this
      has completed, the application can trigger a reboot, and the
      bootloader can install the new image.

   d. **Secret storage**. An area of the flash will be used to store
      client secrets. This area is written and read by a subset of the
      application image. The application shall be configured to
      protect this area from both reads and writes by code that does
      not need to have access to it, giving consideration to possible
      exploits found within a majority of the application code.
      Revealing the contents of the secrets would allow the attacker
      to spoof this device.

      Initial secrets shall be placed in the device during a
      provisioning activity, distinct from normal operation of the
      device. Later updates can be made under the direction of
      communication received over a secured channel to the service.

   e. **Configuration storage**. There shall be an area to store other
      configuration information. On resource-constrained devices, it is
      allowed for this to be stored in the same region as the secret
      storage, however, this adds additional code that has access to the
      secret storage area, and as such, more code that must be
      scrutinized.

   f. **Log storage**. The device may have an area of flash where log
      events can be written.

2. **Sensor/Actuator interface**. In this design, the sensor or actuator
   communicates with the SoC via a bus, such as SPI. The hardware design
   shall be made to make intercepting this bus difficult for an attack.
   Required techniques depend on the sensitivity and use of the sensor
   data, and can range from having the sensor mounted on the same PCB as
   the MCU to epoxy potting the entire device.

3. **Communication with cloud service**. Communication between the
   device, and the cloud service will be done over the general
   internet. As such, it shall be assumed that an attacker can
   arbitrarily intercept this channel and, for example, return spoofed
   DNS results or attempt man-in-the-middle attacks
   against communication with cloud services.

   The device shall use TLS for all communication with the cloud
   service [th-all-tls]_. The TLS stack shall be configured to use only cipher suites
   that are generally considered secure [2]_, including forward
   secrecy. The communication shall be secured by the following:

   a. **Cipher suite selection**. The device shall only allow
      communication with generally agreed secure cipher suites
      [th-tls-ciphers]_.

   b. **Server certificate verification**. The server presented by the
      server shall be verified [th-root-check]_.

      i.   **Naming**. The certificate shall name the host and service
           the cloud service server is providing.
           `RFC6125 <https://tools.ietf.org/html/rfc6125>`__ describes
           best practices for this. It is permissible for the device to
           require the certificate to be more restrictive than as
           described in this RFC, provided the service can use a
           certificate that can comply.

      ii.  **Path validation**. The device shall verify that the
           certificate chain has a valid signature path from a root
           certificate contained within the device, to the certificate
           presented by the service.
           `RFC4158 <https://tools.ietf.org/html/rfc4158>`__ describes
           this is general. The device is permitted to require a more
           restricted path, provided the server certificate used
           complies with this restriction.

      iii. **Validity period**. The validity period of all presented
           certificates shall be checked against the device's best
           notion of the current time.

   c. **Client authentication**. The client shall authenticate itself to
      the service using a secret known only to that particular device.
      There are several options, and the technique used is generally
      mandated by the particular service provider being used
      [th-tls-client-auth]_.

      i.  **TLS client certificates**. The TLS protocol allows the
          client to present a certificate, and assert its knowledge of
          the secret described by that certificate. Generally, these
          certificates will be stored within the service provider. These
          certificates can be self-signed, or signed by a CA. Since the
          service provider maintains a list of valid certificates
          (mapping them to a device identity), having these certificates
          signed by a CA does not add any additional security, but may
          be useful in the management of these certificates.

      ii. **Token-based authentication**. It is also possible for the
          client to authenticate itself using the *password* field of
          the MQTT CONNECT packet. However, the secret itself must not
          be transmitted in this packet. Instead, a token-based
          protocol, such as
          `RFC7519 <https://tools.ietf.org/html/rfc7519>`__\ 's JSON Web
          Token (JWT) can be used. These tokens will generally have a
          small validity period (e.g. 1 hour), to prevent them from
          being reused if they are intercepted. The token shall not be
          sent until the device has verified the identity of the server.

   d. **Random/Entropy source**. Cryptographic communication requires the
      generation of secure pseudorandom numbers. The device shall use a
      modern, accepted cryptographic random-bit generator to generate
      these random numbers. It shall use either a Non-Deterministic
      Random Bit Generator (True RBG) implemented in hardware within the
      SoC, or a Deterministic Random Bit Generator (Pseudo RBG) seeded
      by an entropy source within the SoC.  Please see NIST SP 800-90A
      for information on approved RBGs and NIST SP 800-90B for
      information on testing a device's entropy source [th-entropy]_.

4. **Communication with the time service**. Ideally, the device shall
   contain hardware that maintains a secure time. However, most SoCs in
   use do not have support for this, and it will be necessary to consult
   an external time service.
   `RFC4330 <https://tools.ietf.org/html/rfc4330>`__ and referenced RFCs
   describe the Simple Network Time Protocol that can be used to query
   the current time from a network time server.

5. **Device lifecycle**. An IoT device will have a lifecycle from
   production to destruction and disposal of the device. Aspects of this
   lifecycle that impact security include initial provisioning, normal
   operation, re-provisioning, and destruction.

   a. **Initial provisioning**. During the initial provisioning stage,
      it is necessary to program the bootloader, an initial application
      image, a device secret, and initial configuration data
      [th-initial-provision]_. In
      addition, the bootloader flash protection shall be installed. Of
      this information, only the device secret needs to differ per
      device. This secret shall be securely maintained, and destroyed in
      all locations outside of the device once it has been programmed
      [th-initial-secret]_.

   b. **Normal operation**. Normal operation includes the behavior
      described by the rest of this document.

   c. **Re-provisioning**. Sometimes it is necessary to re-provision a
      device, such as for a different application. One way to do this is
      to keep the same device secret, and replace the configuration
      data, as well as the cloud service data associated with the
      device. It is also possible to program a new device secret, but if
      this is done it shall be done securely, and the new secret
      destroyed externally once programmed into the device
      [th-reprovision]_.

   d. **Destruction**. To prevent the device secret from being used to
      spoof the device, upon decommissioning, the secret for a
      particular device shall be rendered ineffective
      [th-destruction]_. Possibilities include:

      i.    Hardware destruction of the device.

      ii.   Securely wiping the flash area containing the
            secret [3]_.

      iii.  Removing the device identity and certificate from the
            service.

Other Considerations
====================

In addition to the above, network connected devices generally will need
a way to configure them to connect to the network environment they are
placed in. There are numerous ways of doing this, and it is important
for these configuration methods to not circumvent the security
requirements described above.

Threats
=======

.. [th-imboot] Must boot with an immutable bootloader.

.. [th-authrepl] Application image shall only be replaced with an
   authorized image.

.. [th-timely-update]
   Application updates shall be done in a timely manner.

.. [th-atomic-update]
   Application updates shall be atomic.

.. [th-root-certs]
   TLS must have a list of trusted root certificates.

.. [th-root-check]
   TLS must verify root certificate from server is valid.

.. [th-secret-storage]
   There must be a mechanism to securely store client secrets.  The
   least amount of code necessary shall have access to these secrets.

.. [th-time]
   System must have moderately accurate notion of the current
   date/time.

.. [th-conf]
   The system must receive, and keep configuration data.

.. [th-logs]
   The system must log security-related events, and either store them
   locally, or send to a service.

.. [th-all-tls]
   All communications with the cloud service shall use TLS.

.. [th-tls-ciphers]
   TLS shall be configured to allow only generally agreed cipher
   suites (including forward secrecy).

.. [th-tls-client-auth]
   The device shall authenticate itself with the cloud provider using
   one of the methods described.

.. [th-entropy]
   The TLS layer shall use a modern, accepted cryptographic random-bit
   generator seeded by an entropy source within the SoC.

.. [th-initial-provision]
   The device shall have a per-device secret loaded before deployment.

.. [th-initial-secret]
   The initial secret shall be securely maintained, and destroyed in
   any external location as soon as the device is provisioned.

.. [th-reprovision]
   Reprovisioning a device shall be done securely.

.. [th-destruction]
   Upon decommissioning, the device secret shall be rendered
   ineffective.

Notes
=====

.. [1]
   See https://www.slideshare.net/kartben/iot-developer-survey-2018. As
   of this writing, the three major cloud IoT service providers, AWS
   IoT, Google Cloud IoT, and Microsoft Azure IoT all provide MQTT over
   TLS. Some feedback has suggested that some find difficulty with UDP
   protocols and routing issues on various networks.

.. [2]
   As new exploits are discovered, what is considered secure can
   change.
   Organizations such as https://www.ssllabs.com/ provide information on
   current ideas of how TLS must be configured to be secure.

.. [3]
   Note that merely erasing this flash area is unlikely to be
   sufficient.

Part 3

한국어 전문 번역

이 문서는 IoT sensor device의 threat model을 설명합니다. Threat model을 명시하면 개발 노력을 어디에 집중할지 정할 수 있고, 그 작업의 우선순위를 세우는 데도 도움이 됩니다.

이 device에는 온도 sensor나 pipe pressure sensor 같은 어떤 종류의 sensor가 있습니다. Sensor는 측정 data를 microcontroller가 실행되는 SoC에 보냅니다. Microcontroller는 cloud service에 연결해 sensor data를 전달합니다. Cloud service는 device에 configuration data와 software update image도 보낼 수 있습니다. 전체 구조는 그림 1과 같습니다.

Sensor, SoC application과 bootloader, cloud service 사이의 data와 update 흐름
그림 1. Sensor device의 일반 구조. 이미지 출처: Zephyr Project v3.7.0.

이 sensor device에서는 sensor가 SPI bus로 SoC에 연결되고, SoC는 network interface를 통해 cloud service와 통신합니다. Interface의 구체적인 형태는 예상하지 못한 방식으로 threat model에 영향을 줄 수 있으므로 variation도 고려해야 합니다. 예를 들어 별도 network-interface SoC가 어떤 bus로 main SoC에 연결되는 구조가 있을 수 있습니다.

이 model은 널리 사용되는 것으로 보이는 MQTT-over-TLS protocol을 통한 통신에 초점을 둡니다.

Asset

Threat model에서 고려할 한 측면은 device 동작에 관여하는 asset입니다. 이 model에 포함된 asset은 다음과 같습니다.

  1. Bootloader. Device flash 안에 들어 있으며 가장 먼저 실행되는 작은 code/data image입니다. Root of trust를 세우려면 이 image는 변경할 수 없어야 합니다. 이 model은 SoC가 flash region을 이후 write로부터 보호하는 mechanism을 제공하며, 생산 초기 device에 bootloader를 programming한 직후 그 보호를 적용한다고 가정합니다. th-imboot.
  2. Application firmware image. Microcontroller가 실행하는 firmware의 나머지 부분입니다. Security vulnerability가 발견될 때마다 이 부분은 주기적으로 update해야 하므로 bootloader와 구분합니다. Update requirement는 다음과 같습니다.
    1. Image는 authorized image로만 교체해야 합니다. th-authrepl.
    2. Authorized replacement image가 준비되면 적시에 update해야 합니다. th-timely-update.
    3. Image update는 atomic해야 합니다. Image를 실행할 때 flash에는 update image 전체 또는 이전 image 전체 중 하나만 있어야 합니다. th-atomic-update.
  3. Root certificate 목록. IoT device가 cloud service server를 authenticate하려면 server certificate에 서명할 수 있도록 허용된 root certificate 목록이 필요합니다. Cloud provider 기반 service에서는 보통 service provider가 이 목록을 제공합니다. Root certificate는 만료되거나 revoke될 수 있으므로 목록을 주기적으로 갱신해야 합니다. th-root-certs, th-root-check.
  4. Client secret. Client가 service에 자신을 authenticate하려면 secret이 필요합니다. 일반적으로 RSA private key 또는 EC private key입니다. Device는 server와 통신을 설정할 때 TLS session 수립 과정에서 이 secret을 사용하거나, 통신에 사용하는 message에 서명할 때 사용합니다.

    이 secret은 일반적으로 service provider나 다른 곳에서 실행되는 software가 생성하며, device에 안전하게 설치해야 합니다. Policy에 따라 주기적으로 교체해야 할 수 있으므로 client secret update 방법이 필요합니다. 보통 service는 이전 key를 사용하는 동안 update를 진행할 수 있도록 두세 개의 active key를 허용합니다.

    Secret은 read로부터 보호해야 하며, 꼭 필요한 최소한의 code만 접근할 수 있어야 합니다. th-secret-storage.

  5. 현재 date/time. TLS certificate를 검증하려면 현재 시간이 certificate validity period 안에 있는지 판단할 수 있도록 현재 date와 time을 알아야 합니다. Token-based client authentication도 대체로 token validity window가 들어간 message에 client가 서명해야 합니다. Certificate validation에는 device 시간이 대략 하루 이내로 정확하면 되지만, token 생성에는 대체로 5~10분 이내의 정확도가 필요합니다.

    외부 time server에 질의해 secure time을 근사할 수 있습니다. Secure NTP는 IoT device capability를 넘어설 수 있습니다. 잘못된 시간의 주된 위험은 device가 유효한 certificate를 거부하는 denial of service와 유효하지 않은 시간의 token 생성입니다. Attacker가 device를 속여 미래에 유효한 token을 만들게 할 수도 있지만, 이를 가로채려면 server certificate도 spoof해야 합니다. th-time.

  6. Sensor data. Sensor에서 받아 service로 보내는 data는 modification이나 tampering 없이 전달되어야 합니다.
  7. Device configuration. Service hostname, time server address, sensor data를 service에 보내는 주기와 parameter 등 여러 configuration data를 device가 보관해야 합니다. Configuration이 바뀌면 이 data도 주기적으로 update해야 하며, authorized party만 update할 수 있어야 합니다. th-conf.
  8. Log. Security issue 분석을 돕기 위해 device는 security 관련 event 정보를 기록해야 합니다. IoT device는 storage가 제한적이므로 기록할 event를 신중히 골라야 합니다. Log event를 cloud service로 보내 resource가 더 풍부한 환경에 저장할 수도 있습니다. 기록해야 할 event 종류는 다음과 같습니다.
    1. Firmware image update: 새 image download와 image update 성공 시점을 기록합니다.
    2. Client secret change: Client secret의 변경과 추가를 기록합니다.
    3. Device configuration change.
    th-logs.

통신 경계

Threat model은 asset뿐 아니라 system entity 사이에서 data나 asset이 이동하는 위치도 고려합니다.

  1. Flash content. Flash device는 여러 region을 포함하며, SoC CPU가 program 방식으로 내용을 수정할 수 있습니다.
    1. Bootloader. Asset 절에서 설명했듯 bootloader는 최초로 실행할 code가 들어 있는 작은 flash section입니다. Device lifecycle 초기 단계에 이 section을 write한 뒤, 다시는 수정할 수 없도록 flash device를 configuration해야 합니다. 이 configuration은 JTAG이나 SWD debugger 같은 external interface를 통한 modification도 막아야 합니다.

      Bootloader는 application image의 signature를 검증하며, update가 필요할 때 update image로 application image를 갱신합니다.

      Bootloader는 update image를 install하기 전에 signature를 검증해야 합니다.

      Bootloader는 현재 image보다 version number가 높은 update image만 받아야 합니다.

    2. Application image. Device 정상 동작 중 실행되는 code입니다. Tampering된 image를 실행하지 않도록 bootloader는 실행 전에 image의 digital signature를 검증해야 합니다. Bootloader가 끝난 뒤에는 CPU가 application image에 write할 수 없도록 flash와 system을 configuration해야 합니다.
    3. Update image. 새 version의 application image를 보관하는 flash area입니다. 정상 동작 중 application이 image를 download해 저장합니다. 저장이 끝나면 application이 reboot을 trigger하고 bootloader가 새 image를 install합니다.
    4. Secret storage. Flash의 한 영역에 client secret을 저장합니다. Application image 중 일부 code만 이 영역을 read/write합니다. Application 대부분에서 exploit이 발견될 가능성을 고려해, 접근할 필요가 없는 code의 read와 write를 모두 막도록 application을 configuration해야 합니다. Secret이 드러나면 attacker가 이 device를 spoof할 수 있습니다.

      Initial secret은 device의 정상 동작과 구분된 provisioning activity 중에 넣어야 합니다. 이후 update는 service와의 secure channel에서 받은 지시에 따라 수행할 수 있습니다.

    5. Configuration storage. 기타 configuration information을 저장할 영역이 필요합니다. Resource-constrained device에서는 secret storage와 같은 region에 저장해도 되지만, 그러면 더 많은 code가 secret storage에 접근하게 되므로 security 검토 대상 code도 늘어납니다.
    6. Log storage. Device는 log event를 기록할 flash area를 둘 수 있습니다.
  2. Sensor/Actuator interface. 이 design에서 sensor나 actuator는 SPI 같은 bus로 SoC와 통신합니다. Attack으로 bus를 가로채기 어렵도록 hardware를 설계해야 합니다. 필요한 technique은 sensor data의 sensitivity와 use에 따라 달라집니다. Sensor를 MCU와 같은 PCB에 장착하는 방식부터 device 전체를 epoxy potting하는 방식까지 사용할 수 있습니다.
  3. Cloud service와의 통신. Device와 cloud service는 일반 internet을 통해 통신합니다. 따라서 attacker가 channel을 임의로 intercept하고 spoofed DNS result를 반환하거나 cloud service 통신에 man-in-the-middle attack을 시도할 수 있다고 가정해야 합니다.

    Device는 cloud service와의 모든 통신에 TLS를 사용해야 합니다. th-all-tls. TLS stack은 forward secrecy를 포함해 일반적으로 안전하다고 인정되는 cipher suite만 사용하도록 configuration해야 합니다. 통신은 다음 조치로 보호합니다.

    1. Cipher suite 선택. 일반적으로 안전하다고 합의된 cipher suite만 허용해야 합니다. th-tls-ciphers.
    2. Server certificate 검증. Server가 제시한 certificate를 검증해야 합니다. th-root-check.
      1. Naming. Certificate는 cloud service server가 제공하는 host와 service의 이름을 담아야 합니다. RFC 6125가 best practice를 설명합니다. Service가 조건에 맞는 certificate를 사용할 수 있다면 device가 RFC보다 더 제한적인 조건을 요구해도 됩니다.
      2. Path validation. Device 안의 root certificate에서 service가 제시한 certificate까지 이어지는 certificate chain에 유효한 signature path가 있는지 검증해야 합니다. RFC 4158이 일반 원리를 설명합니다. Server certificate가 조건을 만족한다면 device가 더 제한된 path를 요구해도 됩니다.
      3. Validity period. 제시된 모든 certificate의 validity period를 device가 알고 있는 최선의 현재 시간과 비교해 확인해야 합니다.
    3. Client authentication. Client는 해당 device만 아는 secret으로 service에 자신을 authenticate해야 합니다. 여러 방법이 있으며 일반적으로 사용하는 service provider가 방식을 정합니다. th-tls-client-auth.
      1. TLS client certificate. TLS protocol에서 client는 certificate를 제시하고 그 certificate가 설명하는 secret을 알고 있음을 증명할 수 있습니다. 이 certificate는 보통 service provider가 보관합니다. Self-signed certificate나 CA가 서명한 certificate를 사용할 수 있습니다. Service provider가 유효한 certificate 목록과 device identity mapping을 유지하므로 CA signature가 security를 더 높이지는 않지만 certificate 관리에는 유용할 수 있습니다.
      2. Token-based authentication. Client는 MQTT CONNECT packet의 password field로 자신을 authenticate할 수도 있습니다. 그러나 secret 자체를 이 packet으로 보내면 안 됩니다. 대신 RFC 7519의 JWT(JSON Web Token) 같은 token-based protocol을 사용할 수 있습니다. Intercept된 token이 재사용되지 않도록 token validity period는 보통 1시간처럼 짧습니다. Device가 server identity를 검증하기 전에는 token을 보내면 안 됩니다.
    4. Random/entropy source. Cryptographic communication에는 secure pseudorandom number 생성이 필요합니다. Device는 modern accepted cryptographic random-bit generator를 사용해야 합니다. SoC 안의 hardware로 구현한 Non-Deterministic Random Bit Generator(True RBG), 또는 SoC의 entropy source로 seed한 Deterministic Random Bit Generator(Pseudo RBG)를 사용해야 합니다. 승인된 RBG는 NIST SP 800-90A, device entropy source test는 NIST SP 800-90B를 참고합니다. th-entropy.
  4. Time service와의 통신. 이상적으로 device는 secure time을 유지하는 hardware를 포함해야 합니다. 그러나 사용되는 SoC 대부분은 이를 지원하지 않으므로 external time service에 질의해야 합니다. RFC 4330과 그 reference RFC는 network time server에서 현재 시간을 질의하는 SNTP(Simple Network Time Protocol)를 설명합니다.
  5. Device lifecycle. IoT device는 생산부터 파괴와 폐기까지 lifecycle을 갖습니다. Security에 영향을 주는 단계는 initial provisioning, normal operation, reprovisioning, destruction입니다.
    1. Initial provisioning. Bootloader, initial application image, device secret, initial configuration data를 programming해야 합니다. th-initial-provision. Bootloader flash protection도 설치해야 합니다. 이 정보 중 device마다 달라야 하는 것은 device secret뿐입니다. Secret은 안전하게 유지하고 device에 programming한 뒤에는 device 밖의 모든 위치에서 파기해야 합니다. th-initial-secret.
    2. Normal operation. 이 문서의 나머지 부분에서 설명한 동작을 포함합니다.
    3. Reprovisioning. 다른 application에 사용하는 경우처럼 device를 다시 provisioning해야 할 때가 있습니다. 같은 device secret을 유지하면서 configuration data와 cloud service의 device 관련 data를 교체할 수 있습니다. 새 device secret을 programming할 수도 있지만, 안전하게 수행하고 programming 후에는 외부에 남은 새 secret을 파기해야 합니다. th-reprovision.
    4. Destruction. Device secret을 이용해 device를 spoof하지 못하도록 decommissioning할 때 해당 device secret을 무효화해야 합니다. th-destruction. 가능한 방법은 다음과 같습니다.
      1. Device hardware를 물리적으로 파괴
      2. Secret이 들어 있는 flash area를 secure wipe
      3. Service에서 device identity와 certificate 제거

그 밖의 고려 사항

Network-connected device는 일반적으로 배치된 network environment에 연결하기 위한 configuration 방법이 필요합니다. 구현 방법은 많지만, 어떤 configuration method도 앞에서 설명한 security requirement를 우회하지 않게 하는 것이 중요합니다.

Threat requirement 목록

th-imboot
변경할 수 없는 immutable bootloader로 boot해야 합니다.
th-authrepl
Application image는 authorized image로만 교체해야 합니다.
th-timely-update
Application update를 적시에 수행해야 합니다.
th-atomic-update
Application update는 atomic해야 합니다.
th-root-certs
TLS는 trusted root certificate 목록을 가져야 합니다.
th-root-check
TLS는 server가 제시한 root certificate가 유효한지 검증해야 합니다.
th-secret-storage
Client secret을 안전하게 저장하는 mechanism이 있어야 하며, 꼭 필요한 최소한의 code만 secret에 접근할 수 있어야 합니다.
th-time
System은 현재 date와 time을 적당한 정확도로 알고 있어야 합니다.
th-conf
System은 configuration data를 받아 보관해야 합니다.
th-logs
System은 security 관련 event를 log하고 local에 저장하거나 service로 보내야 합니다.
th-all-tls
Cloud service와의 모든 통신은 TLS를 사용해야 합니다.
th-tls-ciphers
TLS는 forward secrecy를 포함해 일반적으로 합의된 cipher suite만 허용하도록 configuration해야 합니다.
th-tls-client-auth
Device는 설명된 방법 중 하나로 cloud provider에 자신을 authenticate해야 합니다.
th-entropy
TLS layer는 SoC 내부 entropy source로 seed한 modern accepted cryptographic random-bit generator를 사용해야 합니다.
th-initial-provision
배포 전에 device별 secret을 device에 load해야 합니다.
th-initial-secret
Initial secret은 안전하게 유지하고 device provisioning이 끝나면 모든 외부 위치에서 파기해야 합니다.
th-reprovision
Device reprovisioning은 안전하게 수행해야 합니다.
th-destruction
Decommissioning할 때 device secret을 무효화해야 합니다.

주석

  1. IoT Developer Survey 2018을 참고합니다. 이 문서를 작성할 당시 주요 cloud IoT service provider 세 곳인 AWS IoT, Google Cloud IoT, Microsoft Azure IoT는 모두 MQTT over TLS를 제공했습니다. 일부 feedback은 여러 network에서 UDP protocol과 routing 문제를 겪는 경우가 있다고 지적했습니다.
  2. 새 exploit이 발견되면 무엇을 안전하다고 보는지도 바뀔 수 있습니다. SSL Labs 같은 organization은 TLS를 안전하게 configuration하는 현재 기준을 제공합니다.
  3. Flash area를 단순히 erase하는 것만으로는 충분하지 않을 가능성이 큽니다.

Source

출처

영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.