title: Raising The Bar: Advancing Mitigations Against Memory-Corruption and Side-Channel Attacks
Creators: name: Frassetto, Tommaso
Publisher: name: UNSPECIFIED
Year: 2022

description: The complexity of computer programs has been increasing for multiple decades. As a result, the number and impact of security vulnerabilities have been rising as well. Memory-corruption attacks have been one of the most severe security threats for decades, despite the tremendous efforts of the security community: according to data published by Microsoft in 2019, 70% of vulnerabilities addressed in security updates during the previous decade are memory safety issues. Similarly, according to the 2021 CWE Top 25, two out of the three most dangerous vulnerability categories are related to memory corruption. A variety of approaches have been proposed that aim to either discover vulnerabilities before they are deployed to a production environment, or to mitigate vulnerabilities by making them harder to exploit. The former case includes strategies like static analysis, test suites, and fuzzing. While these methods are important and beneficial, it is not feasible to find all software bugs: most deployed software projects suffer from memory-corruption vulnerabilities, in particular if they contain legacy code. Hence, it is crucial to investigate, develop, and deploy mitigations, in order to make exploitation of these vulnerabilities substantially harder or even infeasible. Three prominent approaches are software diversity (e.g., randomization), integrity checks (e.g., CFI), and memory isolation (e.g., TEEs). The scope of this cumulative dissertation includes contributions to these three mitigation approaches, as well as applications to more practical problems. The idea of software diversity is to change the protected program so that one or more of its properties, e.g., the address of code or data, is unknown to the attacker. Since memory-corruption exploits depend on the address of code and data, the adversary needs to correctly guess or otherwise acquire the address of all the memory structures required for the exploit, which substantially increases the attack's difficulty. We present Selfrando, a scheme which randomizes the executable code of a program with a fine granularity. In contrast to previous works, our scheme performs the randomization every time the application is launched. This way, the same application package can be distributed through traditional channels to all users, but each run has a different memory layout. Selfrando was successfully integrated in the privacy-preserving Tor Browser and deployed in the hardened version of Tor Browser for Linux. The principle of Control-Flow Integrity (CFI) is to instrument indirect control flow transfers to inspect the computed target before the control transfer is performed. As an example of a coarse-grained CFI scheme, indirect call instructions can be instrumented to only allow calls to the start addresses of known functions. A variety of CFI approaches with different granularity have been proposed. Given this variety, it is important to be able to quantify the security guarantees of each scheme. We present CFInsight, a benchmark for CFI security. Unlike previous works, our analysis is based on properties of the paths between indirect call sites and system call instructions, which attackers need to reach in order to interact with the operating system or the file system. Our metric is based on quantitative measurements of these paths and indicates how hard it is to construct an attack. Memory isolation involves introducing barriers between various software components, so that a vulnerability in one of them cannot be used to exploit a different one. Memory isolation can be implemented purely in software or with the help of hardware extensions, e.g., Trusted Execution Environments (TEEs). Memory isolation is particularly beneficial for software that is composed by a significant number of diverse components, especially if some of them handle untrusted data. This is the case of web browsers, where an attacker can target the Just-In-Time (JIT) compiler and force it to generate malicious code. We present JITGuard, which leverages memory isolation and a TEE in order to protect the internal data of a browser's JIT compiler from attackers. Unlike alternative approaches, our construction maintains the existing synchronous calling semantics and does not require complex redesigns in the original code. Memory isolation, and TEEs in particular, can be used for a number of purposes, including to ensure the confidentiality of a component. However, there is a category of attacks that is particularly effective in breaking the confidentiality property of memory isolation. These attacks leverage side channels in order to extract information from a component without directly interacting with it. Below, we introduce our proposals of a software-only and a hardware-based countermeasure against these attacks. A traditional approach to limit side-channel leakage is to manually design alternative algorithms, which requires significant expertise and is highly error-prone. Instead, we present DR.SGX, a software-only solution that automatically protects all data used in a TEE by applying a fine-grained location randomization. The data location is periodically re-randomized to further limit the leakage during extended execution. Another common approach to limit cache-based side-channel leakage is to partition the caches, which leads to high performance overheads. Our proposal HybCache is a new cache architecture that limits side-channel leakage by design. Security-sensitive code accesses a subset of the cache fully-associatively, using a random replacement policy, which prevents any address-specific information leakage. At the same time, security-insensitive code accesses the cache in the traditional set-associative way, which, unlike cache partitioning, results in no performance degradation. Lastly, we describe two practical use cases that show how TEEs can be used to improve protocols. First, we show VoiceGuard, a TEE-based design for a voice recognition system that protects from disclosure both the user's voice data and the vendor's machine learning model. Second, we present FastKitten, a TEE-based protocol that allows for fast and efficient smart contract execution on cryptocurrencies that do not support smart contracts.