VirtSC: Combining Virtualization Obfuscation with Self-Checksumming

Mohsen Ahmadvand, Daniel Below, Sebastian Banescu, Alexander Pretschner

TL;DR

This paper introduces VirtSC, a novel technique that combines virtualization obfuscation (VO) with self-checksumming (SC) to protect software integrity. By integrating SC into a virtualized environment, VirtSC eliminates the need for architecture-specific binary patching, making SC more composable and resilient, while also improving its resistance to tampering.

What Problem Does This Paper Address?

Software developers face a constant battle against intellectual property theft and unauthorized modification of their applications. Man-at-the-end (MATE) attacks allow malicious users to tamper with software both statically (by altering the executable) and dynamically (by manipulating memory during execution). Self-checksumming (SC) is a technique that can detect such tampering by periodically hashing code segments and comparing them to expected values. However, traditional SC implementations require pre-computation of expected hashes and often involve architecture-dependent binary patching, limiting their composability with other protection mechanisms like obfuscation. Obfuscation, while effective at making code harder to understand, can break SC if not carefully integrated. This paper addresses the challenge of creating a robust, composable, and architecture-agnostic software protection scheme by synergistically combining virtualization obfuscation and self-checksumming.

Methods

The core of VirtSC lies in its innovative integration of Virtualization Obfuscation (VO) and Self-Checksumming (SC). The process begins by transforming a program's instructions into a custom, random Instruction Set Architecture (RISA). This RISA, along with an interpreter, replaces the original program. All program data and intermediate values are managed within a Virtual Memory (VM).

The novelty of VirtSC is in how SC is applied: instead of directly checksumming the original machine code, SC guards are injected into the virtualized program's Virtual Program Array (VPA). These guards compute hashes over the VPA itself, effectively protecting the obfuscated code. This approach has several key advantages:

  • Architecture-Agnostic SC: Since SC operates on the VPA generated by the LLVM compiler framework, it doesn't require knowledge of the target architecture for hash computation or patching.
  • Improved Composability: By applying SC after VO, the obfuscation process is less likely to break the integrity checks. The SC guards are designed to protect the VPA, which is the output of the VO process.
  • No Binary Patching: The integration within LLVM eliminates the need for post-compilation binary modifications, a significant hurdle in traditional SC implementations.

The paper also discusses two modes for the VO interpreter: a "secure" mode that uses a switch statement for dispatching instructions (leading to potential path explosion for attackers but higher overhead) and an "optimized" mode that uses indirect threading for better performance.

Datasets

The authors evaluated their approach using a dataset comprising:

  • A subset of 22 programs from the MiBench suite.
  • Three open-source CLI games: tetris2, snake, and 2048. This resulted in a total of 25 programs for their experiments.

Key Insights and Ideas

  • SC on the Obfuscated Code is Key: The most significant insight is that applying SC to the virtualized code (the VPA) rather than the original machine code is what enables seamless integration and removes architectural dependencies. This is a clever way to leverage the output of one protection mechanism as the input for another.
  • VO as a Foundation for SC Resilience: Virtualization obfuscation inherently makes code harder to analyze. By layering SC on top of this, the SC guards become more resilient to attacks, as an attacker must first break the VO to even identify and target the SC mechanisms.
  • Performance vs. Security Trade-off is Quantified: The paper meticulously measures the overhead of both the secure and optimized VO modes, both with and without SC. This provides concrete data for understanding the practical implications of their security enhancements.
  • Function-Level Virtualization Simplifies Things: Using function-level virtualization simplifies the interpreter generation and avoids some of the complexities of module-level interpreters, like managing shared memory for return values.

Key Results

  • Protection Coverage: The system achieved 100% instruction virtualization coverage for the tested programs. SC protection covered a median of 89% of the virtualized instructions.
  • Performance Overhead (Secure Mode):
    • VO alone incurred an average overhead of 89.34% (10% protection) to 1018.46% (100% protection).
  • VO+SC in secure mode averaged 109.74% (10% protection) to 1055.51% (100% protection).
  • Performance Overhead (Optimized Mode):
    • VO alone averaged 48.27% (10% protection) to 458.42% (100% protection).
  • VO+SC averaged 32.64% (10% protection) to 501.04% (100% protection).
  • SC Overhead: The SC component itself contributed a relatively low overhead, especially in the optimized mode, where it sometimes even led to reduced overall overhead compared to VO alone for lower protection levels. For 100% protection in optimized mode, SC accounted for approximately 43% of the total overhead.
  • Security Analysis: The paper presents an attack tree for SC and discusses various attacks against VO, concluding that VirtSC significantly raises the bar for attackers due to the combined defenses and the need to break VO first.

Limitations and Future Work

  • Unsupported Instructions: The current implementation does not support certain Windows-specific instructions, and full Windows support is deferred to future work.
  • VM Restrictions: The use of VM leads to potential memory leaks when exceptions occur, and certain LLVM instructions requiring constant operands cannot be fully virtualized.
  • Cyclic Checks: The current SC implementation does not support cyclic checks, which could leave some SC guards unprotected. The authors suggest this could be addressed by not checking guards themselves, though this might reduce resilience.
  • Future Work: The authors plan to implement cyclic checks for SC and further investigate optimizations for VO that do not compromise security. They also aim to improve the handling of VM memory management with exceptions.

Summary updated

Abstract

Self-checksumming (SC) is a tamper-proofing technique that ensures certain program segments (code) in memory hash to known values at runtime. SC has few restrictions on application and hence can protect a vast majority of programs. The code verification in SC requires computation of the expected hashes after compilation, as the machine-code is not known before. This means the expected hash values need to be adjusted in the binary executable, hence combining SC with other protections is limited due to this adjustment step. However, obfuscation protections are often necessary, as SC protections can be otherwise easily detected and disabled via pattern matching. In this paper, we present a layered protection using virtualization obfuscation, yielding an architecture-agnostic SC protection that requires no post-compilation adjustment. We evaluate the performance of our scheme using a dataset of 25 real-world programs (MiBench and 3 CLI games). Our results show that the SC scheme induces an average overhead of 43% for a complete protection (100% coverage). The overhead is tolerable for less CPU-intensive programs (e.g. games) and when only parts of programs (e.g. license checking) are protected. However, large overheads stemming from the virtualization obfuscation were encountered.

Empirical ResultsBrowse all benchmarks →

BenchmarkMethodMetricScoreProtocol / Evidence
Performance evaluation on real-world programs (MiBench and CLI games)VO (applied single handed)average overhead1018.46%mode=secure · function-protection=100%
Source quote
L480: The average overhead of VO (applied single handed) is 89.34%, 314.95%, 445.41%, and 1018.46% for protection levels of 10, 25, 50 and 100, respectively.
Performance evaluation on real-world programs (MiBench and CLI games)VO and SC combined (VO+SC; VirtSC)average overhead1055.51%mode=secure · SC-connectivity=2 · function-protection=100%
Source quote
L481: When VO and SC are combined the average overhead rounds to 109.74%, 193.64%, 468.72%, and 1055.51% for protection levels of 10, 25, 50 and 100, respectively.
BibTeX
@inproceedings{ahmadvand2019virtsc,
  author = {Mohsen Ahmadvand and Daniel Below and Sebastian Banescu and Alexander Pretschner},
  title = {{VirtSC: Combining Virtualization Obfuscation with Self-Checksumming}},
  booktitle = {Spro@ccs},
  year = {2019},
  doi = {10.1145/3338503.3357723},
}
Figure