<?xml version="1.0" encoding="UTF-8"?>
  <?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
  <!-- generated by https://github.com/cabo/kramdown-rfc2629 version 1.0.36 -->

<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
]>

<?rfc rfcedstyle="yes"?>
<?rfc toc="yes"?>
<?rfc tocindent="yes"?>
<?rfc sortrefs="yes"?>
<?rfc symrefs="yes"?>
<?rfc strict="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<?rfc text-list-symbols="-o*+"?>
<?rfc docmapping="yes"?>

<rfc ipr="pre5378Trust200902" docName="draft-moran-fud-architecture-00" category="info">

  <front>
    <title abbrev="IoT Firmware Update Architecture">A Firmware Update Architecture for Internet of Things Devices</title>

    <author initials="B." surname="Moran" fullname="Brendan Moran">
      <organization>ARM Limited</organization>
      <address>
        <email>Brendan.Moran@arm.com</email>
      </address>
    </author>
    <author initials="M." surname="Meriac" fullname="Milosch Meriac">
      <organization>ARM Limited</organization>
      <address>
        <email>Milosch.Meriac@arm.com</email>
      </address>
    </author>
    <author initials="H." surname="Tschofenig" fullname="Hannes Tschofenig">
      <organization>ARM Limited</organization>
      <address>
        <email>hannes.tschofenig@gmx.net</email>
      </address>
    </author>

    <date year="2017" month="July" day="18"/>

    <area>Security</area>
    
    <keyword>Internet-Draft</keyword>

    <abstract>


<t>Vulnerabilities with 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.</t>

<t>This document specifies requires and an architecture for a firmware update mechanism aimed for Internet of Things (IoT) devices. The architecture is agnostic to the transport of the firmware images and associated meta-data.</t>

<t>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.</t>



    </abstract>


  </front>

  <middle>


<section anchor="introduction" title="Introduction">

<t>When developing IoT devices, one of the most difficult problems to solve is how to update the 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 or where manual intervention is cost prohibitive or otherwise difficult:
- Fixes to bugs in software can be applied to the device with a firmware update.
- New functionality can be added to the device with a firmware update.</t>

<t>The firmware update process has to ensure that
- The firmware is authenticated (attempts to flash a malicious firmware are prevented).
- The firmware can be confidentiality protected (attempts by an adversary to recover the plaintext binary can be prevented).</t>

</section>
<section anchor="conventions-and-terminology" title="Conventions and Terminology">

<t>The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”,
“SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this
document are to be interpreted as described in RFC 2119 <xref target="RFC2119"/>.</t>

<t>This document uses the following entities:</t>

<t><list style="symbols">
  <t>Author: The author is the entity that creates the firmware image, signs and/or encrypts it and attaches a manifest to it. The author is most likely a developer using a set of tools. In some deployments the author only triggers the signing/encryption but the actual cryptographic operation are executed by a service or by a party on behalf of the developer.</t>
  <t>Device: The device is the recipient of the firmware image and the manifest. The goal is to update the firmware of the device.</t>
  <t>Untrusted Storage: Firmware images and manifests are stored on untrusted fileservers or cloud storage infrastructure. Some deployments may require storage of the firmware images/manifests to be stored on various entities before they reach the device.</t>
</list></t>

<t>Additionally, the following terms are defined:</t>

<t><list style="symbols">
  <t>Manifest: The manifest contains meta-data about the firmware image and is protected against modification.</t>
  <t>Firmware Image: The firmware 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. The image may consist of a differential update for performance reasons.</t>
</list></t>

</section>
<section anchor="requirements" title="Requirements">

<t>The firmware update mechanism described in this specification was designed with the following requirements in mind:</t>

<t><list style="symbols">
  <t>Agnostic to how firmware images are distributed</t>
  <t>Friendly to broadcast delivery</t>
  <t>Uses state-of-the-art security mechanisms</t>
  <t>Operates with a small bootloader</t>
  <t>Minimal impact on existing firmware formats</t>
  <t>Robust permissions</t>
</list></t>

<section anchor="agnostic-to-how-firmware-images-are-distributed" title="Agnostic to how firmware images are distributed">
<t>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 protocol mechanisms (e.g., CoAP, HTTP). The specified mechanism needs to be agnostic to the distribution of the firmware images/manifests.</t>

</section>
<section anchor="friendly-to-broadcast-delivery" title="Friendly to broadcast delivery">
<t>For an update to be broadcast friendly, it must not rely on any transport security. In addition, the same message 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.</t>

</section>
<section anchor="uses-state-of-the-art-security-mechanisms" title="Uses state-of-the-art security mechanisms">
<t>End-to-end security between the author and the device, as shown in <xref target="architecture"/>, is used to ensure that the device can verify firmware images and manifests produced by authorized authors.</t>

<t>If the update payload is to be encrypted, 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 be an absolute minimum.</t>

<t>Rollback attacks must be prevented.</t>

<t>All information necessary for a device to make a decision about the installation of an update must fit into the available RAM of a constrained IoT device. This prevents flash write exhaustion.</t>

<t>Since parsers are known sources of bugs it must be easy to parse only those fields which are required to validate at least one signature with minimal exposure.</t>

</section>
<section anchor="high-reliability" title="High reliability">
<t>A power failure at any time must not cause a failure of the device. A failure to validate any part of an update must not cause a failure of the device. To achieve this, the device is required to provide a minimum of two storage locations for firmware and one bootable location for firmware. Note: This is an implementation requirement rather than a requirement on the manifest format.</t>

</section>
<section anchor="minimal-bootloader" title="Minimal bootloader">
<t>The bootloader must be minimal, containing only the flash and cryptographic primitives necessary to read the stored firmware, validate the received firmware, and write the bootable firmware. The bootloader should not require updating, since a failed update poses a risk in reliability. If more functionality is required in the bootloader, it must use a two-stage bootloader, with the first stage comprising the functionality defined above.</t>

</section>
<section anchor="minimal-impact-on-existing-firmware-formats" title="Minimal impact on existing firmware formats">
<t>The firmware update must not require changes to existing firmware formats.</t>

</section>
<section anchor="robust-permissions" title="Robust permissions">
<t>A device may have many modules that require updating individually. It may also need to trust several different actors in order to authorize an update. For example, a firmware author may not have the authority to install firmware on a device in critical infrastructure without the authorization of a device operator. In this case, the device should reject firmware updates unless they are signed both by the firmware author and by the device operator.</t>

<t>To facilitate complex use-cases such as this, updates require several permissions:</t>

<t><list style="symbols">
  <t>Author</t>
  <t>Store</t>
  <t>Apply</t>
  <t>Approve</t>
  <t>Qualify</t>
</list></t>

</section>
</section>
<section anchor="architecture" title="Architecture">

<t>The architecture graphically shown below illustrates that an author creates a firmware image and a manifest. The firmware image may be encrypted and will be integrity protected. The meta-data is integrity protected. When the author is ready to distribute the firmware image it conveys it using his or her favorite communication channel to the device, which will typically involve the use of untrusted storage, like a file server. Whether the firmware image and the manifest is pushed to the device or fetched by the device is outside the scope of this work and existing device management protocols can be used for efficiently distributing this information.</t>

<t>The following assumptions are made to allow the device to verify the received firmware image and manifest before updating software:</t>

<t><list style="symbols">
  <t>To accept an update, a device needs to decide whether the author signing the firmware image and the manifest is authorized to make the updates. We use public key cryptography to accomplish this. The device verifies the signature covering the manifest using a digital signature algorithm. The device is provisioned with a trust anchor that is used to validate the digital signature produced by the author.  This trust anchor is potentially different from the trust anchor used to validate the digital signature produced for other protocols (such as device management protocols). This trust anchor may be provisioned to the device during manufacturing.</t>
  <t>For confidentiality protection of firmware imagines the author needs to be in possession of the certificate/public key of a device.</t>
</list></t>

<figure><artwork><![CDATA[
                             +-----------+
 +--------+  Firmware Image  |           |   Firmware Image  +--------+
 |        |  + Manifest      | Untrusted |   + Manifest      |        |
 | Device |<-----------------| Storage   |<------------------| Author |
 |        |                  |           |                   |        |
 +--------+                  +-----------+                   +--------+
      ^                                                          *
      *                                                          *
      ************************************************************
                         End-to-End Security
]]></artwork></figure>

</section>
<section anchor="manifest" title="Manifest">

<t>In order for a device to apply an update, it has to make several decisions about the update:</t>

<t><list style="symbols">
  <t>Does it trust the author of the update?</t>
  <t>Has the firmware been corrupted?</t>
  <t>Does the firmware update apply to this device?</t>
  <t>Is the update older than the active firmware?</t>
  <t>When should the device apply the update?</t>
  <t>How should the device apply the update?</t>
  <t>What kind of firmware binary is it?</t>
  <t>Where should the update be obtained?</t>
  <t>Where should the firmware be stored?</t>
</list></t>

<t>The manifest format encodes the information that devices need in order to make these decisions.</t>

</section>
<section anchor="manifest-1" title="Manifest">

<t>The manifest is a data structure that contains the following information:</t>

<t><list style="symbols">
  <t>information about the device(s) the firmware image is intented to be applied to,</t>
  <t>information about when the firmware update has to be applied,</t>
  <t>information about when the manifest was created,</t>
  <t>dependencies to other manifests,</t>
  <t>pointers to the firmware image and information about the format,</t>
  <t>information about where to store the firmware image,</t>
  <t>cryptographic information, such as digital signatures.</t>
</list></t>

<t>The manifest structure is described in a companion document.</t>

</section>
<section anchor="example-flow" title="Example Flow">

<t>The following example message flow illustrates the
interaction for distributing a firmware image to a device
starting with an author uploading the new firmware to
untrusted storage and creating a manifest.</t>

<figure><artwork><![CDATA[
+--------+    +-----------------+      +------+
| Author |    |Untrusted Storage|      |Device|
+--------+    +-----------------+      +------+
  |                   |                     |
  | Create Firmware   |                     |
  |---------------    |                     |
  |              |    |                     |
  |<--------------    |                     |
  |                   |                     |
  | Upload Firmware   |                     |
  |------------------>|                     |
  |                   |                     |
  | Create Manifest   |                     |
  |----------------   |                     |
  |               |   |                     |
  |<---------------   |                     |
  |                   |                     |
  | Sign Manifest     |                     |
  |--------------     |                     |
  |             |     |                     |
  |<-------------     |                     |
  |                   |                     |
  | Upload Manifest   |                     |
  |------------------>|                     |
  |                   |                     |
  |                   |   Query Manifest    |
  |                   |<--------------------|
  |                   |                     |
  |                   |   Send Manifest     |
  |                   |-------------------->|
  |                   |                     |
  |                   |                     | Validate Manifest
  |                   |                     |------------------
  |                   |                     |                 |
  |                   |                     |<-----------------
  |                   |                     |
  |                   |  Request Firmware   |
  |                   |<--------------------|
  |                   |                     |
  |                   | Send Firmware       |
  |                   |-------------------->|
  |                   |                     |
  |                   |                     | Verify Firmware
  |                   |                     |---------------
  |                   |                     |              |
  |                   |                     |<--------------
  |                   |                     |
  |                   |                     | Store Firmware
  |                   |                     |--------------
  |                   |                     |             |
  |                   |                     |<-------------
  |                   |                     |
  |                   |                     | Reboot
  |                   |                     |-------
  |                   |                     |      |
  |                   |                     |<------
  |                   |                     |
  |                   |                     | Bootloader validates
  |                   |                     | Firmware
  |                   |                     |----------------------
  |                   |                     |                     |
  |                   |                     |<---------------------
  |                   |                     |
  |                   |                     | Bootloader activates
  |                   |                     | Firmware
  |                   |                     |----------------------
  |                   |                     |                     |
  |                   |                     |<---------------------
  |                   |                     |
  |                   |                     | Bootloader transfers
  |                   |                     | control to new Firmware
  |                   |                     |----------------------
  |                   |                     |                     |
  |                   |                     |<---------------------
  |                   |                     |       
]]></artwork></figure>

</section>
<section anchor="iana-considerations" title="IANA Considerations">

<t>This document does not require any actions by IANA.</t>

</section>
<section anchor="security-considerations" title="Security Considerations">

<t>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 <xref target="I-D.iab-iotsu-workshop"/>. This document (and associated specifications) offer a standardized firmware manifest format and an approach for offering end-to-end security from the author to the device.</t>

<t>There are, however, many other considerations raised during the workshop. Many of them are outside the scope of standardization organizations since they fall into the realm of product engineering, regulatory frameworks, and business models. The following considerations are outside the scope of this document, namely</t>

<t><list style="symbols">
  <t>installing firmware updates in a robust fashion so that the update does not break the device functionality of the environment this device operates in.</t>
  <t>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’s consent to install updates.</t>
  <t>the distribution of the actual firmware update, potentially in an efficient manner to a large number of devices without human involvement.</t>
  <t>energy efficiency and battery lifetime considerations.</t>
  <t>key management required for verifying the digitial signature protecting the manifest.</t>
  <t>incentives for manufacturers to offer a firmware update mechanism as part of their IoT products.</t>
</list></t>

</section>
<section anchor="mailing-list-information" title="Mailing List Information">

<t>The discussion list for this document is located at the e-mail
address <eref target="mailto:fud@ietf.org">fud@ietf.org</eref>. Information on the group and information on how to
subscribe to the list is at <eref target="https://www1.ietf.org/mailman/listinfo/fud">https://www1.ietf.org/mailman/listinfo/fud</eref></t>

<t>Archives of the list can be found at:
<eref target="https://www.ietf.org/mail-archive/web/fud/current/index.html">https://www.ietf.org/mail-archive/web/fud/current/index.html</eref></t>

</section>
<section anchor="acknowledgements" title="Acknowledgements">

<t>We would like the following persons for their support in designing this mechanism</t>

<t><list style="symbols">
  <t>Geraint Luff</t>
  <t>Amyas Phillips</t>
  <t>Dan Ros</t>
</list></t>

</section>


  </middle>

  <back>

    <references title='Normative References'>





<reference  anchor='RFC2119' target='http://www.rfc-editor.org/info/rfc2119'>
<front>
<title>Key words for use in RFCs to Indicate Requirement Levels</title>
<author initials='S.' surname='Bradner' fullname='S. Bradner'><organization /></author>
<date year='1997' month='March' />
<abstract><t>In many standards track documents several words are used to signify the requirements in the specification.  These words are often capitalized. This document defines these words as they should be interpreted in IETF documents.  This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.</t></abstract>
</front>
<seriesInfo name='BCP' value='14'/>
<seriesInfo name='RFC' value='2119'/>
<seriesInfo name='DOI' value='10.17487/RFC2119'/>
</reference>




    </references>

    <references title='Informative References'>





<reference anchor='I-D.iab-iotsu-workshop'>
<front>
<title>Report from the Internet of Things (IoT) Software Update (IoTSU) Workshop 2016</title>

<author initials='H' surname='Tschofenig' fullname='Hannes Tschofenig'>
    <organization />
</author>

<author initials='S' surname='Farrell' fullname='Stephen Farrell'>
    <organization />
</author>

<date month='February' day='3' year='2017' />

<abstract><t>This document provides a summary of the '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.  The main goal of the workshop was to foster a discussion on requirements, challenges and solutions for bringing software and firmware updates to IoT devices.  This report summarizes the discussions and lists recommendations to the standards community.</t></abstract>

</front>

<seriesInfo name='Internet-Draft' value='draft-iab-iotsu-workshop-01' />
<format type='TXT'
        target='http://www.ietf.org/internet-drafts/draft-iab-iotsu-workshop-01.txt' />
</reference>




    </references>



  </back>
</rfc>

