blob: 9cee10415133d60ee69707fc053896c7b0e8f7f2 [file] [log] [blame]
Zelalem05fed522021-02-24 19:20:09 -06001*****************
2Introduction
3*****************
4Threat modeling is an important part of Secure Development Lifecycle (SDL)
5that helps us identify potential threats and mitigations affecting a system.
6
7This document provides a generic threat model for TF-A firmware. In the
8next sections, we first give a description of the target of evaluation
9using a data flow diagram. Then we provide a list of threats we have
10identified based on the data flow diagram and potential threat mitigations.
11
12************************
13Target of Evaluation
14************************
15In this threat model, the target of evaluation is the Trusted
16Firmware for A-class Processors (TF-A). This includes the boot ROM (BL1),
17the trusted boot firmware (BL2) and the runtime EL3 firmware (BL31) as
18shown on Figure 1. Everything else on Figure 1 is outside of the scope of
19the evaluation.
20
21TF-A can be configured in various ways. In this threat model we consider
22only the most basic configuration. To that end we make the following
23assumptions:
24
25- All TF-A images are run from either ROM or on-chip trusted SRAM. This means
26 TF-A is not vulnerable to an attacker that can probe or tamper with off-chip
27 memory.
28- Trusted boot is enabled. This means an attacker can't boot arbitrary images
29 that are not approved by platform providers.
30- There is no Secure-EL2. We don't consider threats that may come with
31 Secure-EL2 software.
32
33Data Flow Diagram
34======================
35Figure 1 shows a high-level data flow diagram for TF-A. The diagram
36shows a model of the different components of a TF-A-based system and
37their interactions with TF-A. A description of each diagram element
38is given on Table 1. On the diagram, the red broken lines indicate
39trust boundaries. Components outside of the broken lines
40are considered untrusted by TF-A.
41
42.. uml:: ../resources/diagrams/plantuml/tfa_dfd.puml
43 :caption: Figure 1: TF-A Data Flow Diagram
44
45.. table:: Table 1: TF-A Data Flow Diagram Description
46
47 +-----------------+--------------------------------------------------------+
48 | Diagram Element | Description |
49 +=================+========================================================+
50 | ``DF1`` | | At boot time, images are loaded from non-volatile |
51 | | memory and verified by TF-A boot firmware. These |
52 | | images include TF-A BL2 and BL31 images, as well as |
53 | | other secure and non-secure images. |
54 +-----------------+--------------------------------------------------------+
55 | ``DF2`` | | TF-A log system framework outputs debug messages |
56 | | over a UART interface. |
57 +-----------------+--------------------------------------------------------+
58 | ``DF3`` | | Debug and trace IP on a platform can allow access |
59 | | to registers and memory of TF-A. |
60 +-----------------+--------------------------------------------------------+
61 | ``DF4`` | | Secure world software (e.g. trusted OS) interact |
62 | | with TF-A through SMC call interface and/or shared |
63 | | memory. |
64 +-----------------+--------------------------------------------------------+
65 | ``DF5`` | | Non-secure world software (e.g. rich OS) interact |
66 | | with TF-A through SMC call interface and/or shared |
67 | | memory. |
68 +-----------------+--------------------------------------------------------+
69 | ``DF6`` | | This path represents the interaction between TF-A and|
70 | | various hardware IPs such as TrustZone controller |
71 | | and GIC. At boot time TF-A configures/initializes the|
72 | | IPs and interacts with them at runtime through |
73 | | interrupts and registers. |
74 +-----------------+--------------------------------------------------------+
75
76
77*********************
78Threat Analysis
79*********************
80In this section we identify and provide assessment of potential threats to TF-A
81firmware. The threats are identified for each diagram element on the
82data flow diagram above.
83
84For each threat, we identify the *asset* that is under threat, the
85*threat agent* and the *threat type*. Each threat is given a *risk rating*
86that represents the impact and likelihood of that threat. We also discuss
87potential mitigations.
88
89Assets
90==================
91We have identified the following assets for TF-A:
92
93.. table:: Table 2: TF-A Assets
94
95 +--------------------+---------------------------------------------------+
96 | Asset | Description |
97 +====================+===================================================+
98 | ``Sensitive Data`` | | These include sensitive data that an attacker |
99 | | must not be able to tamper with (e.g. the Root |
100 | | of Trust Public Key) or see (e.g. secure logs, |
101 | | debugging information such as crash reports). |
102 +--------------------+---------------------------------------------------+
103 | ``Code Execution`` | | This represents the requirement that the |
104 | | platform should run only TF-A code approved by |
105 | | the platform provider. |
106 +--------------------+---------------------------------------------------+
107 | ``Availability`` | | This represents the requirement that TF-A |
108 | | services should always be available for use. |
109 +--------------------+---------------------------------------------------+
110
111Threat Agents
112=====================
113To understand the attack surface, it is important to identify potential
114attackers, i.e. attack entry points. The following threat agents are
115in scope of this threat model.
116
117.. table:: Table 3: Threat Agents
118
119 +-------------------+-------------------------------------------------------+
120 | Threat Agent | Description |
121 +===================+=======================================================+
122 | ``NSCode`` | | Malicious or faulty code running in the Non-secure |
123 | | world, including NS-EL0 NS-EL1 and NS-EL2 levels |
124 +-------------------+-------------------------------------------------------+
125 | ``SecCode`` | | Malicious or faulty code running in the secure |
126 | | world, including S-EL0 and S-EL1 levels |
127 +-------------------+-------------------------------------------------------+
128 | ``AppDebug`` | | Physical attacker using debug signals to access |
129 | | TF-A resources |
130 +-------------------+-------------------------------------------------------+
131 | ``PhysicalAccess``| | Physical attacker having access to external device |
132 | | communication bus and to external flash |
133 | | communication bus using common hardware |
134 +-------------------+-------------------------------------------------------+
135
136.. note::
137
138 In this threat model an advanced physical attacker that has the capability
139 to tamper with a hardware (e.g. "rewiring" a chip using a focused
140 ion beam (FIB) workstation or decapsulate the chip using chemicals) is
141 considered out-of-scope.
142
143Threat Types
144========================
145In this threat model we categorize threats using the `STRIDE threat
146analysis technique`_. In this technique a threat is categorized as one
147or more of these types: ``Spoofing``, ``Tampering``, ``Repudiation``,
148``Information disclosure``, ``Denial of service`` or
149``Elevation of privilege``.
150
151Threat Risk Ratings
152========================
153For each threat identified, a risk rating that ranges
154from *informational* to *critical* is given based on the likelihood of the
155threat occuring if a mitigation is not in place, and the impact of the
156threat (i.e. how severe the consequences could be). Table 4 explains each
157rating in terms of score, impact and likelihood.
158
159.. table:: Table 4: Rating and score as applied to impact and likelihood
160
161 +-----------------------+-------------------------+---------------------------+
162 | **Rating (Score)** | **Impact** | **Likelihood** |
163 +=======================+=========================+===========================+
164 | ``Critical (5)`` | | Extreme impact to | | Threat is almost |
165 | | entire organization | certain to be exploited.|
166 | | if exploited. | |
167 | | | | Knowledge of the threat |
168 | | | and how to exploit it |
169 | | | are in the public |
170 | | | domain. |
171 +-----------------------+-------------------------+---------------------------+
172 | ``High (4)`` | | Major impact to entire| | Threat is relatively |
173 | | organization or single| easy to detect and |
174 | | line of business if | exploit by an attacker |
175 | | exploited | with little skill. |
176 +-----------------------+-------------------------+---------------------------+
177 | ``Medium (3)`` | | Noticeable impact to | | A knowledgeable insider |
178 | | line of business if | or expert attacker could|
179 | | exploited. | exploit the threat |
180 | | | without much difficulty.|
181 +-----------------------+-------------------------+---------------------------+
182 | ``Low (2)`` | | Minor damage if | | Exploiting the threat |
183 | | exploited or could | would require |
184 | | be used in conjunction| considerable expertise |
185 | | with other | and resources |
186 | | vulnerabilities to | |
187 | | perform a more serious| |
188 | | attack | |
189 +-----------------------+-------------------------+---------------------------+
190 | ``Informational (1)`` | | Poor programming | | Threat is not likely |
191 | | practice or poor | to be exploited on its |
192 | | design decision that | own, but may be used to |
193 | | may not represent an | gain information for |
194 | | immediate risk on its | launching another |
195 | | own, but may have | attack |
196 | | security implications | |
197 | | if multiplied and/or | |
198 | | combined with other | |
199 | | threats. | |
200 +-----------------------+-------------------------+---------------------------+
201
202Aggregate risk scores are assigned to identified threats;
203specifically, the impact score multiplied by the likelihood score.
204For example, a threat with high likelihood and low impact would have an
205aggregate risk score of eight (8); that is, four (4) for high likelihood
206multiplied by two (2) for low impact. The aggregate risk score determines
207the finding's overall risk level, as shown in the following table.
208
209.. table:: Table 5: Overall risk levels and corresponding aggregate scores
210
211 +---------------------+-----------------------------------+
212 | Overall Risk Level | Aggregate Risk Score |
213 | | (Impact multiplied by Likelihood) |
214 +=====================+===================================+
215 | Critical | 20–25 |
216 +---------------------+-----------------------------------+
217 | High | 12–19 |
218 +---------------------+-----------------------------------+
219 | Medium | 6–11 |
220 +---------------------+-----------------------------------+
221 | Low | 2–5 |
222 +---------------------+-----------------------------------+
223 | Informational | 1 |
224 +---------------------+-----------------------------------+
225
226The likelihood and impact of a threat depends on the
227target environment in which TF-A is running. For example, attacks
228that require physical access are unlikely in server environments while
229they are more common in Internet of Things(IoT) environments.
230In this threat model we consider three target environments:
231``Internet of Things(IoT)``, ``Mobile`` and ``Server``.
232
233Threat Assessment
234============================
235The following threats were identified by applying STRIDE analysis on
236each diagram element of the data flow diagram.
237
238+------------------------+----------------------------------------------------+
239| ID | 01 |
240+========================+====================================================+
241| ``Threat`` | | **An attacker can mangle firmware images to |
242| | execute arbitrary code** |
243| | |
244| | | Some TF-A images are loaded from external |
245| | storage. It is possible for an attacker to access|
246| | the external flash memory and change its contents|
247| | physically, through the Rich OS, or using the |
248| | updating mechanism to modify the non-volatile |
249| | images to execute arbitrary code. |
250+------------------------+----------------------------------------------------+
251| ``Diagram Elements`` | DF1, DF4, DF5 |
252+------------------------+----------------------------------------------------+
253| ``Affected TF-A | BL2, BL31 |
254| Components`` | |
255+------------------------+----------------------------------------------------+
256| ``Assets`` | Code Execution |
257+------------------------+----------------------------------------------------+
258| ``Threat Agent`` | PhysicalAccess, NSCode, SecCode |
259+------------------------+----------------------------------------------------+
260| ``Threat Type`` | Tampering, Elevation of Privilege |
261+------------------------+------------------+-----------------+---------------+
262| ``Application`` | ``Server`` | ``IoT`` | ``Mobile`` |
263+------------------------+------------------+-----------------+---------------+
264| ``Impact`` | Critical (5) | Critical (5) | Critical (5) |
265+------------------------+------------------+-----------------+---------------+
266| ``Likelihood`` | Critical (5) | Critical (5) | Critical (5) |
267+------------------------+------------------+-----------------+---------------+
268| ``Total Risk Rating`` | Critical (25) | Critical (25) | Critical (25) |
269+------------------------+------------------+-----------------+---------------+
270| ``Mitigations`` | | TF-A implements the `Trusted Board Boot (TBB)`_ |
271| | feature which prevents malicious firmware from |
272| | running on the platform by authenticating all |
273| | firmware images. In addition to this, the TF-A |
274| | boot firmware performs extra checks on |
275| | unauthenticated data, such as FIP metadata, prior|
276| | to use. |
277+------------------------+----------------------------------------------------+
278
279+------------------------+----------------------------------------------------+
280| ID | 02 |
281+========================+====================================================+
282| ``Threat`` | | **An attacker may attempt to boot outdated, |
283| | potentially vulnerable firmware image** |
284| | |
285| | | When updating firmware, an attacker may attempt |
286| | to rollback to an older version that has unfixed |
287| | vulnerabilities. |
288+------------------------+----------------------------------------------------+
289| ``Diagram Elements`` | DF1, DF4, DF5 |
290+------------------------+----------------------------------------------------+
291| ``Affected TF-A | BL2, BL31 |
292| Components`` | |
293+------------------------+----------------------------------------------------+
294| ``Assets`` | Code Execution |
295+------------------------+----------------------------------------------------+
296| ``Threat Agent`` | PhysicalAccess, NSCode, SecCode |
297+------------------------+----------------------------------------------------+
298| ``Threat Type`` | Tampering |
299+------------------------+------------------+-----------------+---------------+
300| ``Application`` | ``Server`` | ``IoT`` | ``Mobile`` |
301+------------------------+------------------+-----------------+---------------+
302| ``Impact`` | Critical (5) | Critical (5) | Critical (5) |
303+------------------------+------------------+-----------------+---------------+
304| ``Likelihood`` | Critical (5) | Critical (5) | Critical (5) |
305+------------------------+------------------+-----------------+---------------+
306| ``Total Risk Rating`` | Critical (25) | Critical (25) | Critical (25) |
307+------------------------+------------------+-----------------+---------------+
308| ``Mitigations`` | | TF-A supports anti-rollback protection using |
309| | non-volatile counters (NV counters) as required |
310| | by `TBBR-Client specification`_. After a firmware|
311| | image is validated, the image revision number |
312| | taken from a certificate extension field is |
313| | compared with the corresponding NV counter stored|
314| | in hardware to make sure the new counter value is|
315| | larger or equal to the current counter value. |
316| | Platforms must implement this protection using |
317| | platform specific hardware NV counters. |
318+------------------------+----------------------------------------------------+
319
320+------------------------+-------------------------------------------------------+
321| ID | 03 |
322+========================+=======================================================+
323| ``Threat`` | | **An attacker can use Time-of-Check-Time-of-Use |
324| | (TOCTOU) attack to bypass image authentication |
325| | during the boot process** |
326| | |
327| | | Time-of-Check-Time-of-Use (TOCTOU) threats occur |
328| | when the security check is produced before the time |
329| | the resource is accessed. If an attacker is sitting |
330| | in the middle of the off-chip images, they could |
331| | change the binary containing executable code right |
332| | after the integrity and authentication check has |
333| | been performed. |
334+------------------------+-------------------------------------------------------+
335| ``Diagram Elements`` | DF1 |
336+------------------------+-------------------------------------------------------+
337| ``Affected TF-A | BL1, BL2 |
338| Components`` | |
339+------------------------+-------------------------------------------------------+
340| ``Assets`` | Code Execution, Sensitive Data |
341+------------------------+-------------------------------------------------------+
342| ``Threat Agent`` | PhysicalAccess |
343+------------------------+-------------------------------------------------------+
344| ``Threat Type`` | Elevation of Privilege |
345+------------------------+---------------------+-----------------+---------------+
346| ``Application`` | ``Server`` | ``IoT`` | ``Mobile`` |
347+------------------------+---------------------+-----------------+---------------+
348| ``Impact`` | N/A | Critical (5) | Critical (5) |
349+------------------------+---------------------+-----------------+---------------+
350| ``Likelihood`` | N/A | Medium (3) | Medium (3) |
351+------------------------+---------------------+-----------------+---------------+
352| ``Total Risk Rating`` | N/A | High (15) | High (15) |
353+------------------------+---------------------+-----------------+---------------+
354| ``Mitigations`` | | TF-A boot firmware copies image to on-chip |
355| | memory before authenticating an image. |
356+------------------------+-------------------------------------------------------+
357
358+------------------------+-------------------------------------------------------+
359| ID | 04 |
360+========================+=======================================================+
361| ``Threat`` | | **An attacker with physical access can execute |
362| | arbitrary image by bypassing the signature |
363| | verification stage using glitching techniques** |
364| | |
365| | | Glitching (Fault injection) attacks attempt to put |
366| | a hardware into a undefined state by manipulating an|
367| | environmental variable such as power supply. |
368| | |
369| | | TF-A relies on a chain of trust that starts with the|
370| | ROTPK, which is the key stored inside the chip and |
371| | the root of all validation processes. If an attacker|
372| | can break this chain of trust, they could execute |
373| | arbitrary code on the device. This could be |
374| | achieved with physical access to the device by |
375| | attacking the normal execution flow of the |
376| | process using glitching techniques that target |
377| | points where the image is validated against the |
378| | signature. |
379+------------------------+-------------------------------------------------------+
380| ``Diagram Elements`` | DF1 |
381+------------------------+-------------------------------------------------------+
382| ``Affected TF-A | BL1, BL2 |
383| Components`` | |
384+------------------------+-------------------------------------------------------+
385| ``Assets`` | Code Execution |
386+------------------------+-------------------------------------------------------+
387| ``Threat Agent`` | PhysicalAccess |
388+------------------------+-------------------------------------------------------+
389| ``Threat Type`` | Tampering, Elevation of Privilege |
390+------------------------+---------------------+-----------------+---------------+
391| ``Application`` | ``Server`` | ``IoT`` | ``Mobile`` |
392+------------------------+---------------------+-----------------+---------------+
393| ``Impact`` | N/A | Critical (5) | Critical (5) |
394+------------------------+---------------------+-----------------+---------------+
395| ``Likelihood`` | N/A | Medium (3) | Medium (3) |
396+------------------------+---------------------+-----------------+---------------+
397| ``Total Risk Rating`` | N/A | High (15) | High (15) |
398+------------------------+---------------------+-----------------+---------------+
399| ``Mitigations`` | | The most effective mitigation is adding glitching |
400| | detection and mitigation circuit at the hardware |
401| | level. However, software techniques, |
402| | such as adding redundant checks when performing |
403| | conditional branches that are security sensitive, |
404| | can be used to harden TF-A against such attacks. |
405| | **At the moment TF-A doesn't implement such |
406| | mitigations.** |
407+------------------------+-------------------------------------------------------+
408
409+------------------------+---------------------------------------------------+
410| ID | 05 |
411+========================+===================================================+
412| ``Threat`` | | **Information leak via UART logs such as |
413| | crashes** |
414| | |
415| | | During the development stages of software it is |
416| | common to include crash reports with detailed |
417| | information of the CPU state including current |
418| | values of the registers, privilege level and |
419| | stack dumps. This information is useful when |
420| | debugging problems before releasing the |
421| | production version, but it could be used by an |
422| | attacker to develop a working exploit if left |
423| | in the production version. |
424+------------------------+---------------------------------------------------+
425| ``Diagram Elements`` | DF2 |
426+------------------------+---------------------------------------------------+
427| ``Affected TF-A | BL1, BL2, BL31 |
428| Components`` | |
429+------------------------+---------------------------------------------------+
430| ``Assets`` | Sensitive Data |
431+------------------------+---------------------------------------------------+
432| ``Threat Agent`` | AppDebug |
433+------------------------+---------------------------------------------------+
434| ``Threat Type`` | Information Disclosure |
435+------------------------+------------------+----------------+---------------+
436| ``Application`` | ``Server`` | ``IoT`` | ``Mobile`` |
437+------------------------+------------------+----------------+---------------+
438| ``Impact`` | N/A | Low (2) | Low (2) |
439+------------------------+------------------+----------------+---------------+
440| ``Likelihood`` | N/A | High (4) | High (4) |
441+------------------------+------------------+----------------+---------------+
442| ``Total Risk Rating`` | N/A | Medium (8) | Medium (8) |
443+------------------------+------------------+----------------+---------------+
444| ``Mitigations`` | | In TF-A, crash reporting is only enabled for |
445| | debug builds by default. Alternatively, the log |
446| | level can be tuned at build time (from verbose |
447| | to no output at all), independently of the |
448| | build type. |
449+------------------------+---------------------------------------------------+
450
451+------------------------+----------------------------------------------------+
452| ID | 06 |
453+========================+====================================================+
454| ``Threat`` | | **An attacker can read sensitive data and |
455| | execute arbitrary code through the external |
456| | debug and trace interface** |
457| | |
458| | | Arm processors include hardware-assisted debug |
459| | and trace features that can be controlled without|
460| | the need for software operating on the platform. |
461| | If left enabled without authentication, this |
462| | feature can be used by an attacker to inspect and|
463| | modify TF-A registers and memory allowing the |
464| | attacker to read sensitive data and execute |
465| | arbitrary code. |
466+------------------------+----------------------------------------------------+
467| ``Diagram Elements`` | DF3 |
468+------------------------+----------------------------------------------------+
469| ``Affected TF-A | BL1, BL2, BL31 |
470| Components`` | |
471+------------------------+----------------------------------------------------+
472| ``Assets`` | Code Execution, Sensitive Data |
473+------------------------+----------------------------------------------------+
474| ``Threat Agent`` | AppDebug |
475+------------------------+----------------------------------------------------+
476| ``Threat Type`` | Tampering, Information Disclosure, |
477| | Elevation of privilege |
478+------------------------+------------------+---------------+-----------------+
479| ``Application`` | ``Server`` | ``IoT`` | ``Mobile`` |
480+------------------------+------------------+---------------+-----------------+
481| ``Impact`` | N/A | High (4) | High (4) |
482+------------------------+------------------+---------------+-----------------+
483| ``Likelihood`` | N/A | Critical (5) | Critical (5) |
484+------------------------+------------------+---------------+-----------------+
485| ``Total Risk Rating`` | N/A | Critical (20) | Critical (20) |
486+------------------------+------------------+---------------+-----------------+
487| ``Mitigations`` | | Configuration of debug and trace capabilities is |
488| | platform specific. Therefore, platforms must |
489| | disable the debug and trace capability for |
490| | production releases or enable proper debug |
491| | authentication as recommended by [`DEN0034`_]. |
492+------------------------+----------------------------------------------------+
493
494+------------------------+------------------------------------------------------+
495| ID | 07 |
496+========================+======================================================+
497| ``Threat`` | | **An attacker can perform a denial-of-service |
498| | attack by using a broken SMC call that causes the |
499| | system to reboot or enter into unknown state.** |
500| | |
501| | | Secure and non-secure clients access TF-A services |
502| | through SMC calls. Malicious code can attempt to |
503| | place the TF-A runtime into an inconsistent state |
504| | by calling unimplemented SMC call or by passing |
505| | invalid arguments. |
506+------------------------+------------------------------------------------------+
507| ``Diagram Elements`` | DF4, DF5 |
508+------------------------+------------------------------------------------------+
509| ``Affected TF-A | BL31 |
510| Components`` | |
511+------------------------+------------------------------------------------------+
512| ``Assets`` | Availability |
513+------------------------+------------------------------------------------------+
514| ``Threat Agent`` | NSCode, SecCode |
515+------------------------+------------------------------------------------------+
516| ``Threat Type`` | Denial of Service |
517+------------------------+-------------------+----------------+-----------------+
518| ``Application`` | ``Server`` | ``IoT`` | ``Mobile`` |
519+------------------------+-------------------+----------------+-----------------+
520| ``Impact`` | Medium (3) | Medium (3) | Medium (3) |
521+------------------------+-------------------+----------------+-----------------+
522| ``Likelihood`` | High (4) | High (4) | High (4) |
523+------------------------+-------------------+----------------+-----------------+
524| ``Total Risk Rating`` | High (12) | High (12) | High (12) |
525+------------------------+-------------------+----------------+-----------------+
526| ``Mitigations`` | | The generic TF-A code validates SMC function ids |
527| | and arguments before using them. |
528| | Platforms that implement SiP services must also |
529| | validate SMC call arguments. |
530+------------------------+------------------------------------------------------+
531
532+------------------------+------------------------------------------------------+
533| ID | 08 |
534+========================+======================================================+
535| ``Threat`` | | **Memory corruption due to memory overflows and |
536| | lack of boundary checking when accessing resources |
537| | could allow an attacker to execute arbitrary code, |
538| | modify some state variable to change the normal |
539| | flow of the program, or leak sensitive |
540| | information** |
541| | |
542| | | Like in other software, the Trusted Firmware has |
543| | multiple points where memory corruption security |
544| | errors can arise. Memory corruption is a dangerous |
545| | security issue since it could allow an attacker |
546| | to execute arbitrary code, modify some state |
547| | variable to change the normal flow of the program, |
548| | or leak sensitive information. |
549| | |
550| | | Some of the errors include integer overflow, |
551| | buffer overflow, incorrect array boundary checks, |
552| | and incorrect error management. |
553| | Improper use of asserts instead of proper input |
554| | validations might also result in these kinds of |
555| | errors in release builds. |
556+------------------------+------------------------------------------------------+
557| ``Diagram Elements`` | DF4, DF5 |
558+------------------------+------------------------------------------------------+
559| ``Affected TF-A | BL1, BL2, BL31 |
560| Components`` | |
561+------------------------+------------------------------------------------------+
562| ``Assets`` | Code Execution, Sensitive Data |
563+------------------------+------------------------------------------------------+
564| ``Threat Agent`` | NSCode, SecCode |
565+------------------------+------------------------------------------------------+
566| ``Threat Type`` | Tampering, Information Disclosure, |
567| | Elevation of Privilege |
568+------------------------+-------------------+-----------------+----------------+
569| ``Application`` | ``Server`` | ``IoT`` | ``Mobile`` |
570+------------------------+-------------------+-----------------+----------------+
571| ``Impact`` | Critical (5) | Critical (5) | Critical (5) |
572+------------------------+-------------------+-----------------+----------------+
573| ``Likelihood`` | Medium (3 | Medium (3) | Medium (3) |
574+------------------------+-------------------+-----------------+----------------+
575| ``Total Risk Rating`` | High (15) | High (15) | High (15) |
576+------------------------+-------------------+-----------------+----------------+
577| ``Mitigations`` | | TF-A uses a combination of manual code reviews and |
578| | automated program analysis and testing to detect |
579| | and fix memory corruption bugs. All TF-A code |
580| | including platform code go through manual code |
581| | reviews. Additionally, static code analysis is |
582| | performed using Coverity Scan on all TF-A code. |
583| | The code is also tested with |
584| | `Trusted Firmware-A Tests`_ on Juno and FVP |
585| | platforms. |
586| | |
587| | | Data received from normal world, such as addresses |
588| | and sizes identifying memory regions, are |
589| | sanitized before being used. These security checks |
590| | make sure that the normal world software does not |
591| | access memory beyond its limit. |
592| | |
593| | | By default *asserts* are only used to check for |
594| | programming errors in debug builds. Other types of |
595| | errors are handled through condition checks that |
596| | remain enabled in release builds. See |
597| | `TF-A error handling policy`_. TF-A provides an |
598| | option to use *asserts* in release builds, however |
599| | we recommend using proper runtime checks instead |
600| | of relying on asserts in release builds. |
601+------------------------+------------------------------------------------------+
602
603+------------------------+------------------------------------------------------+
604| ID | 09 |
605+========================+======================================================+
606| ``Threat`` | | **Improperly handled SMC calls can leak register |
607| | contents** |
608| | |
609| | | When switching between secure and non-secure |
610| | states, register contents of Secure world or |
611| | register contents of other normal world clients |
612| | can be leaked. |
613+------------------------+------------------------------------------------------+
614| ``Diagram Elements`` | DF5 |
615+------------------------+------------------------------------------------------+
616| ``Affected TF-A | BL31 |
617| Components`` | |
618+------------------------+------------------------------------------------------+
619| ``Assets`` | Sensitive Data |
620+------------------------+------------------------------------------------------+
621| ``Threat Agent`` | NSCode |
622+------------------------+------------------------------------------------------+
623| ``Threat Type`` | Information Disclosure |
624+------------------------+-------------------+----------------+-----------------+
625| ``Application`` | ``Server`` | ``IoT`` | ``Mobile`` |
626+------------------------+-------------------+----------------+-----------------+
627| ``Impact`` | Medium (3) | Medium (3) | Medium (3) |
628+------------------------+-------------------+----------------+-----------------+
629| ``Likelihood`` | High (4) | High (4) | High (4) |
630+------------------------+-------------------+----------------+-----------------+
631| ``Total Risk Rating`` | High (12) | High (12) | High (12) |
632+------------------------+-------------------+----------------+-----------------+
633| ``Mitigations`` | | TF-A saves and restores registers |
634| | by default when switching contexts. Build options |
635| | are also provided to save/restore additional |
636| | registers such as floating-point registers. |
637+------------------------+------------------------------------------------------+
638
639+------------------------+-----------------------------------------------------+
640| ID | 10 |
641+========================+=====================================================+
642| ``Threat`` | | **SMC calls can leak sensitive information from |
643| | TF-A memory via microarchitectural side channels**|
644| | |
645| | | Microarchitectural side-channel attacks such as |
646| | `Spectre`_ can be used to leak data across |
647| | security boundaries. An attacker might attempt to |
648| | use this kind of attack to leak sensitive |
649| | data from TF-A memory. |
650+------------------------+-----------------------------------------------------+
651| ``Diagram Elements`` | DF4, DF5 |
652+------------------------+-----------------------------------------------------+
653| ``Affected TF-A | BL31 |
654| Components`` | |
655+------------------------+-----------------------------------------------------+
656| ``Assets`` | Sensitive Data |
657+------------------------+-----------------------------------------------------+
658| ``Threat Agent`` | SecCode, NSCode |
659+------------------------+-----------------------------------------------------+
660| ``Threat Type`` | Information Disclosure |
661+------------------------+-------------------+----------------+----------------+
662| ``Application`` | ``Server`` | ``IoT`` | ``Mobile`` |
663+------------------------+-------------------+----------------+----------------+
664| ``Impact`` | Medium (3) | Medium (3) | Medium (3) |
665+------------------------+-------------------+----------------+----------------+
666| ``Likelihood`` | Medium (3) | Medium (3) | Medium (3) |
667+------------------------+-------------------+----------------+----------------+
668| ``Total Risk Rating`` | Medium (9) | Medium (9) | Medium (9) |
669+------------------------+-------------------+----------------+----------------+
670| ``Mitigations`` | | TF-A implements software mitigations for Spectre |
671| | type attacks as recommended by `Cache Speculation |
672| | Side-channels`_ for the generic code. SiPs should |
673| | implement similar mitigations for code that is |
674| | deemed to be vulnerable to such attacks. |
675+------------------------+-----------------------------------------------------+
676
677+------------------------+----------------------------------------------------+
678| ID | 11 |
679+========================+====================================================+
680| ``Threat`` | | **Misconfiguration of the Memory Management Unit |
681| | (MMU) may allow a normal world software to |
682| | access sensitive data or execute arbitrary |
683| | code** |
684| | |
685| | | A misconfiguration of the MMU could |
686| | lead to an open door for software running in the |
687| | normal world to access sensitive data or even |
688| | execute code if the proper security mechanisms |
689| | are not in place. |
690+------------------------+----------------------------------------------------+
691| ``Diagram Elements`` | DF5, DF6 |
692+------------------------+----------------------------------------------------+
693| ``Affected TF-A | BL1, BL2, BL31 |
694| Components`` | |
695+------------------------+----------------------------------------------------+
696| ``Assets`` | Sensitive Data, Code execution |
697+------------------------+----------------------------------------------------+
698| ``Threat Agent`` | NSCode |
699+------------------------+----------------------------------------------------+
700| ``Threat Type`` | Information Disclosure, Elevation of Privilege |
701+------------------------+-----------------+-----------------+----------------+
702| ``Application`` | ``Server`` | ``IoT`` | ``Mobile`` |
703+------------------------+-----------------+-----------------+----------------+
704| ``Impact`` | Critical (5) | Critical (5) | Critical (5) |
705+------------------------+-----------------+-----------------+----------------+
706| ``Likelihood`` | High (4) | High (4) | High (4) |
707+------------------------+-----------------+-----------------+----------------+
708| ``Total Risk Rating`` | Critical (20) | Critical (20) | Critical (20) |
709+------------------------+-----------------+-----------------+----------------+
710| ``Mitigations`` | | In TF-A, configuration of the MMU is done |
711| | through a translation tables library. The |
712| | library provides APIs to define memory regions |
713| | and assign attributes including memory types and |
714| | access permissions. Memory configurations are |
715| | platform specific, therefore platforms need make |
716| | sure the correct attributes are assigned to |
717| | memory regions. When assigning access |
718| | permissions, principle of least privilege ought |
719| | to be enforced, i.e. we should not grant more |
720| | privileges than strictly needed, e.g. code |
721| | should be read-only executable, RO data should |
722| | be read-only XN, and so on. |
723+------------------------+----------------------------------------------------+
724
725+------------------------+-----------------------------------------------------+
726| ID | 12 |
727+========================+=====================================================+
728| ``Threat`` | | **Incorrect configuration of Performance Monitor |
729| | Unit (PMU) counters can allow an attacker to |
730| | mount side-channel attacks using information |
731| | exposed by the counters** |
732| | |
733| | | Non-secure software can configure PMU registers |
734| | to count events at any exception level and in |
735| | both Secure and Non-secure states. This allows |
736| | a Non-secure software (or a lower-level Secure |
737| | software) to potentially carry out |
738| | side-channel timing attacks against TF-A. |
739+------------------------+-----------------------------------------------------+
740| ``Diagram Elements`` | DF5, DF6 |
741+------------------------+-----------------------------------------------------+
742| ``Affected TF-A | BL31 |
743| Components`` | |
744+------------------------+-----------------------------------------------------+
745| ``Assets`` | Sensitive Data |
746+------------------------+-----------------------------------------------------+
747| ``Threat Agent`` | NSCode |
748+------------------------+-----------------------------------------------------+
749| ``Threat Type`` | Information Disclosure |
750+------------------------+-------------------+----------------+----------------+
751| ``Impact`` | Medium (3) | Medium (3) | Medium (3) |
752+------------------------+-------------------+----------------+----------------+
753| ``Likelihood`` | Low (2) | Low (2) | Low (2) |
754+------------------------+-------------------+----------------+----------------+
755| ``Total Risk Rating`` | Medium (6) | Medium (6) | Medium (6) |
756+------------------------+-------------------+----------------+----------------+
757| ``Mitigations`` | | TF-A follows mitigation strategies as described |
758| | in `Secure Development Guidelines`_. General |
759| | events and cycle counting in the Secure world is |
760| | prohibited by default when applicable. However, |
761| | on some implementations (e.g. PMUv3) Secure world |
762| | event counting depends on external debug interface|
763| | signals, i.e. Secure world event counting is |
764| | enabled if external debug is enabled. |
765| | Configuration of debug signals is platform |
766| | specific, therefore platforms need to make sure |
767| | that external debug is disabled in production or |
768| | proper debug authentication is in place. |
769+------------------------+-----------------------------------------------------+
770
771--------------
772
773*Copyright (c) 2021, Arm Limited. All rights reserved.*
774
775
776.. _STRIDE threat analysis technique: https://docs.microsoft.com/en-us/azure/security/develop/threat-modeling-tool-threats#stride-model
777.. _DEN0034: https://developer.arm.com/documentation/den0034/latest
778.. _Cache Speculation Side-channels: https://developer.arm.com/support/arm-security-updates/speculative-processor-vulnerability
779.. _Spectre: https://developer.arm.com/support/arm-security-updates/speculative-processor-vulnerability
780.. _TBBR-Client specification: https://developer.arm.com/documentation/den0006/d/
781.. _Trusted Board Boot (TBB): https://trustedfirmware-a.readthedocs.io/en/latest/design/trusted-board-boot.html
782.. _TF-A error handling policy: https://trustedfirmware-a.readthedocs.io/en/latest/process/coding-guidelines.html#error-handling-and-robustness
783.. _Secure Development Guidelines: https://trustedfirmware-a.readthedocs.io/en/latest/process/security-hardening.html#secure-development-guidelines
784.. _Trusted Firmware-A Tests: https://git.trustedfirmware.org/TF-A/tf-a-tests.git/about/