1*32b31808SJens Wiklander## Reporting Vulnerabilities 27901324dSJerome Forissier 37901324dSJerome ForissierIf you think you have found an Mbed TLS security vulnerability, then please 47901324dSJerome Forissiersend an email to the security team at 57901324dSJerome Forissier<mbed-tls-security@lists.trustedfirmware.org>. 67901324dSJerome Forissier 77901324dSJerome Forissier## Security Incident Handling Process 87901324dSJerome Forissier 9039e02dfSJerome ForissierOur security process is detailed in our 107901324dSJerome Forissier[security 117901324dSJerome Forissiercenter](https://developer.trustedfirmware.org/w/mbed-tls/security-center/). 127901324dSJerome Forissier 137901324dSJerome ForissierIts primary goal is to ensure fixes are ready to be deployed when the issue 147901324dSJerome Forissiergoes public. 157901324dSJerome Forissier 167901324dSJerome Forissier## Maintained branches 177901324dSJerome Forissier 187901324dSJerome ForissierOnly the maintained branches, as listed in [`BRANCHES.md`](BRANCHES.md), 197901324dSJerome Forissierget security fixes. 207901324dSJerome ForissierUsers are urged to always use the latest version of a maintained branch. 21*32b31808SJens Wiklander 22*32b31808SJens Wiklander## Threat model 23*32b31808SJens Wiklander 24*32b31808SJens WiklanderWe classify attacks based on the capabilities of the attacker. 25*32b31808SJens Wiklander 26*32b31808SJens Wiklander### Remote attacks 27*32b31808SJens Wiklander 28*32b31808SJens WiklanderIn this section, we consider an attacker who can observe and modify data sent 29*32b31808SJens Wiklanderover the network. This includes observing the content and timing of individual 30*32b31808SJens Wiklanderpackets, as well as suppressing or delaying legitimate messages, and injecting 31*32b31808SJens Wiklandermessages. 32*32b31808SJens Wiklander 33*32b31808SJens WiklanderMbed TLS aims to fully protect against remote attacks and to enable the user 34*32b31808SJens Wiklanderapplication in providing full protection against remote attacks. Said 35*32b31808SJens Wiklanderprotection is limited to providing security guarantees offered by the protocol 36*32b31808SJens Wiklanderbeing implemented. (For example Mbed TLS alone won't guarantee that the 37*32b31808SJens Wiklandermessages will arrive without delay, as the TLS protocol doesn't guarantee that 38*32b31808SJens Wiklandereither.) 39*32b31808SJens Wiklander 40*32b31808SJens Wiklander**Warning!** Block ciphers do not yet achieve full protection against attackers 41*32b31808SJens Wiklanderwho can measure the timing of packets with sufficient precision. For details 42*32b31808SJens Wiklanderand workarounds see the [Block Ciphers](#block-ciphers) section. 43*32b31808SJens Wiklander 44*32b31808SJens Wiklander### Local attacks 45*32b31808SJens Wiklander 46*32b31808SJens WiklanderIn this section, we consider an attacker who can run software on the same 47*32b31808SJens Wiklandermachine. The attacker has insufficient privileges to directly access Mbed TLS 48*32b31808SJens Wiklanderassets such as memory and files. 49*32b31808SJens Wiklander 50*32b31808SJens Wiklander#### Timing attacks 51*32b31808SJens Wiklander 52*32b31808SJens WiklanderThe attacker is able to observe the timing of instructions executed by Mbed TLS 53*32b31808SJens Wiklanderby leveraging shared hardware that both Mbed TLS and the attacker have access 54*32b31808SJens Wiklanderto. Typical attack vectors include cache timings, memory bus contention and 55*32b31808SJens Wiklanderbranch prediction. 56*32b31808SJens Wiklander 57*32b31808SJens WiklanderMbed TLS provides limited protection against timing attacks. The cost of 58*32b31808SJens Wiklanderprotecting against timing attacks widely varies depending on the granularity of 59*32b31808SJens Wiklanderthe measurements and the noise present. Therefore the protection in Mbed TLS is 60*32b31808SJens Wiklanderlimited. We are only aiming to provide protection against **publicly 61*32b31808SJens Wiklanderdocumented attack techniques**. 62*32b31808SJens Wiklander 63*32b31808SJens WiklanderAs attacks keep improving, so does Mbed TLS's protection. Mbed TLS is moving 64*32b31808SJens Wiklandertowards a model of fully timing-invariant code, but has not reached this point 65*32b31808SJens Wiklanderyet. 66*32b31808SJens Wiklander 67*32b31808SJens Wiklander**Remark:** Timing information can be observed over the network or through 68*32b31808SJens Wiklanderphysical side channels as well. Remote and physical timing attacks are covered 69*32b31808SJens Wiklanderin the [Remote attacks](remote-attacks) and [Physical 70*32b31808SJens Wiklanderattacks](physical-attacks) sections respectively. 71*32b31808SJens Wiklander 72*32b31808SJens Wiklander**Warning!** Block ciphers do not yet achieve full protection. For 73*32b31808SJens Wiklanderdetails and workarounds see the [Block Ciphers](#block-ciphers) section. 74*32b31808SJens Wiklander 75*32b31808SJens Wiklander#### Local non-timing side channels 76*32b31808SJens Wiklander 77*32b31808SJens WiklanderThe attacker code running on the platform has access to some sensor capable of 78*32b31808SJens Wiklanderpicking up information on the physical state of the hardware while Mbed TLS is 79*32b31808SJens Wiklanderrunning. This could for example be an analogue-to-digital converter on the 80*32b31808SJens Wiklanderplatform that is located unfortunately enough to pick up the CPU noise. 81*32b31808SJens Wiklander 82*32b31808SJens WiklanderMbed TLS doesn't make any security guarantees against local non-timing-based 83*32b31808SJens Wiklanderside channel attacks. If local non-timing attacks are present in a use case or 84*32b31808SJens Wiklandera user application's threat model, they need to be mitigated by the platform. 85*32b31808SJens Wiklander 86*32b31808SJens Wiklander#### Local fault injection attacks 87*32b31808SJens Wiklander 88*32b31808SJens WiklanderSoftware running on the same hardware can affect the physical state of the 89*32b31808SJens Wiklanderdevice and introduce faults. 90*32b31808SJens Wiklander 91*32b31808SJens WiklanderMbed TLS doesn't make any security guarantees against local fault injection 92*32b31808SJens Wiklanderattacks. If local fault injection attacks are present in a use case or a user 93*32b31808SJens Wiklanderapplication's threat model, they need to be mitigated by the platform. 94*32b31808SJens Wiklander 95*32b31808SJens Wiklander### Physical attacks 96*32b31808SJens Wiklander 97*32b31808SJens WiklanderIn this section, we consider an attacker who has access to physical information 98*32b31808SJens Wiklanderabout the hardware Mbed TLS is running on and/or can alter the physical state 99*32b31808SJens Wiklanderof the hardware (e.g. power analysis, radio emissions or fault injection). 100*32b31808SJens Wiklander 101*32b31808SJens WiklanderMbed TLS doesn't make any security guarantees against physical attacks. If 102*32b31808SJens Wiklanderphysical attacks are present in a use case or a user application's threat 103*32b31808SJens Wiklandermodel, they need to be mitigated by physical countermeasures. 104*32b31808SJens Wiklander 105*32b31808SJens Wiklander### Caveats 106*32b31808SJens Wiklander 107*32b31808SJens Wiklander#### Out-of-scope countermeasures 108*32b31808SJens Wiklander 109*32b31808SJens WiklanderMbed TLS has evolved organically and a well defined threat model hasn't always 110*32b31808SJens Wiklanderbeen present. Therefore, Mbed TLS might have countermeasures against attacks 111*32b31808SJens Wiklanderoutside the above defined threat model. 112*32b31808SJens Wiklander 113*32b31808SJens WiklanderThe presence of such countermeasures don't mean that Mbed TLS provides 114*32b31808SJens Wiklanderprotection against a class of attacks outside of the above described threat 115*32b31808SJens Wiklandermodel. Neither does it mean that the failure of such a countermeasure is 116*32b31808SJens Wiklanderconsidered a vulnerability. 117*32b31808SJens Wiklander 118*32b31808SJens Wiklander#### Block ciphers 119*32b31808SJens Wiklander 120*32b31808SJens WiklanderCurrently there are four block ciphers in Mbed TLS: AES, CAMELLIA, ARIA and 121*32b31808SJens WiklanderDES. The pure software implementation in Mbed TLS implementation uses lookup 122*32b31808SJens Wiklandertables, which are vulnerable to timing attacks. 123*32b31808SJens Wiklander 124*32b31808SJens WiklanderThese timing attacks can be physical, local or depending on network latency 125*32b31808SJens Wiklandereven a remote. The attacks can result in key recovery. 126*32b31808SJens Wiklander 127*32b31808SJens Wiklander**Workarounds:** 128*32b31808SJens Wiklander 129*32b31808SJens Wiklander- Turn on hardware acceleration for AES. This is supported only on selected 130*32b31808SJens Wiklander architectures and currently only available for AES. See configuration options 131*32b31808SJens Wiklander `MBEDTLS_AESCE_C`, `MBEDTLS_AESNI_C` and `MBEDTLS_PADLOCK_C` for details. 132*32b31808SJens Wiklander- Add a secure alternative implementation (typically hardware acceleration) for 133*32b31808SJens Wiklander the vulnerable cipher. See the [Alternative Implementations 134*32b31808SJens WiklanderGuide](docs/architecture/alternative-implementations.md) for more information. 135*32b31808SJens Wiklander- Use cryptographic mechanisms that are not based on block ciphers. In 136*32b31808SJens Wiklander particular, for authenticated encryption, use ChaCha20/Poly1305 instead of 137*32b31808SJens Wiklander block cipher modes. For random generation, use HMAC\_DRBG instead of CTR\_DRBG. 138