Tom Cosgrove | 0b86ac1 | 2022-07-29 13:44:01 +0100 | [diff] [blame] | 1 | ## Reporting Vulnerabilities |
Manuel Pégourié-Gonnard | a21abf2 | 2021-02-25 11:41:38 +0100 | [diff] [blame] | 2 | |
| 3 | If you think you have found an Mbed TLS security vulnerability, then please |
| 4 | send an email to the security team at |
| 5 | <mbed-tls-security@lists.trustedfirmware.org>. |
| 6 | |
| 7 | ## Security Incident Handling Process |
| 8 | |
Shaun Case | 8b0ecbc | 2021-12-20 21:14:10 -0800 | [diff] [blame] | 9 | Our security process is detailed in our |
Gilles Peskine | a23df13 | 2021-03-16 12:04:44 +0100 | [diff] [blame] | 10 | [security |
Manuel Pégourié-Gonnard | a21abf2 | 2021-02-25 11:41:38 +0100 | [diff] [blame] | 11 | center](https://developer.trustedfirmware.org/w/mbed-tls/security-center/). |
| 12 | |
| 13 | Its primary goal is to ensure fixes are ready to be deployed when the issue |
| 14 | goes public. |
| 15 | |
| 16 | ## Maintained branches |
| 17 | |
Gilles Peskine | a23df13 | 2021-03-16 12:04:44 +0100 | [diff] [blame] | 18 | Only the maintained branches, as listed in [`BRANCHES.md`](BRANCHES.md), |
| 19 | get security fixes. |
Manuel Pégourié-Gonnard | a21abf2 | 2021-02-25 11:41:38 +0100 | [diff] [blame] | 20 | Users are urged to always use the latest version of a maintained branch. |
Janos Follath | 18d4173 | 2023-02-24 16:00:21 +0000 | [diff] [blame] | 21 | |
| 22 | ## Threat model |
| 23 | |
Janos Follath | c51a413 | 2023-03-14 12:47:27 +0000 | [diff] [blame] | 24 | We classify attacks based on the capabilities of the attacker. |
Janos Follath | 18d4173 | 2023-02-24 16:00:21 +0000 | [diff] [blame] | 25 | |
Janos Follath | 18d4173 | 2023-02-24 16:00:21 +0000 | [diff] [blame] | 26 | ### Remote attacks |
| 27 | |
Janos Follath | 9118bf5 | 2023-03-14 15:43:24 +0000 | [diff] [blame] | 28 | In this section, we consider an attacker who can observe and modify data sent |
| 29 | over the network. This includes observing the content and timing of individual |
| 30 | packets, as well as suppressing or delaying legitimate messages, and injecting |
| 31 | messages. |
Janos Follath | 9ec195c | 2023-03-06 14:54:59 +0000 | [diff] [blame] | 32 | |
Janos Follath | 144dd7d | 2023-03-03 14:56:38 +0000 | [diff] [blame] | 33 | Mbed TLS aims to fully protect against remote attacks and to enable the user |
| 34 | application in providing full protection against remote attacks. Said |
| 35 | protection is limited to providing security guarantees offered by the protocol |
Janos Follath | c51a413 | 2023-03-14 12:47:27 +0000 | [diff] [blame] | 36 | being implemented. (For example Mbed TLS alone won't guarantee that the |
| 37 | messages will arrive without delay, as the TLS protocol doesn't guarantee that |
| 38 | either.) |
Janos Follath | 18d4173 | 2023-02-24 16:00:21 +0000 | [diff] [blame] | 39 | |
Janos Follath | c51a413 | 2023-03-14 12:47:27 +0000 | [diff] [blame] | 40 | **Warning!** Block ciphers do not yet achieve full protection against attackers |
| 41 | who can measure the timing of packets with sufficient precision. For details |
| 42 | and workarounds see the [Block Ciphers](#block-ciphers) section. |
Janos Follath | 3d37760 | 2023-03-08 16:53:50 +0000 | [diff] [blame] | 43 | |
Janos Follath | fef82fd | 2023-03-08 16:10:39 +0000 | [diff] [blame] | 44 | ### Local attacks |
| 45 | |
Janos Follath | 9118bf5 | 2023-03-14 15:43:24 +0000 | [diff] [blame] | 46 | In this section, we consider an attacker who can run software on the same |
| 47 | machine. The attacker has insufficient privileges to directly access Mbed TLS |
| 48 | assets such as memory and files. |
Janos Follath | fef82fd | 2023-03-08 16:10:39 +0000 | [diff] [blame] | 49 | |
| 50 | #### Timing attacks |
Janos Follath | 18d4173 | 2023-02-24 16:00:21 +0000 | [diff] [blame] | 51 | |
Janos Follath | 4317a9e | 2023-03-14 14:49:34 +0000 | [diff] [blame] | 52 | The attacker is able to observe the timing of instructions executed by Mbed TLS |
| 53 | by leveraging shared hardware that both Mbed TLS and the attacker have access |
| 54 | to. Typical attack vectors include cache timings, memory bus contention and |
| 55 | branch prediction. |
Janos Follath | fef82fd | 2023-03-08 16:10:39 +0000 | [diff] [blame] | 56 | |
Janos Follath | 144dd7d | 2023-03-03 14:56:38 +0000 | [diff] [blame] | 57 | Mbed TLS provides limited protection against timing attacks. The cost of |
| 58 | protecting against timing attacks widely varies depending on the granularity of |
| 59 | the measurements and the noise present. Therefore the protection in Mbed TLS is |
Janos Follath | fef82fd | 2023-03-08 16:10:39 +0000 | [diff] [blame] | 60 | limited. We are only aiming to provide protection against **publicly |
Janos Follath | 4317a9e | 2023-03-14 14:49:34 +0000 | [diff] [blame] | 61 | documented attack techniques**. |
| 62 | |
| 63 | As attacks keep improving, so does Mbed TLS's protection. Mbed TLS is moving |
| 64 | towards a model of fully timing-invariant code, but has not reached this point |
| 65 | yet. |
Janos Follath | 042e433 | 2023-03-08 20:07:59 +0000 | [diff] [blame] | 66 | |
| 67 | **Remark:** Timing information can be observed over the network or through |
| 68 | physical side channels as well. Remote and physical timing attacks are covered |
| 69 | in the [Remote attacks](remote-attacks) and [Physical |
| 70 | attacks](physical-attacks) sections respectively. |
Janos Follath | 18d4173 | 2023-02-24 16:00:21 +0000 | [diff] [blame] | 71 | |
Janos Follath | 24792d0 | 2023-03-03 14:16:12 +0000 | [diff] [blame] | 72 | **Warning!** Block ciphers do not yet achieve full protection. For |
Janos Follath | 3d37760 | 2023-03-08 16:53:50 +0000 | [diff] [blame] | 73 | details and workarounds see the [Block Ciphers](#block-ciphers) section. |
Janos Follath | 18d4173 | 2023-02-24 16:00:21 +0000 | [diff] [blame] | 74 | |
Janos Follath | fef82fd | 2023-03-08 16:10:39 +0000 | [diff] [blame] | 75 | #### Local non-timing side channels |
| 76 | |
| 77 | The attacker code running on the platform has access to some sensor capable of |
| 78 | picking up information on the physical state of the hardware while Mbed TLS is |
Janos Follath | c51a413 | 2023-03-14 12:47:27 +0000 | [diff] [blame] | 79 | running. This could for example be an analogue-to-digital converter on the |
Janos Follath | ba75955 | 2023-03-14 14:54:44 +0000 | [diff] [blame] | 80 | platform that is located unfortunately enough to pick up the CPU noise. |
Janos Follath | fef82fd | 2023-03-08 16:10:39 +0000 | [diff] [blame] | 81 | |
Janos Follath | c51a413 | 2023-03-14 12:47:27 +0000 | [diff] [blame] | 82 | Mbed TLS doesn't make any security guarantees against local non-timing-based |
Janos Follath | fef82fd | 2023-03-08 16:10:39 +0000 | [diff] [blame] | 83 | side channel attacks. If local non-timing attacks are present in a use case or |
Janos Follath | c51a413 | 2023-03-14 12:47:27 +0000 | [diff] [blame] | 84 | a user application's threat model, they need to be mitigated by the platform. |
Janos Follath | fef82fd | 2023-03-08 16:10:39 +0000 | [diff] [blame] | 85 | |
| 86 | #### Local fault injection attacks |
| 87 | |
| 88 | Software running on the same hardware can affect the physical state of the |
Janos Follath | ba75955 | 2023-03-14 14:54:44 +0000 | [diff] [blame] | 89 | device and introduce faults. |
Janos Follath | fef82fd | 2023-03-08 16:10:39 +0000 | [diff] [blame] | 90 | |
Janos Follath | c51a413 | 2023-03-14 12:47:27 +0000 | [diff] [blame] | 91 | Mbed TLS doesn't make any security guarantees against local fault injection |
Janos Follath | fef82fd | 2023-03-08 16:10:39 +0000 | [diff] [blame] | 92 | attacks. If local fault injection attacks are present in a use case or a user |
Janos Follath | c51a413 | 2023-03-14 12:47:27 +0000 | [diff] [blame] | 93 | application's threat model, they need to be mitigated by the platform. |
Janos Follath | fef82fd | 2023-03-08 16:10:39 +0000 | [diff] [blame] | 94 | |
Janos Follath | 18d4173 | 2023-02-24 16:00:21 +0000 | [diff] [blame] | 95 | ### Physical attacks |
| 96 | |
Janos Follath | 04fa1a4 | 2023-03-16 15:00:03 +0000 | [diff] [blame^] | 97 | In this section, we consider an attacker who has access to physical information |
| 98 | about the hardware Mbed TLS is running on and/or can alter the physical state |
| 99 | of the hardware (e.g. power analysis, radio emissions or fault injection). |
Janos Follath | 9ec195c | 2023-03-06 14:54:59 +0000 | [diff] [blame] | 100 | |
Janos Follath | c51a413 | 2023-03-14 12:47:27 +0000 | [diff] [blame] | 101 | Mbed TLS doesn't make any security guarantees against physical attacks. If |
Janos Follath | 144dd7d | 2023-03-03 14:56:38 +0000 | [diff] [blame] | 102 | physical attacks are present in a use case or a user application's threat |
Janos Follath | c51a413 | 2023-03-14 12:47:27 +0000 | [diff] [blame] | 103 | model, they need to be mitigated by physical countermeasures. |
Janos Follath | ecaa293 | 2023-03-08 16:38:07 +0000 | [diff] [blame] | 104 | |
| 105 | ### Caveats |
| 106 | |
Janos Follath | c51a413 | 2023-03-14 12:47:27 +0000 | [diff] [blame] | 107 | #### Out-of-scope countermeasures |
Janos Follath | ecaa293 | 2023-03-08 16:38:07 +0000 | [diff] [blame] | 108 | |
| 109 | Mbed TLS has evolved organically and a well defined threat model hasn't always |
| 110 | been present. Therefore, Mbed TLS might have countermeasures against attacks |
| 111 | outside the above defined threat model. |
| 112 | |
| 113 | The presence of such countermeasures don't mean that Mbed TLS provides |
| 114 | protection against a class of attacks outside of the above described threat |
| 115 | model. Neither does it mean that the failure of such a countermeasure is |
| 116 | considered a vulnerability. |
Janos Follath | 3d37760 | 2023-03-08 16:53:50 +0000 | [diff] [blame] | 117 | |
| 118 | #### Block ciphers |
| 119 | |
| 120 | Currently there are four block ciphers in Mbed TLS: AES, CAMELLIA, ARIA and |
| 121 | DES. The pure software implementation in Mbed TLS implementation uses lookup |
| 122 | tables, which are vulnerable to timing attacks. |
| 123 | |
| 124 | These timing attacks can be physical, local or depending on network latency |
| 125 | even a remote. The attacks can result in key recovery. |
| 126 | |
| 127 | **Workarounds:** |
| 128 | |
| 129 | - Turn on hardware acceleration for AES. This is supported only on selected |
| 130 | architectures and currently only available for AES. See configuration options |
| 131 | `MBEDTLS_AESCE_C`, `MBEDTLS_AESNI_C` and `MBEDTLS_PADLOCK_C` for details. |
| 132 | - Add a secure alternative implementation (typically hardware acceleration) for |
| 133 | the vulnerable cipher. See the [Alternative Implementations |
| 134 | Guide](docs/architecture/alternative-implementations.md) for more information. |
| 135 | - Use cryptographic mechanisms that are not based on block ciphers. In |
| 136 | particular, for authenticated encryption, use ChaCha20/Poly1305 instead of |
| 137 | block cipher modes. For random generation, use HMAC\_DRBG instead of CTR\_DRBG. |