github.com/google/trillian-examples@v0.0.0-20240520080811-0d40d35cef0e/binary_transparency/firmware/docs/design/README.md (about)

     1  # Firmware Transparency demo design
     2  
     3  This doc gives an overview of the design for this Firmware Transparency (FT)
     4  demo.
     5  
     6  ## Threat model
     7  
     8  1. Insider risk:
     9     An attacker has privileged control over what gets built into firmware
    10    images, or is able to leverage/coerce action from legitimate employees.
    11    1. Subvert code-review process (force push)
    12       No access to firmware signing key, but can attempt to quietly modify
    13       the source tree.
    14       Notes:
    15         * should be visible with code-review enforcement, commit audit etc.
    16         * FT enables impact to be known (how many, and which builds were
    17             affected)
    18    1. Build firmware from patched tree
    19       Able to modify source tree prior to build pipeline, no direct access to
    20       firmware signing key, but pipeline will result in signed firmware.
    21       Notes:
    22         * Patched builds must be logged, or they are useless.
    23         * FT enables discoverability for automatic detection if reproducible
    24             builds are possible, and manual forensic inspection if not. Either
    25             way, evidence is publicly available.
    26    1. Full control of signing key.
    27       Able to sign arbitrary firmware images outside of any existing controls
    28       or audit.
    29  1. External/down-stream supply chain:
    30       This group of attacks is mostly mitigated through the use of signed
    31       firmware.
    32    1. Compromised firmware download server (e.g. CDN)
    33       Can replace/modify firmware update files made available for download/
    34       distribution.
    35         * DoS/block updates
    36         * Rollbacks
    37    1. On-path adversary for firmware downloads
    38       Can intercept and modify firmware update downloads.
    39  1. Device-local risk
    40    1. Compromised local-machine used to update device firmware
    41       Attacker can modify downloaded firmware update files, and run arbitrary
    42       code on local machine used to update firmware on target device.
    43         * Can DoS/block updates
    44         * Rollback updates?
    45    1. Physical access to low-level interfaces on target device
    46       Attacker has arbitrary access to the device whose firmware is to be
    47       updated.
    48  1. TODO(al): flesh this out.
    49  
    50  ## Claimant Model
    51  
    52  To help reason about the security properties of the demo system, we'll frame
    53  the problem in terms of the
    54  [claimant model](https://github.com/google/trillian/tree/master/docs/claimantmodel).
    55  
    56  ### Assumptions/Requirements
    57  **All firmware metadata & image bytes are publicly available.**
    58  For now, we'll keep things simple and assume that firmware is made freely
    59  available by the vendor.
    60  
    61  ### Model
    62  
    63  This model builds in the idea of a firmware manifest file while commits to the
    64  contents of the firmware image along with some metadata.
    65  
    66  #### **System<sup>FIRMWARE</sup>**:
    67  System<sup>FIRMWARE</sup> talks only about the claims inherent in the signature
    68  over the firmware made by the firmware vendor.
    69  
    70     * **Claim<sup>FIRMWARE</sup>**
    71      _I, Vendor, claim that the firmware described by this manifest_:
    72        1. has cryptographic hash X
    73        1. is unique for the specified {device, class, version} tuple
    74        1. is functionally correct, and without known attack vectors
    75  *   **Statement<sup>FIRMWARE</sup>**: signed firmware manifest file
    76  *   **Claimant<sup>FIRMWARE</sup>**: firmware vendor
    77  *   **Believer<sup>FIRMWARE</sup>**:
    78       1. firmware update client
    79       1. target device bootloader/rom
    80  *   **Verifier<sup>FIRMWARE</sup>**: third parties<br>
    81      These entities would check for any invalidation of the claims above.
    82      There are many possible types of entity who may have an interest in
    83      performing this role, e.g.:
    84        * vendor themselves (_"has my identity been compromised?"_)
    85        * other vendors
    86        * AV/analysis companies/organisations with large security teams
    87        * security researchers
    88        * large organisations who already regularly look at firmware for their
    89          fleet
    90        * governments
    91  *   **Arbiter<sup>FIRMWARE</sup>**:<br>
    92      There's no official body, but invalidated claims would affect reputation,
    93      possibly draw recourse through law.
    94  
    95  
    96  #### **System<sup>FIRMWARE_LOG<sup>**:
    97  System<sup>FIRMWARE_LOG</sup> talks only about the claims made by the log
    98  operator(s), and is the basis for providing _discoverability_ into
    99  System<sup>FIRMWARE</sup> above.
   100  
   101  *  **Claim<sup>FIRMWARE_LOG</sup>**:
   102     _I, log operator, make available:_
   103        * A globally consistent, append-only log of
   104          **Statement<sup>FIRMWARE</sup>**
   105        * All firmware preimages corresponding to the
   106          **Statement<sup>FIRMWARE</sup>** stored in the log.
   107  *  **Statement<sup>FIRMWARE_LOG</sup>**: log checkpoint (_"Signed tree head"_)
   108  *  **Claimant<sup>FIRMWARE_LOG</sup>**: log operator<br>
   109     Possible operators might be:
   110       * Chip IP licensor
   111       * SoC vendor
   112       * system integrator
   113       * members of relevant consortia
   114  *  **Believer<sup>FIRMWARE_LOG</sup>**:
   115       * **Believer<sup>FIRMWARE</sup>**
   116       * **Verifier<sup>FIRMWARE</sup>**
   117  *  **Verifier<sup>FIRMWARE_LOG</sup>**:
   118     Possible log verifiers (who can check the log claims above?):
   119       * other log operators
   120       * other entities from list of claimants above
   121       * interested enthusiasts
   122       * log verifiers from other Transparency ecosystems (e.g. CT, golang, etc.)
   123  * **Arbiter<sup>FIRMWARE_LOG</sup>**:
   124    Who can kick a log out for misbehaving?
   125  
   126  ## Overview
   127  
   128  The design for the demo consists of a number of different entities which play
   129  the roles described in the claimant model above, these are shown in the
   130  following diagram:
   131  
   132  ![ov](./overview.svg)
   133  <details>
   134  <summary>Diagram source</summary>
   135  <!--
   136  This is an embedded PlantUML config for the overview diagram.
   137  If you change it, be sure to update the generated diagram by running `plantuml -tsvg  README.md`!
   138  -->
   139  @startuml overview
   140  !include ./diagrams/puml/style.puml
   141  
   142  package "FT Log" #LOG_COLOUR_4 {
   143    FA5_SERVER(personality,FT Personality,rectangle,LOG_COLOUR_0) #LOG_COLOUR_2
   144    FA5_FILE(cas,Firmware\nImages,database,LOG_COLOUR_0) #LOG_COLOUR_2
   145    personality -right-> cas
   146  
   147    package "Trillian" #LOG_COLOUR_3 {
   148      FA5_SITEMAP(log,Log,rectangle,LOG_COLOUR_0) #LOG_COLOUR_1
   149      FA5_FILE(metadata,Firmware\nmetadata,database,LOG_COLOUR_0) #LOG_COLOUR_1
   150      log -right-> metadata
   151    }
   152  
   153    personality -down-> log
   154  }
   155  
   156  package "Firmware Vendor" #VENDOR_COLOUR_2 {
   157    FA5_USER_TIE(publisher,Firmware Publisher,rectangle,VENDOR_COLOUR_0) #VENDOR_COLOUR_1
   158    FA5_EYE(vendor_monitor,Firmware Vendor Monitor,rectangle,VENDOR_COLOUR_0) #VENDOR_COLOUR_1
   159  
   160    publisher -right--> personality: Publish firmware
   161    vendor_monitor -right----> personality: Observe firmware
   162  }
   163  
   164  package "Device" #DEVICE_COLOUR_2 {
   165    FA5_COGS(update,Update client,rectangle,DEVICE_COLOUR_0) #DEVICE_COLOUR_1
   166    FA5_MOBILE_ALT(device,Device,rectangle,DEVICE_COLOUR_0) #DEVICE_COLOUR_1
   167  
   168    update -down-> device: Update
   169    update -right----> personality: Verify consistency
   170  }
   171  
   172  package "Observers" #OBS_COLOUR_2 {
   173    FA5_EYE(monitor,FT Monitor,rectangle,OBS_COLOUR_0) #OBS_COLOUR_1
   174  
   175    monitor -down----> personality: Observe firmware
   176  }
   177  
   178  publisher -[dotted]----> update: Update available
   179  
   180  @enduml
   181  </details>
   182  
   183  For clarity, the mapping of actors to the claimant model roles, along with
   184  software provided by the demo used to fulfil those roles, are listed explicitly
   185  here:
   186  
   187  **Firmware vendor**:
   188  
   189  Uses the [`publisher`](/binary_transparency/firmware/cmd/publisher) to publish
   190  firmware metadata & images to the log, and create an "OTA" update bundle:
   191  
   192  * Claimant<sup>FIRMWARE</sup>
   193  
   194  Also uses the [`ft_monitor`](/binary_transparency/firmware/cmd/ft_monitor) to
   195  check for unexpected firmware apparently issued by the vendor, so additionally
   196  plays the following roles:
   197  
   198  * Believer<sup>FIRMWARE_LOG</sup>
   199  * Verifier<sup>FIRMWARE</sup>
   200  * Verifier<sup>FIRMWARE_LOG</sup> (when used with STH Witness)
   201  
   202  **Update client**:
   203  
   204  Uses the [`flash_tool`](/binary_transparency/firmware/cmd/flash_tool) to verify
   205  and install the update bundle provided by the vendor onto the device.
   206  
   207  * Believer<sup>FIRMWARE</sup>
   208  * Believer<sup>FIRMWARE_LOG</sup>
   209  * Verifier<sup>FIRMWARE_LOG</sup> (when used with STH Witness)
   210  
   211  **Target device (toaster)**:
   212  
   213  Device implementations:
   214  * [`emulator/dummy`](/binary_transparency/firmware/cmd/emulator/dummy) models
   215  a simple WASM VM device.
   216  * [`usbarmory`](/binary_transparency/firmware/devices/usbarmory) provides an
   217  enforcing EL3 bootloader for the F-Secure
   218  [USB Armory mkII](https://inversepath.com/usbarmory.html).
   219  
   220  These implementation rely on most of the same verification logic as the
   221  [`flash_tool`](/binary_transparency/firmware/cmd/flash_tool) to verify the
   222  proofs stored alongside the firmware in the device.
   223  
   224  * Believer<sup>FIRMWARE</sup>
   225  * Believer<sup>FIRMWARE_LOG</sup>
   226  
   227  **Log**:
   228  
   229  Uses the [`ft_personality`](/binary_transparency/firmware/cmd/ft_personality)
   230  along with [Trillian](https://github.com/google/trillian) to provide the
   231  _discoverability_ that Firmware Transparency leverages.
   232  
   233  * Claimant<sup>FIRMWARE_LOG</sup>
   234  
   235  **STH Witness**:
   236  
   237  May use the [`ft_witness`](/binary_transparency/firmware/cmd/ft_witness) to
   238  support verification of log operator, by enabling detection of log split views.
   239  
   240  * Verifier<sup>FIRMWARE_LOG</sup>
   241  
   242  **Interested Observers**:
   243  
   244  Use the [`ft_monitor`](/binary_transparency/firmware/cmd/ft_monitor) to
   245  both verify the log operator's claims, and support verification of the
   246  firmware vendor claims.
   247  
   248  * Verifier<sup>FIRMWARE</sup>
   249  * Verifier<sup>FIRMWARE_LOG</sup>
   250  
   251  There are no Arbiters in the demo.
   252  
   253  ### Caveats/Scope
   254  
   255  For the purposes of the demo, the "on device" enforcement will be implemented
   256  at the bootloader level.
   257  Clearly, in a production system we'd expect to see this enforcement implemented
   258  inside mask ROM, or some other similarly secure location, however for the
   259  purpose of demonstrating the required functionality the bootloader will serve
   260  well enough.
   261