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