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