Internet-Draft | A Firmware Update Architecture for IoT | October 2020 |
Moran, et al. | Expires 24 April 2021 | [Page] |
Vulnerabilities in Internet of Things (IoT) devices have raised the need for a reliable and secure firmware update mechanism suitable for devices with resource constraints. Incorporating such an update mechanism is a fundamental requirement for fixing vulnerabilities but it also enables other important capabilities such as updating configuration settings as well as adding new functionality.¶
In addition to the definition of terminology and an architecture this document motivates the standardization of a manifest format as a transport-agnostic means for describing and protecting firmware updates.¶
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.¶
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/.¶
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."¶
This Internet-Draft will expire on 24 April 2021.¶
Copyright (c) 2020 IETF Trust and the persons identified as the document authors. All rights reserved.¶
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.¶
Firmware updates can help to fix security vulnerabilities and are considered to be an important building block in securing IoT devices. Due to rising concerns about insecure IoT devices the Internet Architecture Board (IAB) organized a 'Workshop on Internet of Things (IoT) Software Update (IOTSU)', which took place at Trinity College Dublin, Ireland on the 13th and 14th of June, 2016 to take a look at the bigger picture. A report about this workshop can be found at [RFC8240]. The workshop revealed a number of challenges for developers and led to the formation of the IETF Software Updates for Internet of Things (SUIT) working group.¶
Developing secure Internet of Things (IoT) devices is not an easy task and supporting a firmware update solution requires skillful engineers. Once devices are deployed, firmware updates play a critical part in their lifecycle management, particularly when devices have a long lifetime, or are deployed in remote or inaccessible areas where manual intervention is cost prohibitive or otherwise difficult. Firmware updates for IoT devices are expected to work automatically, i.e. without user involvement. Conversely, IoT devices are expected to account for user preferences and consent when scheduling updates. Automatic updates that do not require human intervention are key to a scalable solution for fixing software vulnerabilities.¶
Firmware updates are not only done to fix bugs, but they can also add new functionality, and re-configure the device to work in new environments or to behave differently in an already deployed context.¶
The firmware update process has to ensure that¶
While the standardization work has been informed by and optimized for firmware update use cases of Class 1 devices (according to the device class definitions in RFC 7228 [RFC7228]) devices, there is nothing in the architecture that restricts its use to only these constrained IoT devices. Moreover, this architecture is not limited to managing firmware and software updates, but can also be applied to managing the delivery of arbitrary data, such as configuration information and keys. Unlike higher end devices, like laptops and desktop PCs, many IoT devices do not have user interfaces and support for unattended updates is, therefore, essential for the design of a practical solution. Constrained IoT devices often use a software engineering model where a developer is responsible for creating and compiling all software running on the device into a single, monolithic firmware image. On higher end devices application software is, on the other hand, often downloaded separately and even obtained from developers different to the developers of the lower level software. The details for how to obtain those application layer software binaries then depends heavily on the platform, programming language used and the sandbox in which the software is executed.¶
While the IETF standardization work has been focused on the manifest format, a fully interoperable solution needs more than a standardized manifest. For example, protocols for transferring firmware images and manifests to the device need to be available as well as the status tracker functionality. Devices also require a mechanism to discover the status tracker(s) and/or firmware servers, for example using pre-configured hostnames or [RFC6763] DNS-SD. These building blocks have been developed by various organizations under the umbrella of an IoT device management solution. The LwM2M protocol is one IoT device management protocol.¶
There are, however, several areas that (partially) fall outside the scope of the IETF and other standards organizations but need to be considered by firmware authors, as well as device and network operators. Here are some of them, as highlighted during the IOTSU workshop:¶
This document starts with a terminology followed by the description of the architecture. We then explain the bootloader and how it integrates with the firmware update mechanism. Subsequently, we offer a categorization of IoT devices in terms of their hardware capabilities relevant for firmware updates. Next, we talk about the manifest structure and how to use it to secure firmware updates. We conclude with a more detailed example.¶
This document uses the following terms:¶
Firmware Image: The firmware image, or image, is a binary that may contain the complete software of a device or a subset of it. The firmware image may consist of multiple images, if the device contains more than one microcontroller. Often it is also a compressed archive that contains code, configuration data, and even the entire file system. The image may consist of a differential update for performance reasons.¶
The terms, firmware image, firmware, and image, are used in this document and are interchangeable. We use the term application firmware image to differentiate it from a firmware image that contains the bootloader. An application firmware image, as the name indicates, contains the application program often including all the necessary code to run it (such as protocol stacks, and embedded operating system).¶
The following stakeholders are used in this document:¶
Status Tracker: The status tracker has a client and a server component and performs three tasks: 1) It communicates the availability of a new firmware version. This information will flow from the server to the client.¶
2) It conveys information about software and hardware characteristics of the device. The information flow is from the client to the server.¶
3) It can remotely trigger the firmware update process. The information flow is from the server to the client.¶
For example, a device operator may want to read the installed firmware version number running on the device and information about available flash memory. Once an update has been triggered, the device operator may want to obtain information about the state of the firmware update. If errors occurred, the device operator may want to troubleshoot problems by first obtaining diagnostic information (typically using a device management protocol).¶
We make no assumptions about where the server-side component is deployed. The deployment of status trackers is flexible and may be found at¶
cloud-based servers, on-premise servers, or may be embedded in edge computing devices. A status tracker server component may even be deployed on an IoT device. For example, if the IoT device contains multiple MCUs, then the main MCU may act as a status tracker towards the other MCUs. Such deployment is useful when updates have to be synchronized across MCUs.¶
The status tracker may be operated by any suitable stakeholder; typically the Author, Device Operator, or Network Operator.¶
Firmware Server: The firmware server stores firmware images and manifests and distributes them to IoT devices. Some deployments may require a store-and-forward concept, which requires storing the firmware images/manifests on more than one entity before¶
they reach the device. There is typically some interaction between the firmware server and the status tracker and these two entities are often physically separated on different devices for scalability reasons.¶
More devices today than ever before are connected to the Internet, which drives the need for firmware updates to be provided over the Internet rather than through traditional interfaces, such as USB or RS-232. Sending updates over the Internet requires the device to fetch the new firmware image as well as the manifest.¶
Hence, the following components are necessary on a device for a firmware update solution:¶
The features listed above are most likely offered by code in the application firmware image running on the device rather than by the bootloader itself. Note that cryptographic algorithms will likely run in a trusted execution environment, on a separate MCU, in a hardware security module, or in a secure element rather than in the same context with the application code.¶
Figure 1 shows the architecture where a firmware image is created by an author, and made available to a firmware server. For security reasons, the author will not have the permissions to upload firmware images to the firmware server and to initiate an update him- or herself. Instead, authors will make firmware images available to the device operators. Note that there may be a longer supply chain involved to pass software updates from the author all the way to the party that can then finally make a decision to deploy it with IoT devices.¶
As a first step in the firmware update process, the status tracker client needs to be made aware of the availability of a new firmware update by the status tracker server. This can be accomplished via polling (client-initiated), push notifications (server-initiated), or more complex mechanisms (such as a hybrid approach):¶
Once the device operator triggers update via the status tracker, it will keep track of the update process on the device. This allows the device operator to know what devices have received an update and which of them are still pending an update.¶
Firmware images can be conveyed to devices in a variety of ways, including USB, UART, WiFi, BLE, low-power WAN technologies, mesh networks and many more. At the application layer a variety of protocols are also available: MQTT, CoAP, and HTTP are the most popular application layer protocols used by IoT devices. This architecture does not make assumptions about how the firmware images are distributed to the devices and therefore aims to support all these technologies.¶
In some cases it may be desirable to distribute firmware images using a multicast or broadcast protocol. This architecture does not make recommendations for any such protocol. However, given that broadcast may be desirable for some networks, updates must cause the least disruption possible both in metadata and firmware transmission. For an update to be broadcast friendly, it cannot rely on link layer, network layer, or transport layer security. A solution has to rely on security protection applied to the manifest and firmware image instead. In addition, the same manifest must be deliverable to many devices, both those to which it applies and those to which it does not, without a chance that the wrong device will accept the update. Considerations that apply to network broadcasts apply equally to the use of third-party content distribution networks for payload distribution.¶
Firmware images and manifests may be conveyed as a bundle or detached. The manifest must support both approaches.¶
For distribution as a bundle, the firmware image is embedded into the manifest. This is a useful approach for deployments where devices are not connected to the Internet and cannot contact a dedicated firmware server for the firmware download. It is also applicable when the firmware update happens via a USB sticks or short range radio technologies (such as Bluetooth Smart).¶
Alternatively, the manifest is distributed detached from the firmware image. Using this approach, the firmware consumer is presented with the manifest first and then needs to obtain one or more firmware images as dictated in the manifest.¶
The pre-authorisation step involves verifying whether the entity signing the manifest is indeed authorized to perform an update. The firmware consumer must also determine whether it should fetch and process a firmware image, which is referenced in a manifest.¶
A dependency resolution phase is needed when more than one component can be updated or when a differential update is used. The necessary dependencies must be available prior to installation.¶
The download step is the process of acquiring a local copy of the firmware image. When the download is client-initiated, this means that the firmware consumer chooses when a download occurs and initiates the download process. When a download is server-initiated, this means that the status tracker tells the device when to download or that it initiates the transfer directly to the firmware consumer. For example, a download from an HTTP/1.1-based firmware server is client-initiated. Pushing a manifest and firmware image to the Package resource of the LwM2M Firmware Update object [LwM2M] is server-initiated update.¶
If the firmware consumer has downloaded a new firmware image and is ready to install it, to initiate the installation, it may - either need to wait for a trigger from the status tracker, - or trigger the update automatically, - or go through a more complex decision making process to determine the appropriate timing for an update. Sometimes the final decision may require confirmation of the user of the device for safety reasons.¶
Installation is the act of processing the payload into a format that the IoT device can recognize and the bootloader is responsible for then booting from the newly installed firmware image. This process is different when a bootloader is not involved. For example, when an application is updated in a full-featured operating system, the updater may halt and restart the application in isolation. Devices must not fail when a disruption occurs during the update process. For example, a power failure or network disruption during the update process must not cause the device to fail.¶
Section 3 describes the steps for getting the firmware image and the manifest from the author to the firmware consumer on the IoT device. Once the firmware consumer has retrieved and successfully processed the manifest and the firmware image it needs to invoke the new firmware image. This is managed in many different ways, depending on the type of device, but it typically involves halting the current version of the firmware, handing control over to a firmware with a higher privilege/trust level (the firmware verifier) verifying the new firmware's authenticity & integrity, and then invoking it.¶
In an execute-in-place microcontroller, this is often done by rebooting into a bootloader (simultaneously halting the application & handing over to the higher privilege level) then executing a secure boot process (verifying and invoking the new image).¶
In a rich OS, this may be done by halting one or more processes, then invoking new applications. In some OSs, this implicitly involves the kernel verifying the code signatures on the new applications.¶
The invocation process is security sensitive. An attacker will typically try to retrieve a firmware image from the device for reverse engineering or will try to get the firmware verifier to execute an attacker-modified firmware image. The firmware verifier will therefore have to perform security checks on the firmware image before it can be invoked. These security checks by the firmware verifier happen in addition to the security checks that took place when the firmware image and the manifest were downloaded by the firmware consumer.¶
The overlap between the firmware consumer and the firmware verifier functionality comes in two forms, namely¶
While this document assumes that the firmware verifier itself is distinct from the role of the firmware consumer and therefore does not manage the firmware update process, this is not a requirement and these roles may be combined in practice.¶
Using a bootloader as the firmware verifier requires some special considerations, particularly when the bootloader implements the robustness requirements identified by the IOTSU workshop [RFC8240].¶
In most cases the MCU must restart in order to hand over control to the bootloader. Once the MCU has initiated a restart, the bootloader determines whether a newly available firmware image should be executed. If the bootloader concludes that the newly available firmware image is invalid, a recovery strategy is necessary. There are only two approaches for recovering from an invalid firmware: either the bootloader must be able to select a different, valid firmware, or it must be able to obtain a new, valid firmware. Both of these approaches have implications for the architecture of the update system.¶
Assuming the first approach, there are (at least) three firmware images available on the device:¶
Therefore, the firmware consumer must know where to store the new firmware. In some cases, this may be implicit, for example replacing the least-recently-used firmware image. In other cases, the storage location of the new firmware must be explicit, for example when a device has one or more application firmware images and a recovery image with limited functionality, sufficient only to perform an update.¶
Since many low end IoT devices do not use position-independent code, either the bootloader needs to copy the newly downloaded application firmware image into the location of the old application firmware image and vice versa or multiple versions of the firmware need to be prepared for different locations.¶
In general, it is assumed that the bootloader itself, or a minimal part of it, will not be updated since a failed update of the bootloader poses a reliability risk.¶
For a bootloader to offer a secure boot functionality it needs to implement the following functionality:¶
There are billions of MCUs used in devices today produced by a large number of silicon manufacturers. While MCUs can vary significantly in their characteristics, there are a number of similiaries allowing us to categorize in groups.¶
The firmware update architecture, and the manifest format in particular, needs to offer enough flexibility to cover these common deployment cases.¶
The simplest, and currently most common, architecture consists of a single MCU along with its own peripherals. These SoCs generally contain some amount of flash memory for code and fixed data, as well as RAM for working storage. A notable characteristic of these SoCs is that the primary code is generally execute in place (XIP). Due to the non-relocatable nature of the code, the firmware image needs to be placed in a specific location in flash since the code cannot be executed from an arbitrary location in flash. Hence, when the firmware image is updated it is necessary to swap the old and the new image.¶
Another configuration consists of a similar architecture to the previous, with a single CPU. However, this CPU supports a security partitioning scheme that allows memory (in addition to other things) to be divided into secure and normal mode. There will generally be two images, one for secure mode, and one for normal mode. In this configuration, firmware upgrades will generally be done by the CPU in secure mode, which is able to write to both areas of the flash device. In addition, there are requirements to be able to update either image independently, as well as to update them together atomically, as specified in the associated manifests.¶
In more complex SoCs with symmetric multi-processing support, advanced operating systems, such as Linux, are often used. These SoCs frequently use an external storage medium, such as raw NAND flash or eMMC. Due to the higher quantity of resources, these devices are often capable of storing multiple copies of their firmware images and selecting the most appropriate one to boot. Many SoCs also support bootloaders that are capable of updating the firmware image, however this is typically a last resort because it requires the device to be held in the bootloader while the new firmware is downloaded and installed, which results in down-time for the device. Firmware updates in this class of device are typically not done in-place.¶
This configuration has two or more heterogeneous CPUs, each having their own memory. There will be a communication channel between them, but it will be used as a peripheral, not via shared memory. In this case, each CPU will have to be responsible for its own firmware upgrade. It is likely that one of the CPUs will be considered the primary CPU, and will direct the other CPU to do the upgrade. This configuration is commonly used to offload specific work to other CPUs. Firmware dependencies are similar to the other solutions above, sometimes allowing only one image to be upgraded, other times requiring several to be upgraded atomically. Because the updates are happening on multiple CPUs, upgrading the two images atomically is challenging.¶
In order for a firmware consumer to apply an update, it has to make several decisions using manifest-provided information and data available on the device itself. For more detailed information and a longer list of information elements in the manifest consult the information model specification [I-D.ietf-suit-information-model], which offers justifications for each element, and the manifest, see [I-D.ietf-suit-manifest], for details about how this information is included in the manifest.¶
Table 1 provides examples of decisions to be made.¶
Decision | Information Elements |
---|---|
Should I trust the author of the firmware? | Trust anchors and authorization policies on the device |
Has the firmware been corrupted? | Digital signature and MAC covering the firmware image |
Does the firmware update apply to this device? | Conditions with Vendor ID, Class ID and Device ID |
Is the update older than the active firmware? | Sequence number in the manifest (1) |
When should the device apply the update? | Wait directive |
How should the device apply the update? | Manifest commands |
What kind of firmware binary is it? | Unpack algorithms to interpret a format. |
Where should the update be obtained? | Dependencies on other manifests and firmware image URI in Manifest |
Where should the firmware be stored? | Storage Location and Component Identifier |
(1): A device presented with an old, but valid manifest and firmware must not be tricked into installing such firmware since a vulnerability in the old firmware image may allow an attacker to gain control of the device.¶
Keeping the code size and complexity of a manifest parsers small is important for constrained IoT devices. Since the manifest parsing code may also be used by the bootloader it is part of the trusted computing base.¶
A manifest may not only be used to protect firmware images but also configuration data such as network credentials or personalization data related to firmware or software. Personalization data demonstrates the need for confidentiality to be maintained between two or more stakeholders that both deliver images to the same device. Personalization data is used with Trusted Execution Environments (TEEs), which benefit from a protocol for managing the lifecycle of trusted applications (TAs) running inside a TEE. TEEs may obtain TAs from different authors and those TAs may require personalization data, such as payment information, to be securely conveyed to the TEE. The TA's author does not want to expose the TA's code to any other stakeholder or third party. The user does not want to expose the payment information to any other stakeholder or third party.¶
Using firmware updates to fix vulnerabilities in devices is important but securing this update mechanism is equally important since security problems are exacerbated by the update mechanism: update is essentially authorized remote code execution, so any security problems in the update process expose that remote code execution system. Failure to secure the firmware update process will help attackers to take control over devices.¶
End-to-end security mechanisms are used to protect the firmware image and the manifest. The following assumptions are made to allow the firmware consumer to verify the received firmware image and manifest before updating software:¶
A manifest specification must support different cryptographic algorithms and algorithm extensibility. Moreover, since RSA- and ECC-based signature schemes may become vulnerable to quantum-accelerated key extraction in the future, unchangeable bootloader code in ROM is recommended to use post-quantum secure signature schemes such as hash-based signatures [RFC8778]. A bootloader author must carefully consider the service lifetime of their product and the time horizon for quantum-accelerated key extraction. The worst-case estimate, at time of writing, for the time horizon to key extraction with quantum acceleration is approximately 2030, based on current research [quantum-factorization].¶
When a device obtains a monolithic firmware image from a single author without any additional approval steps then the authorization flow is relatively simple. There are, however, other cases where more complex policy decisions need to be made before updating a device.¶
In this architecture the authorization policy is separated from the underlying communication architecture. This is accomplished by separating the entities from their permissions. For example, an author may not have the authority to install a firmware image on a device in critical infrastructure without the authorization of a device operator. In this case, the device may be programmed to reject firmware updates unless they are signed both by the firmware author and by the device operator.¶
Alternatively, a device may trust precisely one entity, which does all permission management and coordination. This entity allows the device to offload complex permissions calculations for the device.¶
Figure 2 illustrates an example message flow for distributing a firmware image to a device. The firmware and manifest are stored on the same firmware server and distributed in a detached manner.¶
Figure 3 shows an exchange that starts with the status tracker querying the device for its current firmware version. Later, a new firmware version becomes available and since this device is running an older version the status tracker server interacts with the device to initiate an update.¶
The manifest and the firmware are stored on different servers in this example. When the device processes the manifest it learns where to download the new firmware version. The firmware consumer downloads the firmware image with the newer version X.Y.Z after successful validation of the manifest. Subsequently, a reboot is initiated and the secure boot process starts. Finally, the device reports the successful boot of the new firmware version.¶
This document does not require any actions by IANA.¶
This document describes terminology, requirements and an architecture for firmware updates of IoT devices. The content of the document is thereby focused on improving security of IoT devices via firmware update mechanisms and informs the standardization of a manifest format.¶
An in-depth examination of the security considerations of the architecture is presented in [I-D.ietf-suit-information-model].¶
We would like to thank the following persons for their feedback:¶
We would also like to thank the WG chairs, Russ Housley, David Waltermire, Dave Thaler for their support and their reviews.¶