Instantly Obsoleting the Address-code Associations: A New Principle for Defending Advanced Code Reuse Attack

Ping Chen, Jun Xu, Jun Wang, Peng LiuarXiv 2015

Abstract

Traditional Address Space Layout Randomization (ASLR) is increasingly vulnerable to Just-In-Time Return-Oriented Programming (JIT-ROP) attacks, which utilize memory disclosure to map code layouts on-the-fly. This paper presents CHAMELEON, a moving target defense system that breaks the persistence of address-code associations. By implementing Virtual Address Page Table Remapping (VAPTR), CHAMELEON periodically re-randomizes code locations at millisecond intervals. This ensures that any "gadget" discovered by an attacker becomes obsolete before an exploit can be executed. Evaluation on 113 binaries shows that CHAMELEON successfully defeats 100% of JIT-ROP exploits with a performance overhead of approximately 11-13%.

Introduction

Code Reuse Attacks, such as Return-Oriented Programming (ROP), allow attackers to execute malicious logic by chaining together existing code snippets (gadgets) without injecting new code. While ASLR was designed to mitigate these attacks by randomizing memory locations at load-time, modern attackers bypass it using a "one-two punch": first, they exploit memory leaks to map the layout; second, they dynamically compile an exploit based on that map. Because standard ASLR is static for the duration of a process, the leaked information remains valid. CHAMELEON addresses this by introducing continuous, high-frequency re-randomization.

System Architecture and Methods

CHAMELEON utilizes a principle called Virtual Address Page Table Remapping (VAPTR). The system is built around several key components that facilitate continuous re-randomization without breaking program execution:

  1. Static Binary Instrumentation: Using the Dyninst library, CHAMELEON rewrites binaries to replace inter-page control flow instructions with a custom system call, sys_jit.
  2. The L2L Table: A "Logical-to-Logical" mapping table resides in the kernel, acting as a layer of indirection between the addresses the program expects and the actual randomized locations.
  3. The sys_jit System Call: When a program attempts to jump across page boundaries, it traps to the kernel. The kernel consults the L2L table to redirect execution to the currently valid physical address.
  4. Continuous Re-randomization: A dedicated kernel thread (kth_jit) shuffles the physical-to-logical page mappings using a Fisher-Yates shuffle at intervals as short as 1ms.
The CHAMELEON system architecture, showing the workflow from instrumentation to kernel-level remapping.

To mitigate the performance costs of frequent kernel traps, CHAMELEON employs optimizations like function reordering and instruction rearranging. These techniques maximize "intra-page" jumps, which do not require the expensive sys_jit call.

The Moving Target Principle

The core innovation of CHAMELEON is that it makes time the attacker's primary obstacle. An exploit requires a window of time ($t_1$) to identify gadgets and a window ($t_2$) to construct a payload. By re-randomizing faster than the sum of these windows, CHAMELEON renders the attacker's knowledge useless.

Visualization of how periodic re-randomization cycles render previously valid gadgets obsolete.

As shown in the figure above, a valid gadget found in Page $i_1$ during cycle $i$ is no longer present at that logical address in cycle $i+1$. Instead, the address now points to irrelevant instructions, causing the exploit to fail.

Evaluation and Results

The researchers evaluated CHAMELEON using 113 binary programs, including the GNU coreutils suite, web servers like Nginx and Apache, and various dynamic libraries (e.g., OpenSSL).

  • Security: The system defeated 100% of tested JIT-ROP exploits. Furthermore, it significantly restricted the attacker's view of memory; because randomization occurs at the page level, attackers could often only see one page at a time, reducing discoverable gadgets by over 95%.
  • Performance: At a 100ms randomization interval, the average overhead was 11.1%. Even at a highly aggressive 1ms interval, the overhead only increased to 12.9%, demonstrating the effectiveness of the system's intra-page optimizations.
  • Stability: CHAMELEON maintained stability across complex, high-traffic software like Apache and Nginx despite the constant underlying memory shuffling.

Conclusion and Limitations

CHAMELEON demonstrates that the frequency of randomization is a more potent defense than the granularity of the initial shuffle. By moving the "ground truth" of memory mapping into the kernel and updating it continuously, the system effectively obsoletes the address-code associations that JIT-ROP relies upon.

However, limitations remain. The instrumentation process increases binary size by an average of 47.2%. Additionally, the system's reliance on static analysis means it may struggle with highly obfuscated or self-modifying code. Future work may focus on leveraging hardware-assisted virtualization to further reduce the overhead of context switches during system calls.

Summary updated

BibTeX
@misc{chen2015instantly,
  author = {Ping Chen and Jun Xu and Jun Wang and Peng Liu},
  title = {{Instantly Obsoleting the Address-code Associations: A New Principle for Defending Advanced Code Reuse Attack}},
  year = {2015},
  eprint = {1507.02786},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1507.02786},
}
Figure