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