Security by design in non-connected devices

In the ProTego project, the following scenario has been considered to demonstrate the value of the toolkit: a non-connected activity tracker collects data and sends it to a web application. The activity tracker aims to support one of the application features which is to show the statistics on the patient’s physical activity. The data is collected by the device and subsequently uploaded to the application via the doctors’s computer USB port. However, ProTego does not aim to implement secure devices, but to secure the medical data within the hospital infrastructure. With that being said, this article ponders on the importance of using non-connected devices that are built with a “secure by design” approach.

Indeed, during the project, in order to secure the data on the activity tracker, some mechanisms were considered to be implemented after the device was purchased off the shelf.

One such example is stream-based encryption, with the caveat that it would have to be carefully managed if the stream restarts (e.g., to not recycle the same encoding sequence). However, it may be possible to trick the device into repeating the same sequence (e.g., by truncating the file, resuming the recording, and comparing the two versions) and finally breaking the security.

Another example is the use of a pre-shared key (typical for low-power applications). Though, this is not an option since we cannot store the pre-shared key on the device itself because an attacker can extract the key from the program memory or from the NAND flash directly.

For these reasons the security mechanisms mentioned above are not sufficiently effective to protect medical data on the device.

Moreover, the implementation of security mechanisms can compromise the operation of the devices if carried out subsequently by third parties, for example: impacting battery life, overflowing the stack, causing data races with interrupts, etc.

Security by design (or secure by design), is a new industry term for a range of security practices built on one fundamental idea that security should be built into a product by design, instead of being added on later by third-party products and services [1].

Security by design methodology usually starts with the evaluation of risks related to the system under consideration. Considering the scenario mentioned above, the doctor would have to receive the device from the patient and connect it to his/her own personal computer to examine the data. In this scenario, the device is not a “trusted element” since an external actor (i.e., the patient) has access to the device, and he/she could infect the device with a USB malware, either willingly or by accident. For example, more specifically, the doctor’s computer could be exposed to risks such as a virus being executed automatically as soon as the device is plugged into it. Moreover, because the USB storage is not READ-ONLY, anyone could write data on it, meaning that data could be modified or replaced with non-valid data or non-supported file types. This risk, known as USB tampering, leads to a violation of data integrity. On the other hand, a violation of data confidentiality is also a possibility, since an attacker could steal the device from the patient, and then read the data on it.

To mitigate the risks related to the activity tracker, security mechanisms should be planned at design time and then be embedded into the device when it is manufactured. More specifically, to mitigate the risks related to USB malware and USB tampering, there are various authentication strategies already used throughout the computer industry that could be exploited. Authentication can be defined as “the process or action of verifying the identity of a user”, which, in the considered scenario, is intended to prevent the patient or an attacker from writing data on the device. One example is two-factor authentication (2FA) in which devices request biometrics, such as fingerprints, retina scans or facial recognition to grant access to the user. Some non-connected devices already have this security measure in place. For example, there are USB storage devices with fingerprint scanners, so that the user is authenticated by comparing the fingerprint stored on the device and the fingerprint of the person trying to connect the device to a computer. Another example is password authentication in which the user must supply a password, the device checks the entered password, and, in case it matches with the previously saved password, it grants user access to the device. This measure effectively prohibits access to the file system of the device so that the stored data cannot be tampered with, and therefore data integrity is preserved. For the sake of completeness, it should be noted that this method protects the device against casual misuse, but a skilled attacker could dump the device firmware and potentially have access to the stored password on the device.

On the other hand, data confidentiality can be guaranteed by means of data encryption, which, in turn, can be broadly divided into two categories: software-based encryption and hardware-based encryption [2]. Software-based encryption refers to methods of protecting internal data using only software and includes the data encryption/decryption method and the access control method. The data encryption/decryption method uses a mathematical tool to encode and decode the data to prevent the inference of plain text, in order to solve the problem of data being stored in plain text. Hardware-based encryption refers to the methods by which a device takes advantage of a dedicated hardware chip for the purpose of securing the device. Hardware encryption modules use dedicated hardware security modules to make it difficult to access secret information using reverse engineering, which is the fundamental problem of the software method.

From the perspective of a third party, software-based encryption is easier to implement (for example, by building the firmware of the device from scratch, adding new features such as support of public/private keys and data encryption), but it offers a weaker protection. For this reason, hardware-based encryption should be preferred, although it is only achievable by the device vendors, as they have more control over the device architecture and the internal components. Once again, this shows the importance of planning security mechanisms as early as possible (i.e., at design time) and incorporating them into the device directly when it is manufactured.

References and Internet Links

This blog post was written for the ProTego project by Pietro Vismara (OSR).