SandBlaster: Reversing the Apple Sandbox

Razvan Deaconescu, Luke Deshotels, Mihai Bucicoiu, William Enck, Lucas Davi, Ahmad-Reza SadeghiarXiv 2016 · arXiv

TL;DR

This paper introduces SandBlaster, a tool that reverses Apple's compiled, binary sandbox profiles into their human-readable SBPL format. This is crucial for security researchers as it unlocks detailed analysis of iOS and macOS security mechanisms, which were previously obscured by the proprietary binary format.

What Problem Does This Paper Address?

Apple employs a robust sandboxing mechanism to limit the damage malware or exploited applications can inflict on its operating systems, iOS and macOS. This mechanism relies on "sandbox profiles" that define precisely what actions an application is allowed to perform. However, Apple compiles these profiles into a binary format, making them difficult for security researchers to analyze and understand. While previous work could extract these profiles, they were often converted into intermediate graph representations rather than the original, human-readable SBPL (Sandbox Profile Language). This lack of a direct SBPL output hindered in-depth analysis, validation, and modification of these critical security components.

Methods

SandBlaster is a software bundle that automates the process of reversing Apple's binary sandbox profiles. Its methodology involves several key steps:

  • Extraction of Required Files: This involves obtaining firmware files (.ipsw) and using specialized tools to unpack, decrypt, and extract necessary components like sandboxd and the sandbox kernel extension.
  • Header Analysis: Understanding the structure of the binary sandbox profile file.
  • Building Custom Profiles: Creating custom SBPL profiles and compiling them to binary to establish a mapping between SBPL tokens and their binary representations. This is crucial for understanding how filters and operations are encoded.
  • Deserializing Regular Expressions: Reversing serialized non-deterministic finite automata (NFAs) back into human-readable regular expressions.
  • Reversing Operation Nodes: Mapping serialized operations, filters, and decisions from the binary format to their SBPL counterparts. This involves traversing directed acyclic graphs representing the rules.
  • Reversing Metafilters: Handling complex logical operations like require-not, require-any, and require-all by reconstructing their graph representations and translating them back to SBPL.
  • Cleaning Up Profiles: Removing implicit rules and constructs that Apple adds during compilation to ensure the reversed profile closely matches the original SBPL format.

Datasets

The paper does not explicitly mention training or evaluation datasets in the traditional machine learning sense. Instead, it relies on:

  • Apple iOS Firmware Files (.ipsw): These are used to extract the built-in binary sandbox profiles for iOS versions 7, 8, and 9.
  • Existing Sandbox Profiles: The authors leverage publicly available SBPL profiles and system files (like libsandbox.dylib) to build mappings and understand the structure of operations, filters, and metafilters.

Key Insights and Ideas

  • Binary Obfuscation: Apple's use of a compiled binary format for sandbox profiles is a significant barrier to security research, effectively obscuring critical security mechanisms.
  • SBPL as the Rosetta Stone: The original SBPL format is the key to understanding sandbox profiles, and SandBlaster's ability to reconstruct it is its primary contribution.
  • Graph Representation is Insufficient: While previous tools produced graph representations, they lacked the direct SBPL output needed for true analysis and validation.
  • Metafilters are Complex: The require-not, require-any, and require-all metafilters introduce significant complexity, requiring sophisticated graph traversal and reconstruction techniques.
  • Implicit Rules: Apple injects implicit rules during compilation that need to be identified and removed to obtain the original SBPL.

Key Results

  • SandBlaster successfully reverses all built-in binary sandbox profiles for iOS 7, 8, and 9 into their original SBPL format.
  • The reversed profiles are syntactically correct and can be recompiled with minimal modifications, demonstrating the accuracy of the reversal process.
  • The tool provides a human-readable format that is significantly easier to analyze than previous graph-based outputs.
  • The work sheds light on the inner workings of Apple's sandbox mechanisms, particularly the default container profile used by third-party apps.

Limitations and Future Work

  • Platform Differences: Minor modifications were sometimes required to the reversed profiles due to differences between iOS and macOS (the compilation platform).
  • Semantic Correctness Validation: The authors plan to validate the semantic correctness of the reversed profiles by running applications and mapping their behavior to the reconstructed SBPL profiles. This will likely require a jailbroken iOS device.
  • Broader iOS Version Support: While the current work focuses on iOS 7-9, adapting SandBlaster to older or newer iOS versions is a potential future direction.

Summary updated

BibTeX
@misc{deaconescu2016sandblaster,
  author = {Razvan Deaconescu and Luke Deshotels and Mihai Bucicoiu and William Enck and Lucas Davi and Ahmad-Reza Sadeghi},
  title = {{SandBlaster: Reversing the Apple Sandbox}},
  year = {2016},
  eprint = {1608.04303},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1608.04303},
}

Loading related content...

Figure