Automated Deobfuscation of Android Native Binary Code

Zeliang Kan, Haoyu Wang, Lei Wu, Yao Guo, Daniel Xiapu LuoarXiv 2019 · arXiv

TL;DR

This paper introduces DiANa, the first automated system to deobfuscate native binary code in Android applications, specifically targeting obfuscation from Obfuscator-LLVM. By combining taint analysis and flow-sensitive symbolic execution, DiANa effectively recovers the original control flow graphs and semantics of obfuscated native code, a critical step for security analysis and malware research.

What Problem Does This Paper Address?

Android applications often leverage native code (written in C/C++) for performance-critical tasks or to hide sensitive logic. This native code can be further protected using obfuscation techniques, making it extremely difficult for security researchers to analyze and understand its functionality. Obfuscation, particularly with tools like Obfuscator-LLVM (O-LLVM), transforms code to obscure its original structure and intent, posing a significant challenge for static analysis, malware detection, and reverse engineering efforts. While deobfuscation techniques exist for PC platforms, a dedicated solution for Android's native code, especially on the ARM architecture, has been lacking.

Methods

DiANa employs a multi-pronged approach to tackle native code deobfuscation:

  • Taint Analysis: This technique is used to track the flow of data through the program. It's crucial for identifying and retaining obfuscated instructions that are interleaved with normal code, especially in the context of ARM's specific optimizations. Taint analysis helps in semantic-level deobfuscation, ensuring that the functional equivalence of the code is maintained.
  • Flow-Sensitive Symbolic Execution: This is the core method for reconstructing the control flow, particularly for Control Flow Flattening (CFF) obfuscation. By treating basic blocks as units of analysis and dynamically managing their execution order, DiANa can systematically explore program paths without suffering from path explosion. This approach is "flow-sensitive" because it considers the dependencies between basic blocks and the state of the program.
  • Basic Block Classification and Optimization: DiANa first identifies different types of basic blocks (e.g., Dispatchers, Prologues, Relevant blocks) that contain original operations. It then applies control flow reconstruction rules to merge or optimize these blocks, aiming to restore the original structure.
  • Instruction Substitution (InsSub) Deobfuscation: DiANa uses taint analysis to identify and replace obfuscated instruction sequences with their simpler, equivalent forms.
  • Bogus Control Flow (BCF) Deobfuscation: Taint analysis is used here to identify opaque predicates and remove the dead branches introduced by BCF.
  • Control Flow Flattening (CFF) Deobfuscation: Flow-sensitive symbolic execution is employed to rebuild the control flow graph that has been significantly altered by CFF.

Datasets

The paper evaluates DiANa on several datasets:

  • C/C++ Obfuscation Benchmark: A collection of 94 benchmark programs designed to test obfuscation algorithms.
  • Open-Source Android Native Code: 24 open-source Android projects from F-Droid that utilize native code.
  • Real-world Android Root Exploit: Specifically, the PoC implementation of the towelroot exploit (CVE-2014-3153), a known generic vulnerability in the Linux kernel.

Key Insights and Ideas

  • The first automated solution for Android native code deobfuscation: This is a significant contribution, as previous work primarily focused on Java-level obfuscation or PC platforms.
  • Taint analysis is crucial for ARM-specific optimizations: The paper highlights how ARM's instruction-level optimizations can interleave obfuscated and normal code, making taint analysis essential for accurate deobfuscation.
  • Flow-sensitive symbolic execution is key for control flow recovery: Rebuilding the control flow, especially after CFF, requires a deep understanding of program flow and state, which DiANa achieves through its symbolic execution approach.
  • Function splitting can be a challenge: The paper notes that obfuscation techniques, particularly CFF, can lead to function splitting, which can complicate deobfuscation and semantic equivalence checks.

Key Results

  • High Accuracy: DiANa achieves high CFG similarity scores after deobfuscation, often exceeding 0.80 for BCF and CFF, and even reaching 0.734 on average for combined obfuscation techniques.
  • Semantic Equivalence: The system demonstrates semantic equivalence for most deobfuscated functions, verified through extensive input/output testing. For example, 100% semantic equivalence was achieved for InsSub deobfuscation on several benchmarks.
  • Effectiveness on Real-world Exploits: DiANa successfully deobfuscated functions from the towelroot exploit, making the code significantly easier to understand.
  • Comparison to Prior Work: DiANa outperforms previous approaches (like Approach △) in terms of CFG similarity, especially when dealing with more complex obfuscation scenarios.

Limitations and Future Work

  • Inherent Limitations of Tools: The system's accuracy can be affected by the limitations of underlying tools like IDA Pro (for function identification) and Angr (for instruction recognition).
  • Semantic Equivalence Challenges: While generally successful, there are a few cases where semantic equivalence evaluation is challenging, particularly due to function splitting and the handling of cross-function calls (BL/BLX instructions) during symbolic execution. The authors suggest that increasing the number of saved states during symbolic execution could improve results.
  • Future Work: The authors believe DiANa can be extended to handle other obfuscation techniques and serve as a valuable tool for security analysts and researchers in malware detection and program analysis. They also plan to release their system and benchmarks to the research community.

Summary updated

BibTeX
@misc{kan2019automated,
  author = {Zeliang Kan and Haoyu Wang and Lei Wu and Yao Guo and Daniel Xiapu Luo},
  title = {{Automated Deobfuscation of Android Native Binary Code}},
  year = {2019},
  eprint = {1907.06828},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1907.06828},
}

Loading related content...

Figure