1Generic Threat Model 2******************** 3 4************ 5Introduction 6************ 7 8This document provides a generic threat model for TF-A firmware. 9 10.. _Target of Evaluation: 11 12******************** 13Target of Evaluation 14******************** 15 16In this threat model, the target of evaluation is the Trusted 17Firmware for A-class Processors (TF-A). This includes the boot ROM (BL1), 18the trusted boot firmware (BL2) and the runtime EL3 firmware (BL31) as 19shown on Figure 1. Everything else on Figure 1 is outside of the scope of 20the evaluation. 21 22TF-A can be configured in various ways. In this threat model we consider 23only the most basic configuration. To that end we make the following 24assumptions: 25 26- All TF-A images are run from either ROM or on-chip trusted SRAM. This means 27 TF-A is not vulnerable to an attacker that can probe or tamper with off-chip 28 memory. 29 30- Trusted boot is enabled. This means an attacker can't boot arbitrary images 31 that are not approved by platform providers. 32 33- There is no Secure-EL2. We don't consider threats that may come with 34 Secure-EL2 software. 35 36- There are no Root and Realm worlds. These are introduced by :ref:`Realm 37 Management Extension (RME)`. 38 39 The :ref:`Threat Model for TF-A with Arm CCA support` covers these types of 40 configurations. 41 42- No experimental features are enabled. We do not consider threats that may come 43 from them. 44 45- The platform's hardware complies with the `PSR specification`_, defining the 46 bare-minimum security prerequisites for System-on-Chips (SoC). 47 48Data Flow Diagram 49================= 50 51Figure 1 shows a high-level data flow diagram for TF-A. The diagram 52shows a model of the different components of a TF-A-based system and 53their interactions with TF-A. A description of each diagram element 54is given on Table 1. On the diagram, the red broken lines indicate 55trust boundaries. Components outside of the broken lines 56are considered untrusted by TF-A. 57 58.. uml:: ../../resources/diagrams/plantuml/tfa_dfd.puml 59 :caption: Figure 1: TF-A Data Flow Diagram 60 61.. table:: Table 1: TF-A Data Flow Diagram Description 62 63 +-----------------+--------------------------------------------------------+ 64 | Diagram Element | Description | 65 +=================+========================================================+ 66 | DF1 | | At boot time, images are loaded from non-volatile | 67 | | memory and verified by TF-A boot firmware. These | 68 | | images include TF-A BL2 and BL31 images, as well as | 69 | | other secure and non-secure images. | 70 +-----------------+--------------------------------------------------------+ 71 | DF2 | | TF-A log system framework outputs debug or | 72 | | informative messages over a UART interface. | 73 | | | 74 | | | Also, characters can be read from a UART interface. | 75 +-----------------+--------------------------------------------------------+ 76 | DF3 | | Debug and trace IP on a platform can allow access | 77 | | to registers and memory of TF-A. | 78 +-----------------+--------------------------------------------------------+ 79 | DF4 | | Secure world software (e.g. trusted OS) interact | 80 | | with TF-A through SMC call interface and/or shared | 81 | | memory. | 82 +-----------------+--------------------------------------------------------+ 83 | DF5 | | Non-secure world software (e.g. rich OS) interact | 84 | | with TF-A through SMC call interface and/or shared | 85 | | memory. | 86 +-----------------+--------------------------------------------------------+ 87 | DF6 | | This path represents the interaction between TF-A and| 88 | | various hardware IPs such as TrustZone controller | 89 | | and GIC. At boot time TF-A configures/initializes the| 90 | | IPs and interacts with them at runtime through | 91 | | interrupts and registers. | 92 +-----------------+--------------------------------------------------------+ 93 94 95.. _threat_analysis: 96 97*************** 98Threat Analysis 99*************** 100 101In this section we identify and provide assessment of potential threats to TF-A 102firmware. The threats are identified for each diagram element on the 103data flow diagram above. 104 105For each threat, we identify the *asset* that is under threat, the 106*threat agent* and the *threat type*. Each threat is given a *risk rating* 107that represents the impact and likelihood of that threat. We also discuss 108potential mitigations. 109 110Assets 111====== 112 113We have identified the following assets for TF-A: 114 115.. table:: Table 2: TF-A Assets 116 117 +--------------------+---------------------------------------------------+ 118 | Asset | Description | 119 +====================+===================================================+ 120 | Sensitive Data | | These include sensitive data that an attacker | 121 | | must not be able to tamper with (e.g. the Root | 122 | | of Trust Public Key) or see (e.g. secure logs, | 123 | | debugging information such as crash reports). | 124 +--------------------+---------------------------------------------------+ 125 | Code Execution | | This represents the requirement that the | 126 | | platform should run only TF-A code approved by | 127 | | the platform provider. | 128 +--------------------+---------------------------------------------------+ 129 | Availability | | This represents the requirement that TF-A | 130 | | services should always be available for use. | 131 +--------------------+---------------------------------------------------+ 132 133Threat Agents 134============= 135 136To understand the attack surface, it is important to identify potential 137attackers, i.e. attack entry points. The following threat agents are 138in scope of this threat model. 139 140.. table:: Table 3: Threat Agents 141 142 +-------------------+-------------------------------------------------------+ 143 | Threat Agent | Description | 144 +===================+=======================================================+ 145 | NSCode | | Malicious or faulty code running in the Non-secure | 146 | | world, including NS-EL0 NS-EL1 and NS-EL2 levels | 147 +-------------------+-------------------------------------------------------+ 148 | SecCode | | Malicious or faulty code running in the secure | 149 | | world, including S-EL0 and S-EL1 levels | 150 +-------------------+-------------------------------------------------------+ 151 | AppDebug | | Physical attacker using debug signals to access | 152 | | TF-A resources | 153 +-------------------+-------------------------------------------------------+ 154 | PhysicalAccess | | Physical attacker having access to external device | 155 | | communication bus and to external flash | 156 | | communication bus using common hardware | 157 +-------------------+-------------------------------------------------------+ 158 159.. note:: 160 161 In this threat model an advanced physical attacker that has the capability 162 to tamper with a hardware (e.g. "rewiring" a chip using a focused 163 ion beam (FIB) workstation or decapsulate the chip using chemicals) is 164 considered out-of-scope. 165 166Threat Types 167============ 168 169In this threat model we categorize threats using the `STRIDE threat 170analysis technique`_. In this technique a threat is categorized as one 171or more of these types: ``Spoofing``, ``Tampering``, ``Repudiation``, 172``Information disclosure``, ``Denial of service`` or 173``Elevation of privilege``. 174 175Threat Risk Ratings 176=================== 177 178For each threat identified, a risk rating that ranges 179from *informational* to *critical* is given based on the likelihood of the 180threat occurring if a mitigation is not in place, and the impact of the 181threat (i.e. how severe the consequences could be). Table 4 explains each 182rating in terms of score, impact and likelihood. 183 184.. table:: Table 4: Rating and score as applied to impact and likelihood 185 186 +-----------------------+-------------------------+---------------------------+ 187 | **Rating (Score)** | **Impact** | **Likelihood** | 188 +=======================+=========================+===========================+ 189 | Critical (5) | | Extreme impact to | | Threat is almost | 190 | | entire organization | certain to be exploited.| 191 | | if exploited. | | 192 | | | | Knowledge of the threat | 193 | | | and how to exploit it | 194 | | | are in the public | 195 | | | domain. | 196 +-----------------------+-------------------------+---------------------------+ 197 | High (4) | | Major impact to entire| | Threat is relatively | 198 | | organization or single| easy to detect and | 199 | | line of business if | exploit by an attacker | 200 | | exploited | with little skill. | 201 +-----------------------+-------------------------+---------------------------+ 202 | Medium (3) | | Noticeable impact to | | A knowledgeable insider | 203 | | line of business if | or expert attacker could| 204 | | exploited. | exploit the threat | 205 | | | without much difficulty.| 206 +-----------------------+-------------------------+---------------------------+ 207 | Low (2) | | Minor damage if | | Exploiting the threat | 208 | | exploited or could | would require | 209 | | be used in conjunction| considerable expertise | 210 | | with other | and resources | 211 | | vulnerabilities to | | 212 | | perform a more serious| | 213 | | attack | | 214 +-----------------------+-------------------------+---------------------------+ 215 | Informational (1) | | Poor programming | | Threat is not likely | 216 | | practice or poor | to be exploited on its | 217 | | design decision that | own, but may be used to | 218 | | may not represent an | gain information for | 219 | | immediate risk on its | launching another | 220 | | own, but may have | attack | 221 | | security implications | | 222 | | if multiplied and/or | | 223 | | combined with other | | 224 | | threats. | | 225 +-----------------------+-------------------------+---------------------------+ 226 227Aggregate risk scores are assigned to identified threats; 228specifically, the impact score multiplied by the likelihood score. 229For example, a threat with high likelihood and low impact would have an 230aggregate risk score of eight (8); that is, four (4) for high likelihood 231multiplied by two (2) for low impact. The aggregate risk score determines 232the finding's overall risk level, as shown in the following table. 233 234.. table:: Table 5: Overall risk levels and corresponding aggregate scores 235 236 +---------------------+-----------------------------------+ 237 | Overall Risk Level | Aggregate Risk Score | 238 | | (Impact multiplied by Likelihood) | 239 +=====================+===================================+ 240 | Critical | 20–25 | 241 +---------------------+-----------------------------------+ 242 | High | 12–19 | 243 +---------------------+-----------------------------------+ 244 | Medium | 6–11 | 245 +---------------------+-----------------------------------+ 246 | Low | 2–5 | 247 +---------------------+-----------------------------------+ 248 | Informational | 1 | 249 +---------------------+-----------------------------------+ 250 251The likelihood and impact of a threat depends on the 252target environment in which TF-A is running. For example, attacks 253that require physical access are unlikely in server environments while 254they are more common in Internet of Things(IoT) environments. 255In this threat model we consider three target environments: 256``Internet of Things(IoT)``, ``Mobile`` and ``Server``. 257 258Threat Assessment 259================= 260 261The following threats were identified by applying STRIDE analysis on 262each diagram element of the data flow diagram. 263 264For each threat, we strive to indicate whether the mitigations are currently 265implemented or not. However, the answer to this question is not always straight 266forward. Some mitigations are partially implemented in the generic code but also 267rely on the platform code to implement some bits of it. This threat model aims 268to be platform-independent and it is important to keep in mind that such threats 269only get mitigated if the platform code properly fulfills its responsibilities. 270 271Also, some mitigations require enabling specific features, which must be 272explicitly turned on via a build flag. 273 274When such conditions must be met, these are highlighted in the ``Mitigations 275implemented?`` box. 276 277As our :ref:`Target of Evaluation` is made of several, distinct firmware images, 278some threats are confined in specific images, while others apply to each of 279them. To help developers implement mitigations in the right place, threats below 280are categorized based on the firmware image that should mitigate them. 281 282.. _General Threats: 283 284General Threats for All Firmware Images 285--------------------------------------- 286 287+------------------------+---------------------------------------------------+ 288| ID | 05 | 289+========================+===================================================+ 290| Threat | | **Information leak via UART logs** | 291| | | 292| | | During the development stages of software it is | 293| | common to print all sorts of information on the | 294| | console, including sensitive or confidential | 295| | information such as crash reports with detailed | 296| | information of the CPU state, current registers | 297| | values, privilege level or stack dumps. | 298| | | 299| | | This information is useful when debugging | 300| | problems before releasing the production | 301| | version but it could be used by an attacker | 302| | to develop a working exploit if left enabled in | 303| | the production version. | 304| | | 305| | | This happens when directly logging sensitive | 306| | information and more subtly when logging | 307| | side-channel information that can be used by an | 308| | attacker to learn about sensitive information. | 309+------------------------+---------------------------------------------------+ 310| Diagram Elements | DF2 | 311+------------------------+---------------------------------------------------+ 312| Affected TF-A | BL1, BL2, BL31 | 313| Components | | 314+------------------------+---------------------------------------------------+ 315| Assets | Sensitive Data | 316+------------------------+---------------------------------------------------+ 317| Threat Agent | AppDebug | 318+------------------------+---------------------------------------------------+ 319| Threat Type | Information Disclosure | 320+------------------------+------------------+----------------+---------------+ 321| Application | Server | IoT | Mobile | 322+------------------------+------------------+----------------+---------------+ 323| Impact | N/A | Low (2) | Low (2) | 324+------------------------+------------------+----------------+---------------+ 325| Likelihood | N/A | High (4) | High (4) | 326+------------------------+------------------+----------------+---------------+ 327| Total Risk Rating | N/A | Medium (8) | Medium (8) | 328+------------------------+------------------+----------------+---------------+ 329| Mitigations | | Remove sensitive information logging in | 330| | production releases. | 331| | | 332| | | Do not conditionally log information depending | 333| | on potentially sensitive data. | 334| | | 335| | | Do not log high precision timing information. | 336+------------------------+---------------------------------------------------+ 337| Mitigations | | Yes / Platform Specific. | 338| implemented? | Requires the right build options to be used. | 339| | | 340| | | Crash reporting is only enabled for debug | 341| | builds by default, see ``CRASH_REPORTING`` | 342| | build option. | 343| | | 344| | | The log level can be tuned at build time, from | 345| | very verbose to no output at all. See | 346| | ``LOG_LEVEL`` build option. By default, release | 347| | builds are a lot less verbose than debug ones | 348| | but still produce some output. | 349| | | 350| | | Messages produced by the platform code should | 351| | use the appropriate level of verbosity so as | 352| | not to leak sensitive information in production | 353| | builds. | 354+------------------------+---------------------------------------------------+ 355 356+------------------------+----------------------------------------------------+ 357| ID | 06 | 358+========================+====================================================+ 359| Threat | | **An attacker can read sensitive data and | 360| | execute arbitrary code through the external | 361| | debug and trace interface** | 362| | | 363| | | Arm processors include hardware-assisted debug | 364| | and trace features that can be controlled without| 365| | the need for software operating on the platform. | 366| | If left enabled without authentication, this | 367| | feature can be used by an attacker to inspect and| 368| | modify TF-A registers and memory allowing the | 369| | attacker to read sensitive data and execute | 370| | arbitrary code. | 371+------------------------+----------------------------------------------------+ 372| Diagram Elements | DF3 | 373+------------------------+----------------------------------------------------+ 374| Affected TF-A | BL1, BL2, BL31 | 375| Components | | 376+------------------------+----------------------------------------------------+ 377| Assets | Code Execution, Sensitive Data | 378+------------------------+----------------------------------------------------+ 379| Threat Agent | AppDebug | 380+------------------------+----------------------------------------------------+ 381| Threat Type | Tampering, Information Disclosure, | 382| | Elevation of privilege | 383+------------------------+------------------+---------------+-----------------+ 384| Application | Server | IoT | Mobile | 385+------------------------+------------------+---------------+-----------------+ 386| Impact | N/A | High (4) | High (4) | 387+------------------------+------------------+---------------+-----------------+ 388| Likelihood | N/A | Critical (5) | Critical (5) | 389+------------------------+------------------+---------------+-----------------+ 390| Total Risk Rating | N/A | Critical (20) | Critical (20) | 391+------------------------+------------------+---------------+-----------------+ 392| Mitigations | Disable the debug and trace capability for | 393| | production releases or enable proper debug | 394| | authentication as recommended by [`DEN0034`_]. | 395+------------------------+----------------------------------------------------+ 396| Mitigations | | Platform specific. | 397| implemented? | | 398| | | Configuration of debug and trace capabilities is | 399| | entirely platform specific. | 400+------------------------+----------------------------------------------------+ 401 402+------------------------+------------------------------------------------------+ 403| ID | 08 | 404+========================+======================================================+ 405| Threat | | **Memory corruption due to memory overflows and | 406| | lack of boundary checking when accessing resources | 407| | could allow an attacker to execute arbitrary code, | 408| | modify some state variable to change the normal | 409| | flow of the program, or leak sensitive | 410| | information** | 411| | | 412| | | Like in other software, TF-A has multiple points | 413| | where memory corruption security errors can arise. | 414| | | 415| | | Some of the errors include integer overflow, | 416| | buffer overflow, incorrect array boundary checks, | 417| | and incorrect error management. | 418| | Improper use of asserts instead of proper input | 419| | validations might also result in these kinds of | 420| | errors in release builds. | 421+------------------------+------------------------------------------------------+ 422| Diagram Elements | DF4, DF5 | 423+------------------------+------------------------------------------------------+ 424| Affected TF-A | BL1, BL2, BL31 | 425| Components | | 426+------------------------+------------------------------------------------------+ 427| Assets | Code Execution, Sensitive Data | 428+------------------------+------------------------------------------------------+ 429| Threat Agent | NSCode, SecCode | 430+------------------------+------------------------------------------------------+ 431| Threat Type | Tampering, Information Disclosure, | 432| | Elevation of Privilege | 433+------------------------+-------------------+-----------------+----------------+ 434| Application | Server | IoT | Mobile | 435+------------------------+-------------------+-----------------+----------------+ 436| Impact | Critical (5) | Critical (5) | Critical (5) | 437+------------------------+-------------------+-----------------+----------------+ 438| Likelihood | Medium (3 | Medium (3) | Medium (3) | 439+------------------------+-------------------+-----------------+----------------+ 440| Total Risk Rating | High (15) | High (15) | High (15) | 441+------------------------+-------------------+-----------------+----------------+ 442| Mitigations | | 1) Use proper input validation. | 443| | | 444| | | 2) Code reviews, testing. | 445+------------------------+------------------------------------------------------+ 446| Mitigations | | 1) Yes. | 447| implemented? | Data received from normal world, such as addresses | 448| | and sizes identifying memory regions, are | 449| | sanitized before being used. These security checks | 450| | make sure that the normal world software does not | 451| | access memory beyond its limit. | 452| | | 453| | | By default *asserts* are only used to check for | 454| | programming errors in debug builds. Other types of | 455| | errors are handled through condition checks that | 456| | remain enabled in release builds. See | 457| | `TF-A error handling policy`_. TF-A provides an | 458| | option to use *asserts* in release builds, however | 459| | we recommend using proper runtime checks instead | 460| | of relying on asserts in release builds. | 461| | | 462| | | 2) Yes. | 463| | TF-A uses a combination of manual code reviews | 464| | and automated program analysis and testing to | 465| | detect and fix memory corruption bugs. All TF-A | 466| | code including platform code go through manual | 467| | code reviews. Additionally, static code analysis | 468| | is performed using Coverity Scan on all TF-A code. | 469| | The code is also tested with | 470| | `Trusted Firmware-A Tests`_ on Juno and FVP | 471| | platforms. | 472+------------------------+------------------------------------------------------+ 473 474 475+------------------------+----------------------------------------------------+ 476| ID | 11 | 477+========================+====================================================+ 478| Threat | | **Misconfiguration of the Memory Management Unit | 479| | (MMU) may allow a normal world software to | 480| | access sensitive data, execute arbitrary | 481| | code or access otherwise restricted HW | 482| | interface** | 483| | | 484| | | A misconfiguration of the MMU could | 485| | lead to an open door for software running in the | 486| | normal world to access sensitive data or even | 487| | execute code if the proper security mechanisms | 488| | are not in place. | 489+------------------------+----------------------------------------------------+ 490| Diagram Elements | DF5, DF6 | 491+------------------------+----------------------------------------------------+ 492| Affected TF-A | BL1, BL2, BL31 | 493| Components | | 494+------------------------+----------------------------------------------------+ 495| Assets | Sensitive Data, Code execution | 496+------------------------+----------------------------------------------------+ 497| Threat Agent | NSCode | 498+------------------------+----------------------------------------------------+ 499| Threat Type | Information Disclosure, Elevation of Privilege | 500+------------------------+-----------------+-----------------+----------------+ 501| Application | Server | IoT | Mobile | 502+------------------------+-----------------+-----------------+----------------+ 503| Impact | Critical (5) | Critical (5) | Critical (5) | 504+------------------------+-----------------+-----------------+----------------+ 505| Likelihood | High (4) | High (4) | High (4) | 506+------------------------+-----------------+-----------------+----------------+ 507| Total Risk Rating | Critical (20) | Critical (20) | Critical (20) | 508+------------------------+-----------------+-----------------+----------------+ 509| Mitigations | When configuring access permissions, the | 510| | principle of least privilege ought to be | 511| | enforced. This means we should not grant more | 512| | privileges than strictly needed, e.g. code | 513| | should be read-only executable, read-only data | 514| | should be read-only execute-never, and so on. | 515+------------------------+----------------------------------------------------+ 516| Mitigations | | Platform specific. | 517| implemented? | | 518| | | MMU configuration is platform specific, | 519| | therefore platforms need to make sure that the | 520| | correct attributes are assigned to memory | 521| | regions. | 522| | | 523| | | TF-A provides a library which abstracts the | 524| | low-level details of MMU configuration. It | 525| | provides well-defined and tested APIs. | 526| | Platforms are encouraged to use it to limit the | 527| | risk of misconfiguration. | 528+------------------------+----------------------------------------------------+ 529 530 531+------------------------+-----------------------------------------------------+ 532| ID | 13 | 533+========================+=====================================================+ 534| Threat | | **Leaving sensitive information in the memory, | 535| | can allow an attacker to retrieve them.** | 536| | | 537| | | Accidentally leaving not-needed sensitive data in | 538| | internal buffers can leak them if an attacker | 539| | gains access to memory due to a vulnerability. | 540+------------------------+-----------------------------------------------------+ 541| Diagram Elements | DF4, DF5 | 542+------------------------+-----------------------------------------------------+ 543| Affected TF-A | BL1, BL2, BL31 | 544| Components | | 545+------------------------+-----------------------------------------------------+ 546| Assets | Sensitive Data | 547+------------------------+-----------------------------------------------------+ 548| Threat Agent | NSCode, SecCode | 549+------------------------+-----------------------------------------------------+ 550| Threat Type | Information Disclosure | 551+------------------------+-------------------+----------------+----------------+ 552| Application | Server | IoT | Mobile | 553+------------------------+-------------------+----------------+----------------+ 554| Impact | Critical (5) | Critical (5) | Critical (5) | 555+------------------------+-------------------+----------------+----------------+ 556| Likelihood | Medium (3) | Medium (3) | Medium (3) | 557+------------------------+-------------------+----------------+----------------+ 558| Total Risk Rating | High (15) | High (15) | High (15) | 559+------------------------+-------------------+----------------+----------------+ 560| Mitigations | Clear the sensitive data from internal buffers as | 561| | soon as they are not needed anymore. | 562+------------------------+-----------------------------------------------------+ 563| Mitigations | | Yes / Platform specific | 564| implemented? | | 565+------------------------+-----------------------------------------------------+ 566 567 568+------------------------+-----------------------------------------------------+ 569| ID | 15 | 570+========================+=====================================================+ 571| Threat | | **Improper handling of input data received over | 572| | a UART interface may allow an attacker to tamper | 573| | with TF-A execution environment.** | 574| | | 575| | | The consequences of the attack depend on the | 576| | the exact usage of input data received over UART. | 577| | Examples are injection of arbitrary data, | 578| | sensitive data tampering, influencing the | 579| | execution path, denial of service (if using | 580| | blocking I/O). This list may not be exhaustive. | 581+------------------------+-----------------------------------------------------+ 582| Diagram Elements | DF2, DF4, DF5 | 583+------------------------+-----------------------------------------------------+ 584| Affected TF-A | BL1, BL2, BL31 | 585| Components | | 586+------------------------+-----------------------------------------------------+ 587| Assets | Sensitive Data, Code Execution, Availability | 588+------------------------+-----------------------------------------------------+ 589| Threat Agent | NSCode, SecCode | 590+------------------------+-----------------------------------------------------+ 591| Threat Type | Tampering, Information Disclosure, Denial of | 592| | service, Elevation of privilege. | 593+------------------------+-------------------+----------------+----------------+ 594| Application | Server | IoT | Mobile | 595+------------------------+-------------------+----------------+----------------+ 596| Impact | Critical (5) | Critical (5) | Critical (5) | 597+------------------------+-------------------+----------------+----------------+ 598| Likelihood | Critical (5) | Critical (5) | Critical (5) | 599+------------------------+-------------------+----------------+----------------+ 600| Total Risk Rating | Critical (25) | Critical (25) | Critical (25) | 601+------------------------+-------------------+----------------+----------------+ 602| Mitigations | | By default, the code to read input data from UART | 603| | interfaces is disabled (see `ENABLE_CONSOLE_GETC` | 604| | build option). It should only be enabled on a | 605| | need basis. | 606| | | 607| | | Data received over UART interfaces should be | 608| | treated as untrusted data. As such, it should be | 609| | properly sanitized and handled with caution. | 610+------------------------+-----------------------------------------------------+ 611| Mitigations | | Platform specific. | 612| implemented? | | 613| | | Generic code does not read any input data from | 614| | UART interface(s). | 615+------------------------+-----------------------------------------------------+ 616 617 618.. _Boot Firmware Threats: 619 620Threats to be Mitigated by the Boot Firmware 621-------------------------------------------- 622 623The boot firmware here refers to the boot ROM (BL1) and the trusted boot 624firmware (BL2). Typically it does not stay resident in memory and it is 625dismissed once execution has reached the runtime EL3 firmware (BL31). Thus, past 626that point in time, the threats below can no longer be exploited. 627 628Note, however, that this is not necessarily true on all platforms. Platform 629vendors should review these threats to make sure they cannot be exploited 630nonetheless once execution has reached the runtime EL3 firmware. 631 632+------------------------+----------------------------------------------------+ 633| ID | 01 | 634+========================+====================================================+ 635| Threat | | **An attacker can mangle firmware images to | 636| | execute arbitrary code** | 637| | | 638| | | Some TF-A images are loaded from external | 639| | storage. It is possible for an attacker to access| 640| | the external flash memory and change its contents| 641| | physically, through the Rich OS, or using the | 642| | updating mechanism to modify the non-volatile | 643| | images to execute arbitrary code. | 644+------------------------+----------------------------------------------------+ 645| Diagram Elements | DF1, DF4, DF5 | 646+------------------------+----------------------------------------------------+ 647| Affected TF-A | BL2, BL31 | 648| Components | | 649+------------------------+----------------------------------------------------+ 650| Assets | Code Execution | 651+------------------------+----------------------------------------------------+ 652| Threat Agent | PhysicalAccess, NSCode, SecCode | 653+------------------------+----------------------------------------------------+ 654| Threat Type | Tampering, Elevation of Privilege | 655+------------------------+------------------+-----------------+---------------+ 656| Application | Server | IoT | Mobile | 657+------------------------+------------------+-----------------+---------------+ 658| Impact | Critical (5) | Critical (5) | Critical (5) | 659+------------------------+------------------+-----------------+---------------+ 660| Likelihood | Critical (5) | Critical (5) | Critical (5) | 661+------------------------+------------------+-----------------+---------------+ 662| Total Risk Rating | Critical (25) | Critical (25) | Critical (25) | 663+------------------------+------------------+-----------------+---------------+ 664| Mitigations | | 1) Implement the `Trusted Board Boot (TBB)`_ | 665| | feature which prevents malicious firmware from | 666| | running on the platform by authenticating all | 667| | firmware images. | 668| | | 669| | | 2) Perform extra checks on unauthenticated data, | 670| | such as FIP metadata, prior to use. | 671+------------------------+----------------------------------------------------+ 672| Mitigations | | 1) Yes, provided that the ``TRUSTED_BOARD_BOOT`` | 673| implemented? | build option is set to 1. | 674| | | 675| | | 2) Yes. | 676+------------------------+----------------------------------------------------+ 677 678+------------------------+----------------------------------------------------+ 679| ID | 02 | 680+========================+====================================================+ 681| Threat | | **An attacker may attempt to boot outdated, | 682| | potentially vulnerable firmware image** | 683| | | 684| | | When updating firmware, an attacker may attempt | 685| | to rollback to an older version that has unfixed | 686| | vulnerabilities. | 687+------------------------+----------------------------------------------------+ 688| Diagram Elements | DF1, DF4, DF5 | 689+------------------------+----------------------------------------------------+ 690| Affected TF-A | BL2, BL31 | 691| Components | | 692+------------------------+----------------------------------------------------+ 693| Assets | Code Execution | 694+------------------------+----------------------------------------------------+ 695| Threat Agent | PhysicalAccess, NSCode, SecCode | 696+------------------------+----------------------------------------------------+ 697| Threat Type | Tampering | 698+------------------------+------------------+-----------------+---------------+ 699| Application | Server | IoT | Mobile | 700+------------------------+------------------+-----------------+---------------+ 701| Impact | Critical (5) | Critical (5) | Critical (5) | 702+------------------------+------------------+-----------------+---------------+ 703| Likelihood | Critical (5) | Critical (5) | Critical (5) | 704+------------------------+------------------+-----------------+---------------+ 705| Total Risk Rating | Critical (25) | Critical (25) | Critical (25) | 706+------------------------+------------------+-----------------+---------------+ 707| Mitigations | Implement anti-rollback protection using | 708| | non-volatile counters (NV counters) as required | 709| | by `TBBR-Client specification`_. | 710+------------------------+----------------------------------------------------+ 711| Mitigations | | Yes / Platform specific. | 712| implemented? | | 713| | | After a firmware image is validated, the image | 714| | revision number taken from a certificate | 715| | extension field is compared with the | 716| | corresponding NV counter stored in hardware to | 717| | make sure the new counter value is larger than | 718| | the current counter value. | 719| | | 720| | | **Platforms must implement this protection using | 721| | platform specific hardware NV counters.** | 722+------------------------+----------------------------------------------------+ 723 724 725+------------------------+-------------------------------------------------------+ 726| ID | 03 | 727+========================+=======================================================+ 728| Threat | | **An attacker can use Time-of-Check-Time-of-Use | 729| | (TOCTOU) attack to bypass image authentication | 730| | during the boot process** | 731| | | 732| | | Time-of-Check-Time-of-Use (TOCTOU) threats occur | 733| | when the security check is produced before the time | 734| | the resource is accessed. If an attacker is sitting | 735| | in the middle of the off-chip images, they could | 736| | change the binary containing executable code right | 737| | after the integrity and authentication check has | 738| | been performed. | 739+------------------------+-------------------------------------------------------+ 740| Diagram Elements | DF1 | 741+------------------------+-------------------------------------------------------+ 742| Affected TF-A | BL1, BL2 | 743| Components | | 744+------------------------+-------------------------------------------------------+ 745| Assets | Code Execution, Sensitive Data | 746+------------------------+-------------------------------------------------------+ 747| Threat Agent | PhysicalAccess | 748+------------------------+-------------------------------------------------------+ 749| Threat Type | Elevation of Privilege | 750+------------------------+---------------------+-----------------+---------------+ 751| Application | Server | IoT | Mobile | 752+------------------------+---------------------+-----------------+---------------+ 753| Impact | N/A | Critical (5) | Critical (5) | 754+------------------------+---------------------+-----------------+---------------+ 755| Likelihood | N/A | Medium (3) | Medium (3) | 756+------------------------+---------------------+-----------------+---------------+ 757| Total Risk Rating | N/A | High (15) | High (15) | 758+------------------------+---------------------+-----------------+---------------+ 759| Mitigations | Copy image to on-chip memory before authenticating | 760| | it. | 761+------------------------+-------------------------------------------------------+ 762| Mitigations | | Platform specific. | 763| implemented? | | 764| | | The list of images to load and their location is | 765| | platform specific. Platforms are responsible for | 766| | arranging images to be loaded in on-chip memory. | 767+------------------------+-------------------------------------------------------+ 768 769 770+------------------------+-------------------------------------------------------+ 771| ID | 04 | 772+========================+=======================================================+ 773| Threat | | **An attacker with physical access can execute | 774| | arbitrary image by bypassing the signature | 775| | verification stage using glitching techniques** | 776| | | 777| | | Glitching (Fault injection) attacks attempt to put | 778| | a hardware into a undefined state by manipulating an| 779| | environmental variable such as power supply. | 780| | | 781| | | TF-A relies on a chain of trust that starts with the| 782| | ROTPK, which is the key stored inside the chip and | 783| | the root of all validation processes. If an attacker| 784| | can break this chain of trust, they could execute | 785| | arbitrary code on the device. This could be | 786| | achieved with physical access to the device by | 787| | attacking the normal execution flow of the | 788| | process using glitching techniques that target | 789| | points where the image is validated against the | 790| | signature. | 791+------------------------+-------------------------------------------------------+ 792| Diagram Elements | DF1 | 793+------------------------+-------------------------------------------------------+ 794| Affected TF-A | BL1, BL2 | 795| Components | | 796+------------------------+-------------------------------------------------------+ 797| Assets | Code Execution | 798+------------------------+-------------------------------------------------------+ 799| Threat Agent | PhysicalAccess | 800+------------------------+-------------------------------------------------------+ 801| Threat Type | Tampering, Elevation of Privilege | 802+------------------------+---------------------+-----------------+---------------+ 803| Application | Server | IoT | Mobile | 804+------------------------+---------------------+-----------------+---------------+ 805| Impact | N/A | Critical (5) | Critical (5) | 806+------------------------+---------------------+-----------------+---------------+ 807| Likelihood | N/A | Medium (3) | Medium (3) | 808+------------------------+---------------------+-----------------+---------------+ 809| Total Risk Rating | N/A | High (15) | High (15) | 810+------------------------+---------------------+-----------------+---------------+ 811| Mitigations | Mechanisms to detect clock glitch and power | 812| | variations. | 813+------------------------+-------------------------------------------------------+ 814| Mitigations | | No. | 815| implemented? | | 816| | | The most effective mitigation is adding glitching | 817| | detection and mitigation circuit at the hardware | 818| | level. | 819| | | 820| | | However, software techniques, such as adding | 821| | redundant checks when performing conditional | 822| | branches that are security sensitive, can be used | 823| | to harden TF-A against such attacks. | 824| | **At the moment TF-A doesn't implement such | 825| | mitigations.** | 826+------------------------+-------------------------------------------------------+ 827 828.. topic:: Measured Boot Threats (or lack of) 829 830 In the current Measured Boot design, BL1, BL2, and BL31, as well as the 831 secure world components, form the |SRTM|. Measurement data is currently 832 considered an asset to be protected against attack, and this is achieved 833 by storing them in the Secure Memory. 834 Beyond the measurements stored inside the TCG-compliant Event Log buffer, 835 there are no other assets to protect or threats to defend against that 836 could compromise |TF-A| execution environment's security. 837 838 There are general security assets and threats associated with remote/delegated 839 attestation. However, these are outside the |TF-A| security boundary and 840 should be dealt with by the appropriate agent in the platform/system. 841 Since current Measured Boot design does not use local attestation, there would 842 be no further assets to protect(like unsealed keys). 843 844 A limitation of the current Measured Boot design is that it is dependent upon 845 Secure Boot as implementation of Measured Boot does not extend measurements 846 into a discrete |TPM|, where they would be securely stored and protected 847 against tampering. This implies that if Secure-Boot is compromised, Measured 848 Boot may also be compromised. 849 850 Platforms must carefully evaluate the security of the default implementation 851 since the |SRTM| includes all secure world components. 852 853 854.. _Runtime Firmware Threats: 855 856Threats to be Mitigated by the Runtime EL3 Firmware 857--------------------------------------------------- 858 859+------------------------+------------------------------------------------------+ 860| ID | 07 | 861+========================+======================================================+ 862| Threat | | **An attacker can perform a denial-of-service | 863| | attack by using a broken SMC call that causes the | 864| | system to reboot or enter into unknown state.** | 865| | | 866| | | Secure and non-secure clients access TF-A services | 867| | through SMC calls. Malicious code can attempt to | 868| | place the TF-A runtime into an inconsistent state | 869| | by calling unimplemented SMC call or by passing | 870| | invalid arguments. | 871+------------------------+------------------------------------------------------+ 872| Diagram Elements | DF4, DF5 | 873+------------------------+------------------------------------------------------+ 874| Affected TF-A | BL31 | 875| Components | | 876+------------------------+------------------------------------------------------+ 877| Assets | Availability | 878+------------------------+------------------------------------------------------+ 879| Threat Agent | NSCode, SecCode | 880+------------------------+------------------------------------------------------+ 881| Threat Type | Denial of Service | 882+------------------------+-------------------+----------------+-----------------+ 883| Application | Server | IoT | Mobile | 884+------------------------+-------------------+----------------+-----------------+ 885| Impact | Medium (3) | Medium (3) | Medium (3) | 886+------------------------+-------------------+----------------+-----------------+ 887| Likelihood | High (4) | High (4) | High (4) | 888+------------------------+-------------------+----------------+-----------------+ 889| Total Risk Rating | High (12) | High (12) | High (12) | 890+------------------------+-------------------+----------------+-----------------+ 891| Mitigations | Validate SMC function ids and arguments before using | 892| | them. | 893+------------------------+------------------------------------------------------+ 894| Mitigations | | Yes / Platform specific. | 895| implemented? | | 896| | | For standard services, all input is validated. | 897| | | 898| | | Platforms that implement SiP services must also | 899| | validate SMC call arguments. | 900+------------------------+------------------------------------------------------+ 901 902 903+------------------------+------------------------------------------------------+ 904| ID | 09 | 905+========================+======================================================+ 906| Threat | | **Improperly handled SMC calls can leak register | 907| | contents** | 908| | | 909| | | When switching between worlds, TF-A register state | 910| | can leak to software in different security | 911| | contexts. | 912+------------------------+------------------------------------------------------+ 913| Diagram Elements | DF4, DF5 | 914+------------------------+------------------------------------------------------+ 915| Affected TF-A | BL31 | 916| Components | | 917+------------------------+------------------------------------------------------+ 918| Assets | Sensitive Data | 919+------------------------+------------------------------------------------------+ 920| Threat Agent | NSCode, SecCode | 921+------------------------+------------------------------------------------------+ 922| Threat Type | Information Disclosure | 923+------------------------+-------------------+----------------+-----------------+ 924| Application | Server | IoT | Mobile | 925+------------------------+-------------------+----------------+-----------------+ 926| Impact | Medium (3) | Medium (3) | Medium (3) | 927+------------------------+-------------------+----------------+-----------------+ 928| Likelihood | High (4) | High (4) | High (4) | 929+------------------------+-------------------+----------------+-----------------+ 930| Total Risk Rating | High (12) | High (12) | High (12) | 931+------------------------+-------------------+----------------+-----------------+ 932| Mitigations | Save and restore registers when switching contexts. | 933+------------------------+------------------------------------------------------+ 934| Mitigations | | Yes. | 935| implemented? | | 936| | | This is the default behaviour in TF-A. | 937| | Build options are also provided to save/restore | 938| | additional registers such as floating-point | 939| | registers. These should be enabled if required. | 940+------------------------+------------------------------------------------------+ 941 942+------------------------+-----------------------------------------------------+ 943| ID | 10 | 944+========================+=====================================================+ 945| Threat | | **SMC calls can leak sensitive information from | 946| | TF-A memory via microarchitectural side channels**| 947| | | 948| | | Microarchitectural side-channel attacks such as | 949| | `Spectre`_ can be used to leak data across | 950| | security boundaries. An attacker might attempt to | 951| | use this kind of attack to leak sensitive | 952| | data from TF-A memory. | 953+------------------------+-----------------------------------------------------+ 954| Diagram Elements | DF4, DF5 | 955+------------------------+-----------------------------------------------------+ 956| Affected TF-A | BL31 | 957| Components | | 958+------------------------+-----------------------------------------------------+ 959| Assets | Sensitive Data | 960+------------------------+-----------------------------------------------------+ 961| Threat Agent | SecCode, NSCode | 962+------------------------+-----------------------------------------------------+ 963| Threat Type | Information Disclosure | 964+------------------------+-------------------+----------------+----------------+ 965| Application | Server | IoT | Mobile | 966+------------------------+-------------------+----------------+----------------+ 967| Impact | Medium (3) | Medium (3) | Medium (3) | 968+------------------------+-------------------+----------------+----------------+ 969| Likelihood | Medium (3) | Medium (3) | Medium (3) | 970+------------------------+-------------------+----------------+----------------+ 971| Total Risk Rating | Medium (9) | Medium (9) | Medium (9) | 972+------------------------+-------------------+----------------+----------------+ 973| Mitigations | Enable appropriate side-channel protections. | 974+------------------------+-----------------------------------------------------+ 975| Mitigations | | Yes / Platform specific. | 976| implemented? | | 977| | | TF-A implements software mitigations for Spectre | 978| | type attacks as recommended by `Cache Speculation | 979| | Side-channels`_ for the generic code. | 980| | | 981| | | SiPs should implement similar mitigations for | 982| | code that is deemed to be vulnerable to such | 983| | attacks. | 984+------------------------+-----------------------------------------------------+ 985 986 987+------------------------+-----------------------------------------------------+ 988| ID | 12 | 989+========================+=====================================================+ 990| Threat | | **Incorrect configuration of Performance Monitor | 991| | Unit (PMU) counters can allow an attacker to | 992| | mount side-channel attacks using information | 993| | exposed by the counters** | 994| | | 995| | | Non-secure software can configure PMU registers | 996| | to count events at any exception level and in | 997| | both Secure and Non-secure states. This allows | 998| | a Non-secure software (or a lower-level Secure | 999| | software) to potentially carry out | 1000| | side-channel timing attacks against TF-A. | 1001+------------------------+-----------------------------------------------------+ 1002| Diagram Elements | DF5, DF6 | 1003+------------------------+-----------------------------------------------------+ 1004| Affected TF-A | BL31 | 1005| Components | | 1006+------------------------+-----------------------------------------------------+ 1007| Assets | Sensitive Data | 1008+------------------------+-----------------------------------------------------+ 1009| Threat Agent | NSCode | 1010+------------------------+-----------------------------------------------------+ 1011| Threat Type | Information Disclosure | 1012+------------------------+-------------------+----------------+----------------+ 1013| Application | Server | IoT | Mobile | 1014+------------------------+-------------------+----------------+----------------+ 1015| Impact | Medium (3) | Medium (3) | Medium (3) | 1016+------------------------+-------------------+----------------+----------------+ 1017| Likelihood | Low (2) | Low (2) | Low (2) | 1018+------------------------+-------------------+----------------+----------------+ 1019| Total Risk Rating | Medium (6) | Medium (6) | Medium (6) | 1020+------------------------+-------------------+----------------+----------------+ 1021| Mitigations | Follow mitigation strategies as described in | 1022| | `Secure Development Guidelines`_. | 1023+------------------------+-----------------------------------------------------+ 1024| Mitigations | | Yes / platform specific. | 1025| implemented? | | 1026| | | General events and cycle counting in the Secure | 1027| | world is prohibited by default when applicable. | 1028| | | 1029| | | However, on some implementations (e.g. PMUv3) | 1030| | Secure world event counting depends on external | 1031| | debug interface signals, i.e. Secure world event | 1032| | counting is enabled if external debug is enabled. | 1033| | | 1034| | | Configuration of debug signals is platform | 1035| | specific, therefore platforms need to make sure | 1036| | that external debug is disabled in production or | 1037| | proper debug authentication is in place. This | 1038| | should be the case if threat #06 is properly | 1039| | mitigated. | 1040+------------------------+-----------------------------------------------------+ 1041 1042 1043Threats to be Mitigated by an External Agent Outside of TF-A 1044------------------------------------------------------------ 1045 1046+------------------------+-----------------------------------------------------+ 1047| ID | 14 | 1048+========================+=====================================================+ 1049| Threat | | **Attacker wants to execute an arbitrary or | 1050| | untrusted binary as the secure OS.** | 1051| | | 1052| | | When the option OPTEE_ALLOW_SMC_LOAD is enabled, | 1053| | this trusts the non-secure world up until the | 1054| | point it issues the SMC call to load the Secure | 1055| | BL32 payload. If a compromise occurs before the | 1056| | SMC call is invoked, then arbitrary code execution| 1057| | in S-EL1 can occur or arbitrary memory in EL3 can | 1058| | be overwritten. | 1059+------------------------+-----------------------------------------------------+ 1060| Diagram Elements | DF5 | 1061+------------------------+-----------------------------------------------------+ 1062| Affected TF-A | BL31, BL32 | 1063| Components | | 1064+------------------------+-----------------------------------------------------+ 1065| Assets | Code Execution, Sensitive Data | 1066+------------------------+-----------------------------------------------------+ 1067| Threat Agent | NSCode | 1068+------------------------+-----------------------------------------------------+ 1069| Threat Type | Tampering, Information Disclosure, | 1070| | Elevation of privilege | 1071+------------------------+-----------------+-----------------+-----------------+ 1072| Application | Server | IoT | Mobile | 1073+------------------------+-----------------+-----------------+-----------------+ 1074| Impact | Critical (5) | Critical (5) | Critical (5) | 1075+------------------------+-----------------+-----------------+-----------------+ 1076| Likelihood | High (4) | High (4) | High (4) | 1077+------------------------+-----------------+-----------------+-----------------+ 1078| Total Risk Rating | Critical (20) | Critical (20) | Critical (20) | 1079+------------------------+-----------------+-----------------+-----------------+ 1080| Mitigations | When enabling the option OPTEE_ALLOW_SMC_LOAD, | 1081| | the non-secure OS must be considered a closed | 1082| | platform up until the point the SMC can be invoked | 1083| | to load OP-TEE. | 1084+------------------------+-----------------------------------------------------+ 1085| Mitigations | | None in TF-A itself. This option is only used by | 1086| implemented? | ChromeOS currently which has other mechanisms to | 1087| | to mitigate this threat which are described in | 1088| | `OP-TEE Dispatcher`_. | 1089+------------------------+-----------------------------------------------------+ 1090 1091-------------- 1092 1093*Copyright (c) 2021-2024, Arm Limited. All rights reserved.* 1094 1095 1096.. _STRIDE threat analysis technique: https://docs.microsoft.com/en-us/azure/security/develop/threat-modeling-tool-threats#stride-model 1097.. _DEN0034: https://developer.arm.com/documentation/den0034/latest 1098.. _Cache Speculation Side-channels: https://developer.arm.com/support/arm-security-updates/speculative-processor-vulnerability 1099.. _Spectre: https://developer.arm.com/support/arm-security-updates/speculative-processor-vulnerability 1100.. _TBBR-Client specification: https://developer.arm.com/documentation/den0006/d/ 1101.. _Trusted Board Boot (TBB): https://trustedfirmware-a.readthedocs.io/en/latest/design/trusted-board-boot.html 1102.. _TF-A error handling policy: https://trustedfirmware-a.readthedocs.io/en/latest/process/coding-guidelines.html#error-handling-and-robustness 1103.. _Secure Development Guidelines: https://trustedfirmware-a.readthedocs.io/en/latest/process/security-hardening.html#secure-development-guidelines 1104.. _Trusted Firmware-A Tests: https://git.trustedfirmware.org/TF-A/tf-a-tests.git/about/ 1105.. _OP-TEE Dispatcher: https://github.com/ARM-software/arm-trusted-firmware/blob/master/docs/components/spd/optee-dispatcher.rst 1106.. _PSR Specification: https://developer.arm.com/documentation/den0106/0100 1107