Draft: draft-ietf-suit-architecture

Commentary: First chunk of changes . 
 This is a really great set of edits . I think that it really improves the document as a whole ! I have suggested a couple of minor edits . Quick partial language review
Vulnerabilities with Internet of Things (IoT) devices have raised the
need for a solid and secure firmware update mechanism that is also
suitable for constrained devices.  Incorporating such update
mechanism to fix vulnerabilities, to update configuration settings as
well as adding new functionality is recommended by security experts.
This document lists requirements and describes an architecture for a
firmware update mechanism suitable for IoT devices.  The architecture
is agnostic to the transport of the firmware images and associated
meta-data.
When developing Internet of Things (IoT) devices, one of the most
difficult problems to solve is how to update firmware on the device.
Once the device is deployed, firmware updates play a critical part in
its lifetime, particularly when devices have a long lifetime, are
deployed in remote or inaccessible areas where manual intervention is
cost prohibitive or otherwise difficult.  Updates to the firmware of
an IoT device are done to fix bugs in software, to add new
functionality, and to re-configure the device to work in new
environments or to behave differently in an already deployed context.
The firmware image is authenticated and integrity protected.
Attempts to flash a modified firmware image or an image from an
unknown source are prevented.
The firmware image can be confidentiality protected so that
attempts by an adversary to recover the plaintext binary can be
prevented.  Obtaining the firmware is often one of the first steps
to mount an attack since it gives the adversary valuable insights
into used software libraries, configuration settings and generic
functionality (even though reverse engineering the binary can be a
tedious process).
This version of the document assumes asymmetric cryptography and a
public key infrastructure.  Future versions may also describe a
symmetric key approach for very constrained devices.
Vulnerabilities with 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 update
mechanism to fix vulnerabilities, to update configuration settings as
well as adding new functionality is recommended by security experts.
In addition to the definition of terminology and an architecture this
document motivates the standardization of a manifest format as
transport-agnostic means for describing and protecting firmware
updates.
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 insecurre 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, 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 automatic, i.e. without user
involvement.  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 to re-configure the device to work in new
environments or to behave differently in an already deployed context.
The firmware image is authenticated and integrity protected.
Attempts to flash a maliciously modified firmware image or an
image from an unknown, untrusted source must be prevented.  In
examples this document uses asymmetric cryptography because it is
the preferred approach by many IoT deployments.  The use of
symmetric credentials is also supported and can be used by very
constrained IoT devices.
The firmware image can be confidentiality protected so that
attempts by an adversary to recover the plaintext binary can be
mitigated or at least made more difficult.  Obtaining the firmware
is often one of the first steps to mount an attack since it gives
the adversary valuable insights into used software libraries,
configuration settings and generic functionality.  Even though
reverse engineering the binary can be a tedious process modern
reverse engineering frameworks have made this task a lot easier.
While the standardization work has been informed by and optimised 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
software updates, but can also be applied to managing the delivery of
arbitrary data, such as configuration information and keys.
More details about the security goals are discussed in architecture
and requirements are described in requirements.
While the standardization work has been informed by and optimised 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
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 are
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 uses and the sandbox the
software is executed in.
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.  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.
Installing firmware updates in a robust fashion so that the update
does not break the device functionality of the environment this
device operates in.  This requires proper testing and offering
recovery strategies when a firmware update is unsuccessful.
Making firmware updates available in a timely fashion considering
the complexity of the decision making process for updating
devices, potential re-certification requirements, the length of a
supply chain an update needs to go through before it reaches the
end customer, and the need for user consent to install updates.
Ensuring an energy efficient design of a battery-powered IoT
devices because a firmware update, particularly writing the
firmware image to flash, is a heavy task for a device.
Creating incentives for device operators to use a firmware update
mechanism and to demand the integration of it from IoT device
vendors.
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.
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.  Firmware is the more
universal term.  The terms, firmware image, firmware, and image,
are used in this document and are interchangeable.
Software: The terms "software" and "firmware" are used
interchangeably.
Bootloader: A bootloader is a piece of software that is executed
once a microcontroller has been reset.  It is responsible for
deciding whether to boot a firmware image that is present or
whether to obtain and verify a new firmware image.  Since the
bootloader is a security critical component its functionality may
be split into separate stages.  Such a multi-stage bootloader may
offer very basic functionality in the first stage and resides in
ROM whereas the second stage may implement more complex
functionality and resides in flash memory so that it can be
updated in the future (in case bugs have been found).  The exact
split of components into the different stages, the number of
firmware images stored by an IoT device, and the detailed
functionality varies throughout different implementations.  A more
detailed discussion is provided in bootloader.
Microcontroller (MCU for microcontroller unit): An MCU is a
compact integrated circuit designed for use in embedded systems.
A typical microcontroller includes a processor, memory (RAM and
flash), input/output (I/O) ports and other features connected via
some bus on a single chip.  The term 'system on chip (SoC)' is
often used for these types of devices.
System on Chip (SoC): An SoC is an integrated circuit that
integrates all components of a computer, such as CPU, memory,
input/output ports, secondary storage, etc.
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).
Microcontroller (MCU for microcontroller unit): An MCU is a
compact integrated circuit designed for use in embedded systems.
A typical microcontroller includes a processor, memory (RAM and
flash), input/output (I/O) ports and other features connected via
some bus on a single chip.  The term 'system on chip (SoC)' is
often used interchangeably with MCU, but MCU tends to imply more
limited peripheral functions.
System on Chip (SoC): An SoC is an integrated circuit that
contains all components of a computer, such as CPU, memory, input/
output ports, secondary storage, a bus to connect the components,
and other hardware blocks of logic.
Heterogeneous Storage Architecture (HeSA): A device that stores at
least one firmware component differently from the rest, for
example a device with an external, updatable radio, or a device
with internal and external flash memory.
Trusted Execution Environments (TEEs): An execution environment
that runs alongside of, but is isolated from, an REE.
Heterogeneous Storage Architecture (HeSA): A device that stores at
least one firmware component differently from the rest, for
example a device with an external, updateable radio, or a device
with internal and external flash memory.
Trusted Execution Environments (TEEs): An execution environment
that runs alongside of, but is isolated from, an REE.  For more
information about TEEs see I-D.ietf-teep-architecture.
For more information about TEEs see I-D.ietf-teep-architecture.  TEEP
requires the use of SUIT for delivering TAs.
Author: The author is the entity that creates the firmware image.
There may be multiple authors in a system either when a device
consists of multiple micro-controllers or when the the final
firmware image consists of software components from multiple
companies.
Trust Anchor Store: A trust anchor store, as defined in RFC6024,
is a set of one or more trust anchors stored in a device.  A
device may have more than one trust anchor store, each of which
may be used by one or more applications.  A trust anchor store
must resist modification against unauthorized insertion, deletion,
and modification.
Author: The author is the entity that creates the firmware image.
There may be multiple authors involved in producing firmware
running on an IoT device. device talks about those IoT device
deployment cases.
Device Operator: The device operator is responsible for the day-
to-day operation of a fleet of IoT devices.  Customers of IoT
devices, as the owners of IoT devices - such as enterprise
customers or end users, interact with their IoT devices indirectly
through the device operator via web or smart phone apps.
Network Operator: The network operator is responsible for the
operation of a network to which IoT devices connect.
Trust Provisioning Authority (TPA): The TPA distributes trust
anchors and authorization policies to various stakeholders.  The
TPA may also delegate rights to stakeholders.  For example, in
some cases, the Original Design Manufacturer (ODM), which is a
company that designs and manufactures a product, may act as a TPA
and may decide to remain in full control over the firmware update
process of their products.
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 device.  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.
Firmware Consumer: The firmware consumer is the recipient of the
firmware image and the manifest.  It is responsible for parsing
and verifying the received manifest and for storing the obtained
firmware image.  The firmware consumer plays the role of the
update component on the IoT device typically running in the
application firmware.  It interacts with the firmware server and
with the status tracker, if present.
Status Tracker: The status tracker offers device management
functionality to retrieve information about the installed firmware
on a device and other device characteristics (including free
memory and hardware components), to obtain the state of the
firmware update cycle the device is currently in, and to trigger
the update process.  The deployment of status trackers is flexible
and they may be used as cloud-based servers, on-premise servers,
embedded in edge computing device (such as Internet access
gateways or protocol translation gateways), or even in smart
phones and tablets.  IoT devices that self-initiate updates may
run a status tracker.  Similarly, IoT devices that act as a proxy
for other IoT devices in a protocol translation or edge computing
device node may also run a status tracker.  However, if the device
contains multiple MCUs, the main MCU may act as a limited status
tracker towards the other MCUs if updates are to be synchronized
across MCUs.  How much functionality a status tracker includes
depends on the selected configuration of the device management
functionality and the communication environment it is used in.  In
a generic networking environment the protocol used between the
client and the server-side of the status tracker need to deal with
Internet communication challenges involving firewall and NAT
traversal.  In other cases, the communication interaction may be
rather simple.  This architecture document does not impose
requirements on the status tracker.
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 but those
entities are often physically separated on different devices for
scalability reasons.
Device Operator: The actor responsible for the day-to-day
operation of a fleet of IoT devices.
Network Operator: The actor responsible for the operation of a
network to which IoT devices connect.
Claim: A piece of information asserted about a recipient or
payload.
In addition to the entities in the list above there is an orthogonal
infrastructure with a Trust Provisioning Authority (TPA) distributing
trust anchors and authorization permissions to various entities in
the system.  The TPA may also delegate rights to install, update,
enhance, or delete trust anchors and authorization permissions to
other parties in the system.  This infrastructure overlaps the
communication architecture and different deployments may empower
certain entities while other deployments may not.  For example, in
some cases, the Original Design Manufacturer (ODM), which is a
company that designs and manufactures a product, may act as a TPA and
may decide to remain in full control over the firmware update process
of their products.
"A trust anchor store is a set of one or more trust anchors stored
in a device.  A device may have more than one trust anchor store,
each of which may be used by one or more applications."  A trust
anchor store must resist modification against unauthorized
insertion, deletion, and modification.
Firmware images can be conveyed to devices in a variety of ways,
including USB, UART, WiFi, BLE, low-power WAN technologies, etc.  and
use different protocols (e.g., CoAP, HTTP).  The specified mechanism
needs to be agnostic to the distribution of the firmware images and
manifests.
This architecture does not specify any specific broadcast 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 Consumer: The firmware consumer is the recipient of the
firmware image and the manifest.  It is responsible for parsing
and verifying the received manifest and for storing the obtained
firmware image.  The firmware consumer plays the role of the
update component on the IoT device typically running in the
application firmware.  It interacts with the firmware server and
with the status tracker client (locally).
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.
Bootloader: A bootloader is a piece of software that is executed
once a microcontroller has been reset.  It is responsible for
deciding what code to execute.
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.  Updating updates over the Internet requires the device to
fetch the new firmware image as well as the manifest.
the Internet protocol stack for firmware downloads.  Because
firmware images are often multiple kilobytes, sometimes exceeding
one hundred kilobytes, in size for low end IoT devices and even
several megabytes large for IoT devices running full-fledged
operating systems like Linux, the protocol mechanism for
retrieving these images needs to offer features like congestion
control, flow control, fragmentation and reassembly, and
mechanisms to resume interrupted or corrupted transfers.
the capability to write the received firmware image to persistent
storage (most likely flash memory).
a manifest parser with code to verify a digital signature or a
message authentication code.
the ability to unpack, to decompress and/or to decrypt the
received firmware image.
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.
arch-figure 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.
Client-initiated updates take the form of a status tracker client
proactively checking (polling) for updates.
With Server-initiated updates the server-side component of the
status tracker learns about a new firmware version and determines
what devices qualify for a firmware update.  Once the relevant
devices have been selected, the status tracker informs these
devices and the firmware consumers obtain those images and
manifests.  Server-initiated updates are important because they
allow a quick response time.  Note that the client-side status
tracker needs to be reachable by the server-side component.  This
may require devices to keep reachability information on the
server-side up-to-date and state at NATs and stateful packet
filtering firewalls alive.
Using a hybrid approach the server-side of the status tracker
pushes notifications of availability of an update to the client
side and requests the firmware consumer to pull the manifest and
the firmware image from the firmware server.
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 desireable 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.
End-to-end security between the author and the device is shown in
architecture.
Authentication ensures that the device can cryptographically identify
the author(s) creating firmware images and manifests.  Authenticated
identities may be used as input to the authorization process.
Integrity protection ensures that no third party can modify the
manifest or the firmware image.
For confidentiality protection of the firmware image, it must be done
in such a way that every intended recipient can decrypt it.  The
information that is encrypted individually for each device must
maintain friendliness to Content Distribution Networks, bulk storage,
and broadcast protocols.
A manifest specification must support different cryptographic
algorithms and algorithm extensibility.  Due of the nature of
unchangeable code in ROM for use with bootloaders the use of post-
quantum secure signature mechanisms, such as hash-based signatures
RFC8778, are attractive.  These algorithms maintain security in
presence of quantum computers.
A mandatory-to-implement set of algorithms will be specified in the
manifest specification I-D.ietf-suit-manifest}.
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.
A power failure at any time must not cause a failure of the device.
Equally, adverse network conditions during an update must not cause
the failure of the device.  A failure to validate any part of an
update must not cause a failure of the device.  One way to achieve
this functionality is to provide a minimum of two storage locations
for firmware and one bootable location for firmware.  An alternative
approach is to use a 2nd stage bootloader with build-in full featured
firmware update functionality such that it is possible to return to
the update process after power down.
Note: This is an implementation requirement rather than a requirement
on the manifest format.
First, a bootloader must verify the firmware image it boots as
part of the secure boot process.  Doing so requires meta-data to
be stored alongside the firmware image so that the bootloader can
cryptographically verify the firmware image before booting it to
ensure it has not been tampered with or replaced.  This meta-data
used by the bootloader may well be the same manifest obtained with
the firmware image during the update process (with the severable
fields stripped off).
Second, an IoT device needs a recovery strategy in case the
firmware update / boot process fails.  The recovery strategy may
include storing two or more firmware images on the device or
offering the ability to have a second stage bootloader perform the
firmware update process again using firmware updates over serial,
USB or even wireless connectivity like a limited version of
Bluetooth Smart.  In the latter case the firmware consumer
functionality is contained in the second stage bootloader and
requires the necessary functionality for executing the firmware
update process, including manifest parsing.
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 risk in reliability.
All information necessary for a device to make a decision about the
installation of a firmware update must fit into the available RAM of
a constrained IoT device.  This prevents flash write exhaustion.
This is typically not a difficult requirement to accomplish because
there are not other task/processing running while the bootloader is
active (unlike it may be the case when running the application
firmware).
Note: This is an implementation requirement.
Since parsers are known sources of bugs, any parsers used to process
the manifest must be minimal.  Additionally, it must be easy to parse
only those fields that are required to validate at least one
signature or MAC with minimal exposure.
The design of the firmware update mechanism must not require changes
to existing firmware formats.
There are three broad classifications of update operating modes.
Client-initiated updates take the form of a firmware consumer on a
device proactively checking (polling) for new firmware images.
Server-initiated updates are important to consider because timing of
updates may need to be tightly controlled in some high- reliability
environments.  In this case the status tracker determines what
devices qualify for a firmware update.  Once those devices have been
selected the firmware server distributes updates to the firmware
consumers.
Note: This assumes that the status tracker is able to reach the
device, which may require devices to keep reachability information at
the status tracker up-to-date.  This may also require keeping state
at NATs and stateful packet filtering firewalls alive.
Hybrid updates are those that require an interaction between the
firmware consumer and the status tracker.  The status tracker pushes
notifications of availability of an update to the firmware consumer,
and it then downloads the image from a firmware server as soon as
possible.
While these broad classifications encompass the majority of operating
modes, some may not be covered in these classifications.  By
reinterpreting these modes as a set of operations performed by the
system as a whole, all operating modes can be represented.
This is a coarse-grained high level view of steps required to install
a new firmware.  By considering where in the system each of these
steps is performed, each operating mode can be represented.  Each of
these steps is broken down into smaller constituent parts.
architecture defines the steps taken from the perspective of the
communication between actors in the system. bootloader describes some
additional steps that a bootloader takes in addition to those
described here. example shows an example of the steps undertaken by
each party in the course of an update.
The notification step consists of the status tracker informing the
firmware consumer that an update is available.  This can be
accomplished via polling (client-initiated), push notifications
(server-initiated), or more complex mechanisms.
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 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-based firmware server is client-
initiated.  Pushing a manifest and firmware image to the transfer to
the Package resource of the LwM2M Firmware Update object LwM2M is
server-initiated.
If the firmware consumer has downloaded a new firmware image and is
ready to install it, it may need to wait for a trigger from the
status tracker to initiate the installation, may trigger the update
automatically, or may go through a more complex decision making
process to determine the appropriate timing for an update (such as
delaying the update process to a later time when end users are less
impacted by the update process).
Each of these steps may require different permissions.
The work on a standardized manifest format initially focused on the
most constrained IoT devices and those devices contain code put
together by a single author (although that author may obtain code
from other developers, some of it only in binary form).
Later it turns out that other use cases may benefit from a
standardized manifest format also for conveying software and even
personalization data alongside software.  Trusted Execution
Environments (TEEs), for example, greatly 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.
To support this wider range of use cases the manifest format should
therefore be extensible to convey other forms of payloads as well.
The credential used to authenticate these Claims must be directly or
indirectly related to the trust anchor installed at the device by the
Trust Provisioning Authority.
The baseline claims for all manifests are described in I-D.ietf-suit-
information-model.
arch-figure shows the communication architecture where a firmware
image is created by an author, and uploaded to a firmware server.
The firmware image/manifest is distributed to the device either in a
push or pull manner using the firmware consumer residing on the
device.  The device operator keeps track of the process using the
status tracker.  This allows the device operator to know and control
what devices have received an update and which of them are still
pending an update.
End-to-end security mechanisms are used to protect the firmware image
and the manifest although e2e-figure does not show the manifest
itself since it may be distributed independently.
Whether the firmware image and the manifest is pushed to the device
or fetched by the device is a deployment specific decision.
To accept an update, a device needs to verify the signature
covering the manifest.  There may be one or multiple manifests
that need to be validated, potentially signed by different
parties.  The device needs to be in possession of the trust
anchors to verify those signatures.  Installing trust anchors to
devices via the Trust Provisioning Authority happens in an out-of-
band fashion prior to the firmware update process.
Not all entities creating and signing manifests have the same
permissions.  A device needs to determine whether the requested
action is indeed covered by the permission of the party that
signed the manifest.  Informing the device about the permissions
of the different parties also happens in an out-of-band fashion
and is also a duty of the Trust Provisioning Authority.
For confidentiality protection of firmware images the author needs
to be in possession of the certificate/public key or a pre-shared
key of a device.  The use of confidentiality protection of
firmware images is deployment specific.
There are different types of delivery modes, which are illustrated
based on examples below.
There is an option for embedding a firmware image into a 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 stick or via Bluetooth Smart.
attached-firmware-figure shows this delivery mode graphically.
online-firmware-figure shows an option for remotely updating a device
where the device fetches the firmware image from some file server.
The manifest itself is delivered independently and provides
information about the firmware image(s) to download.
This architecture does not mandate a specific delivery mode but a
solution must support both types.
Does it trust the author of the update?
Has the firmware been corrupted?
Does the firmware update apply to this device?
Is the update older than the active firmware?
When should the device apply the update?
How should the device apply the update?
What kind of firmware binary is it?
Where should the update be obtained?
Where should the firmware be stored?
information about the device(s) the firmware image is intended to
be applied to,
information about when the firmware update has to be applied,
information about when the manifest was created,
dependencies on other manifests,
pointers to the firmware image and information about the format,
information about where to store the firmware image,
cryptographic information, such as digital signatures or message
authentication codes (MACs).
The manifest information model is described in I-D.ietf-suit-
information-model.
Although these documents attempt to define a firmware update
architecture that is applicable to both existing systems, as well as
yet-to-be-conceived systems; it is still helpful to consider existing
architectures.
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.  These systems either have a single
firmware image, or an immutable bootloader that runs a single image.
A notable characteristic of these SoCs is that the primary code is
generally execute in place (XIP).  Combined with the non-relocatable
nature of the code, firmware updates need to be done in place.
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.
architecture 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 hand
control over to the bootloader.
In most cases this requires the MCU to restart.  Once the MCU has
initiated a restart, the bootloader determines whether a newly
available firmware image should be executed.
A power failure at any time during a firmware update must not cause a
failure of the device.  Equally, adverse network conditions during an
update must not cause the failure of the device.
One way to achieve this functionality is to provide a minimum of two
storage locations for firmware.  An alternative approach is to use a
second stage bootloader with build-in full featured firmware update
functionality such that it is possible to return to the update
process after power down.
First, the bootloader is also firmware.  If a bootloader is
updatable then its firmware image is treated like any other
application firmware image.
Second, the firmware image that has to be replaced is still
available on the device as a backup in case the freshly downloaded
firmware image does not boot correctly.
Third, there is the newly downloaded firmware image.
Since many low end IoT devices use non-relocatable code, the
bootloader needs to copy the newly downloaded application firmware
image into the location of the old application firmware image and
vice versa.
The boot 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 bootloader to excute an attacker-
modified firmware image.  The bootloader will therefore have to
perform security checks on the firmware image before it can be
booted.  These security checks by the bootloader happen in addition
to the security checks that took place when the firmware image and
the manifest were downloaded by the firmware consumer.
A bootloader must verify the firmware image it boots as part of
the secure boot process.  Doing so requires meta-data to be stored
alongside the firmware image so that the bootloader can
cryptographically verify the firmware image before booting it to
ensure it has not been tampered with or replaced.  This meta-data
used by the bootloader may well be the same manifest obtained with
the firmware image during the update process (with the severable
fields stripped off).
An IoT device needs a recovery strategy in case the firmware
update / boot process fails.  As mentioned earlier, the recovery
strategy may include storing two or more application firmware
images on the device or offering the ability to have a second
stage bootloader perform the firmware update process again using
firmware updates over serial, USB or even wireless connectivity
like Bluetooth Smart.  In the latter case the firmware consumer
functionality is contained in the second stage bootloader and
requires the necessary functionality for executing the firmware
update process, including manifest parsing.
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.
The bootloader needs to fetch the manifest (or manifest-alike
headers) stored in flash memory alongside the firmware image and
parse their content for subsequent cryptographic verification.
Cryptographic libraries with hash functions, digital signatures
(for asymmetric crypto), keyed message digests (for symmetric
crypto) need to be accessible.
Ability to expose boot process-related data to the application
firmware (such as to the status tracker).  This allows to share
information about the current firmware version, and the status of
the firmware update process and whether errors have occurred.
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, then the
firmware image is updated it is necessary to swap the old and the new
image.
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 in a single SoC
that share memory (flash and RAM).  Generally, they will be a
protection mechanism to prevent one CPU from accessing the other's
memory.  Upgrades in this case will typically be done by one of the
CPUs, and is similar to the single CPU with secure mode.
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 in a single SoC
that share memory (flash and RAM).  Generally, there will be a
mechanism to prevent one CPU from unintentionally accessing memory
currently allocated to the other.  Upgrades in this case will
typically be done by one of the CPUs, and is similar to the single
CPU with secure mode.
the Internet protocol stack for firmware downloads (*),
the capability to write the received firmware image to persistent
storage (most likely flash memory) prior to performing the update,
the ability to unpack, decompress or otherwise process the
received firmware image,
the features to verify an image and a manifest, including digital
signature verification or checking a message authentication code,
integration of the device into a device management server to
perform automatic firmware updates and to track their progress.
All these features are most likely offered by the application, i.e.
firmware consumer, running on the device (except for basic security
algorithms that may run either on a trusted execution environment or
on a separate hardware security MCU/module) rather than by the
bootloader itself.
Once manifests have been processed and firmware images successfully
downloaded and verified the device needs to hand control over to the
bootloader.  In most cases this requires the MCU to restart.  Once
the MCU has initiated a restart, the bootloader takes over control
and determines whether the newly downloaded firmware image should be
executed.
The boot process is security sensitive because the firmware images
may, for example, be stored in off-chip flash memory giving attackers
easy access to the image for reverse engineering and potentially also
for modifying the binary.  The bootloader will therefore have to
perform security checks on the firmware image before it can be
booted.  These security checks by the bootloader happen in addition
to the security checks that happened when the firmware image and the
manifest were downloaded.
The manifest may have been stored alongside the firmware image to
allow re-verification of the firmware image during every boot
attempt.  Alternatively, secure boot-specific meta-data may have been
created by the application after a successful firmware download and
verification process.  Whether to re-use the standardized manifest
format that was used during the initial firmware retrieval process or
whether it is better to use a different format for the secure boot-
specific meta-data depends on the system design.  The manifest format
does, however, have the capability to serve also as a building block
for secure boot with its severable elements that allow shrinking the
size of the manifest by stripping elements that are no longer needed.
In order to satisfy the reliability requirements defined in
reliability, devices must always be able to return to a working
firmware image.  This has implications for the design of the
bootloader: If the firmware image contains the firmware consumer
functionality, as described above, then the bootloader must be able
to roll back to a working firmware image.  Alternatively, the
bootloader may have enough functionality to fetch a firmware image
plus manifest from a firmware server over the Internet.  A multi-
stage bootloader may soften this requirement at the expense of a more
sophisticated boot process.
ability to access security algorithms, such as SHA-256 to compute
a fingerprint over the firmware image and a digital signature
algorithm.
access keying material directly or indirectly to utilize the
digital signature.  The device needs to have a trust anchor store.
ability to expose boot process-related data to the application
firmware (such as to the device management software).  This allows
a device management server to determine whether the firmware
update has been successful and, if not, what errors occurred.
to (optionally) offer attestation information (such as
measurements).
While the software architecture of the bootloader and its security
mechanisms are implementation-specific, the manifest can be used to
control the firmware download from the Internet in addition to
augmenting secure boot process.  These building blocks are highly
relevant for the design of the manifest.
firmware-update illustrates an example message flow for distributing
a firmware image to a device starting with an author uploading the
new firmware to firmware server and creating a manifest.  The
firmware and manifest are stored on the same firmware server.  This
setup does not use a status tracker and the firmware consumer
component is therefore responsible for periodically checking whether
a new firmware image is available for download.
firmware-update2 shows an example follow with the device using a
status tracker.  For editorial reasons the author publishing the
manifest at the status tracker and the firmware image at the firmware
server is not shown.  Also omitted is the secure boot process
following the successful firmware update process.
The exchange starts with the device interacting with the status
tracker; the details of such exchange will vary with the different
device management systems being used.  In any case, the status
tracker learns about the firmware version of the devices it manages.
In our example, the device under management is using firmware version
A.B.C.  At a later point in time the author uploads a new firmware
along with the manifest to the firmware server and the status
tracker, respectively.  While there is no need to store the manifest
and the firmware on different servers this example shows a common
pattern used in the industry.  The status tracker may then
automatically, based on human intervention or based on a more complex
policy decide to inform the device about the newly available firmware
image.  In our example, it does so by pushing the manifest to the
firmware consumer.  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.
Firmware updates fix security vulnerabilities and are considered to
be an important building block in securing IoT devices.  Due to the
importance of firmware updates for 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 big picture.  A report about this workshop can be found at
RFC8240.  A standardized firmware manifest format providing end-to-
end security from the author to the device will be specified in a
separate document.
installing firmware updates in a robust fashion so that the update
does not break the device functionality of the environment this
device operates in.
installing firmware updates in a timely fashion considering the
complexity of the decision making process of updating devices,
potential re-certification requirements, and the need for user
consent to install updates.
the distribution of the actual firmware update, potentially in an
efficient manner to a large number of devices without human
involvement.
energy efficiency and battery lifetime considerations.
key management required for verifying the digital signature
protecting the manifest.
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.
manifest-info provides examples of decisions to be made.
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
personalization data related to firmware or software.  Trusted
Execution Environments (TEEs), for example, 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.
Using firmware updates to fix vulnerabilities in devices is important
but securing this update mechanism is equally important since
security problems are exacerbated.  Failure to secure the firmware
update process will help attackers to take control over devices.
Authentication ensures that the device can cryptographically
identify the author(s) creating firmware images and manifests.
Authenticated identities may be used as input to the authorization
process.  Not all entities creating and signing manifests have the
same permissions.  A device needs to determine whether the
requested action is indeed covered by the permission of the party
that signed the manifest.  Informing the device about the
permissions of the different parties also happens in an out-of-
band fashion and is also a duty of the Trust Provisioning
Authority.
Integrity protection ensures that no third party can modify the
manifest or the firmware image.  To accept an update, a device
needs to verify the signature covering the manifest.  There may be
one or multiple manifests that need to be validated, potentially
signed by different parties.  The device needs to be in possession
of the trust anchors to verify those signatures.  Installing trust
anchors to devices via the Trust Provisioning Authority happens in
an out-of-band fashion prior to the firmware update process.
For confidentiality protection of the firmware image, it must be
done in such a way that the intended firmware consumer(s) can
decrypt it.  The information that is encrypted individually for
each device must maintain friendliness to Content Distribution
Networks, bulk storage, and broadcast protocols.  For
confidentiality protection of firmware images the author needs to
be in possession of the certificate/public key or a pre-shared key
of a device.  The use of confidentiality protection of firmware
images is optional.
A manifest specification must support different cryptographic
algorithms and algorithm extensibility.  Due of the nature of
unchangeable code in ROM for bootloaders the use of post-quantum
secure signature mechanisms, such as hash-based signatures RFC8778,
are attractive.  These algorithms maintain security in presence of
quantum computers.
firmware-update 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.
firmware-update2 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.