Adding file naming and indexing
[AGL/documentation.git] / docs / 03_Architecture_Guides / 02_Security_Blueprint / 09_Update_(Over_The_Air).md
1 ---
2 title: Update (Over The Air)
3 ---
4
5 Updating applications and firmware is essential for the development of new
6 features and even more to fix security bugs. However, if a malicious third party
7 manages to alter the content during transport, it could alter the functioning of
8 the system and/or applications. The security of the updates is therefore a
9 critical point to evaluate in order to guarantee the integrity, the
10 confidentiality and the legitimacy of the transmitted data.
11
12 ## Attack Vectors
13
14 Updates Over The Air (OTA) are one of the most common points where an attacker will
15 penetrate. An OTA update mechanism is one of the highest threats in the system.
16 If an attacker is able to install his own application or firmware on the system,
17 he can get the same level of access that the original application or firmware
18 had. From that point, the intruder can get unfettered access to the rest of the
19 system, which might include making modifications, downloading other pieces of
20 software, and stealing assets.
21
22 ### Man In The Middle (MITM)
23
24 The man-in-the-middle attack is the most classic example of an attack, where an
25 adversary inserts himself between two communicating entities and grabs whatever
26 is being communicated. In the case of OTA attacks, the connection in the network
27 may be intercepted:
28
29 * On the internet, before the cloud back-end.
30 * At the base station, 3G,4G,5G connection to the internet.
31 * At the receiving antenna, connection to the car.
32 * Between the receiving antenna and the gateway router (if present), connection
33   within the car.
34 * Between the gateway router and the target component (IVI, In-Vehicle
35   Infotainment unit).
36
37 There are many ways to mount a MITM attack. For example, proxy tools like Burp
38 Proxy can be used to intercept web traffic as a man-in-the-middle. Under the
39 guise of being a testing tool, the proxy server is often used in attack
40 scenarios. It runs on a variety of platforms.
41
42 As another example, false base station attacks are known to be fairly easy to
43 set-up. The problem is apparently fairly prevalent in countries like China and
44 in the UK. These fake base stations are sometimes just eavesdropping on the
45 communication, but others have the potential to do serious harm.
46
47 Defenses against MITM attacks include encrypted and signed data pipes.
48 Furthermore, architects and developers are also recommended to encrypt and sign
49 the payloads that are being passed over these pipes, to defend against perusal
50 of the data.
51
52 ### Man At The End (MATE)
53
54 The man-at-the-end attack is when an intruder analyzes the end-point of the
55 communication when software is accessing the data communication. This is a more
56 severe attack type where the attacker can:
57
58 * Steal keys.
59   * For example, a simple debugging session in running software could reveal a
60     key used in memory.
61 * Tamper software.
62   * For example, replacing just one function call in software with a NOP (i.e.
63     no operation) can drastically change the behavior of the program.
64 * Jam branches of control.
65   * For example, making a program take one branch of control rather than the
66     intended branch can mean the difference between an authorized and a
67     non-authorized installation.
68 * Modify important data.
69   * For example, if the data changed is a key or data leading to a control path,
70     then this attack can be severe.
71   * In the case of OTA updates, MATE attacks are particularly problematic for
72     the system. One of the consequences of MATE attacks can be installed
73     software that allows installation of any other software. For example, an
74     attacker might install remote access software to control any part of the
75     system.
76
77 --------------------------------------------------------------------------------
78
79 ## Acronyms and Abbreviations
80
81 The following table lists the terms utilized within this part of the document.
82
83 Acronyms or Abbreviations | Description
84 ------------------------- | -------------------------------------------------------------------------
85 _FOTA_                    | **F**irmware **O**ver **T**he **A**ir
86 _MATE_                    | **M**an **A**t **T**he **E**nd
87 _MITM_                    | **M**an **I**n **T**he **M**iddle
88 _OTA_                     | **O**ver **T**he **A**ir
89 _SOTA_                    | **S**oftware **O**ver **T**he **A**ir
90 _TUF_                     | **T**he **U**pdate **F**ramework
91
92 # Firmware Over The Air
93
94 The firmware update is critical since its alteration back to compromise the
95 entire system. It is therefore necessary to take appropriate protective
96 measures.
97
98 AGL includes the _meta-updater_ Yocto layer that enables OTA software updates
99 via [Uptane](https://uptane.github.io), an automotive-specific extension to [The
100 Update Framework](https://theupdateframework.github.io/). Uptane and TUF are
101 open standards that define a secure protocol for delivering and verifying
102 updates even when the servers and network--internet and car-internal--aren't
103 fully trusted.
104
105 _meta-updater_ includes the application
106 [`aktualizr`](https://github.com/advancedtelematic/aktualizr), developed
107 Advanced Telematic Systems (now part of HERE Technologies) that enables OTA for
108 an ECU. `aktualizr` combined with Uptane is suitable for updating the firmware,
109 software, and other packages on even functionally critical ECUs. `aktualizr` can
110 be enabled with the free, open souce backend
111 [`ota-community-edition`](https://github.com/advancedtelematic/ota-community-edition).
112
113 This FOTA update mechanism can be enabled through the `agl-sota` feature.
114
115 ## Building
116
117 To build an AGL image that uses `aktualizr`, the following can be used.
118
119 ```
120 source meta-agl/scripts/aglsetup.sh -m <machine> agl-sota <other-features...>
121 ```
122
123 During the build, _meta-updater_ will use credentials downloaded from
124 `ota-community-edition` to sign metadata verifying the build as authentic. These
125 signatures are part of the Uptane framework and are used to verify FOTA updates.
126
127 ## Atomic Upgrades with Rollbacks
128
129 `aktualizr`'s primary method of updating firmware is to use `libostree` with
130 binary diffs. The binary diffs use the least amout of bandwidth, and by it's
131 nature `libostree` stores current and previous firmware versions on disk or in
132 flash memory to allow for rollbacks.
133
134 `libostree` is a content addressable object store much like `git`. Versions are
135 specified via SHA2-256. These hashes are signed in the Uptane metadata and are
136 robust against cryptographic compromise.
137
138 # Software Over The Air
139
140 Software updates in connected vehicles are a very useful feature, which can
141 deliver significant benefits. If not implemented with security in mind, software
142 updates can incur serious vulnerabilities. Any software update system must
143 ensure that not only are the software updates to devices done in a secure way,
144 but also that the repositories and servers hosting these updates are adequately
145 protected. As the process of updating software migrates from a Dealership update
146 model towards an **OTA** update model, securing these processes becomes a high
147 priority.
148
149 **SOTA** is made possible by **AppFw** (See Platform part). It will be possible
150 to manage in a simple way the packets (i.g. Android like).
151
152 Domain        | Improvement
153 ------------- | -----------------
154 Update-SOTA-1 | Part to complete.