Poster: Methodologies for Quantifying (Re-) Randomization Security and Timing under JIT-ROP

Just-in-time return-oriented programming (JITROP) technique allows one to dynamically discover instruction pages and launch code reuse attacks, effectively bypassing most fine-grained address space layout randomization (ASLR) protection. However, in-depth questions regarding the impact of code (re-)randomization on code reuse attacks have not been studied. For example, how would one compute the re-randomization interval effectively by considering the speed of gadget convergence to defeat JIT-ROP attacks? ; how do starting pointers in JIT-ROP impact gadget availability, time of gadget convergence, and the Turingcomplete (TC) expressive power of JIT-ROP payloads? ; We conduct a comprehensive measurement study and provide methodologies to measure JIT-ROP gadget availability, quality, and their TC expressiveness, as well as to empirically determine the upper bound of re-randomization intervals in re-randomization schemes. Experiments show that the locations of leaked pointers used in JIT-ROP attacks have no impacts on gadget availability, but have an impact on the time for accumulating the TC gadget set. The time ranges from around 0.89 to 5 seconds in our tested applications. Our results also show that instruction-level single-round code randomization thwarts current gadget finding techniques under the JIT-ROP threat model. Introduction. JIT-ROP [15] is a powerful attack that enables one to reuse code even under fine-grained ASLR. JIT-ROP attacks can discover new code pages dynamically, by leveraging control-flow transfer instructions, such as call and jmp and construct exploit payloads at runtime. Re-randomization techniques [16], XoM [12]/XnR [2] style defenses, Code Pointer Integrity (CPI) [11], and Control-Flow Integrity (CFI) [1] have potential to defeat JIT-ROP attacks. However, from a defense-in-depth perspective, it is important for a critical system to deploy multiple complementary security defenses in practice due to the potential failure of a single defense. Thus, despite the strong security guarantees of CFI with the latest advancement (e.g., MLTA [13]), our ASLR investigation is still extremely necessary. It is also useful and necessary to isolate various defense factors to better understand the individual factor’s security impact. Otherwise, it might be too complicated to interpret the experimental results. This is the reason we chose to focus on ASLR defenses in this work and omit other such as CFI, CPI, and XoM/XnR style defenses. In this study, we report our experimental findings on various aspects of code (re-)randomization that impact code reuse attacks, e.g., in terms of interval choices, code pointer leakage, gadget availability, gadget convergence, speed of convergence, and gadget chain formation. We use the term gadget convergence for a set gadgets to indicate that the set of gadgets has met the criteria of the Turing-complete gadget set. In ROP literature, the Turing-complete gadget set refers to a set of gadgets that cover the Turing-complete operations including memory, assignment, arithmetic, logic, control flow, function call, and system call [14]. Our evaluation involves up to 20 applications including 6 browsers, 1 browser engine, and 25 dynamic libraries. Fig. 1. An illustration of the recursive code harvest process of JIT-ROP [15]. Measurement Methodologies. We designed a measurement mechanism that allows us to perform JIT-ROP’s recursive code page discovery (Figure 1) in a scalable fashion. We focus on the native execution of JIT-ROP that allows us to evaluate re-randomization timing and multiple fine-grained ASLR conditions such as the function-level [5], block-level [10], machine register-level [9], [6], and instruction-level [8] code randomization. Since native execution is faster than WebAsm/JavaScript [7], our timing results measured using the native execution is also conservatively applicable for the scripting environments. We manually extracted 21 types of gadgets including the Turing-complete gadget set from various attacks [15], [4], [3]. We measure the occurrences of 15 selected gadgets under fine-grained code randomization schemes. We use ropper1, an offline gadget finder tool, under coarsegrained ASLR. Under fine-grained ASLR, we write a tool to recreate the native JIT-ROP exploitation process, including code page discovery and gadget mining. We also measure the upper bound2 for re-randomization intervals by determining how much the code harvest process takes to find the Turingcomplete gadget set. To measure the quality of individual gadgets, we perform a register corruption analysis for each gadget. To determine the risk associated with a stack/heap/data segment, we count the vulnerable library pointers in a stack, heap or data segment. We aslo assess the effect of compiler optimizations on the gadget availability. Evaluation results. We implemented a JIT-ROP native code module. All experiments are performed on a Linux machine 1https://github.com/sashs/Ropper 2We define that the upper bound of a re-randomization scheme is the maximum amount of time between two consecutive randomization rounds that prevent an attacker from obtaining the Turing-complete gadget set. with Ubuntu 16.04 LTS 64-bit operating system. We write several Python and bash scripts for automating our analysis and measurement process. Fig. 2. Gadget convergence with trajectory lines. Each N and represent a re-randomization upper bound and re-randomization interval, respectively. Re-randomization upper bound. Using our methodologies, we measure the upper bounds of re-randomization intervals for 19 applications including 6 browsers and 1 browser engine. Figure 2 shows the upper bound for the browsers along with their trajectory lines of convergence. We observe that the upper bound ranges from around 0.89 to 5 seconds. We call the upper bound as the “best-case” re-randomization interval from a defender’s perspective because the defender has to rerandomize by the time of the interval, if not sooner. Fig. 3. Min, max, and average time needed to harvest the TC gadget set. Impact of the Location of Pointer Leakage. We measure the impact of pointer locations on JIT-ROP attack capabilities, by comparing the number of gadgets harvested and the time of harvest under different starting pointer locations. For all applications, we observe that the pointer’s location does not have any impact on gadget availability. However, the times needed to harvest the TC gadget set vary from one pointer to another. Figure 3 shows the minimum, maximum, and average time required for gadget convergence for different applications and browsers. For some code pointers, the code harvest process takes significantly shorter times than the average times due to the fact that some code pages with diverse set of gadgets are accessed sooner for those code pointers. Other findings. Function, basic-block, or machine registerlevel randomization preserves TC expressiveness, however, instruction-level randomization does not. Our findings suggest that current fine-grained randomization solutions do not impose significant gadget corruption. In addition, a stack has a higher risk of revealing dynamic libraries than a heap or data segment due to the higher number of libc pointers, on average more than 16 in stack than heaps or data segments. Conclusion. We presented general methodologies for quantitatively measuring ASLR security under the JIT-ROP threat model and conducted a comprehensive measurement study. One method is for experimentally determining the upper bound of re-randomization intervals. Another method is for computing the number of various gadget types and their quality. Acknowledgment. This work is supported by ONR Grant N00014-17-1-2498 and DARPA/ONR N66001-17-C-4052.