Exposing Hidden Interfaces: LLM-Guided Type Inference for Reverse Engineering macOS Private Frameworks

Arina Kharlamova, Youcheng Sun, Ting Yu

Abstract

Private macOS frameworks underpin critical services and daemons but remain undocumented and distributed only as stripped binaries, complicating security analysis. We present MOTIF, an agentic framework that integrates tool-augmented analysis with a finetuned large language model specialized for Objective-C type inference. The agent manages runtime metadata extraction, binary inspection, and constraint checking, while the model generates candidate method signatures that are validated and refined into compilable headers. On MOTIF-Bench, a benchmark built from public frameworks with groundtruth headers, MOTIF improves signature recovery from 15% to 86% compared to baseline static analysis tooling, with consistent gains in tool-use correctness and inference stability. Case studies on private frameworks show that reconstructed headers compile, link, and facilitate downstream security research and vulnerability studies. By transforming opaque binaries into analyzable interfaces, MOTIF establishes a scalable foundation for systematic auditing of macOS internals.

The Challenge of Undocumented Private Frameworks

The macOS ecosystem relies heavily on "private frameworks"—libraries that handle critical system tasks but lack public documentation and headers. For security researchers, these are "black boxes." While tools like class-dump can extract basic metadata, they often fail to recover specific types, leaving researchers with generic placeholders like id (any object) or void* (any data).

Security boundary bypass via hidden API calls in macOS private frameworks.

Without precise type information, it is nearly impossible to perform automated security audits, identify "sink" functions for vulnerabilities, or understand how data flows through the system. The challenge is that Objective-C uses dynamic dispatch, meaning much of the type information is resolved at runtime and is missing from the static binary.

MOTIF: An Agentic Approach to Type Inference

The authors introduce MOTIF (Mach-O Type Inference Framework), which treats reverse engineering as an iterative, tool-augmented reasoning process. Unlike static analysis tools that rely on heuristics, MOTIF uses an autonomous agent to actively explore the binary.

Detailed MOTIF architecture including binary preparation, agentic reasoning, and semantic feedback loops.

Core Components

  • MOTIF-AGENT: An autonomous agent that operates in a "ReAct" (Reason + Act) loop. It uses tools like disassemblers, decompilers, and header scanners to gather evidence rather than making blind guesses.
  • MOTIF-MODEL: A specialized 8B-parameter LLM (distilled from Qwen-3) fine-tuned specifically for Objective-C type inference and tool use. Its size allows it to run locally on a single Mac (e.g., M2 Ultra), ensuring data privacy.
  • Constraint-Satisfaction Loop: The agent’s output is passed through a semantic linter that checks for Objective-C coding idioms and compilation errors. If the linter finds an issue (e.g., a missing struct definition), it feeds the error back to the LLM for refinement.

Evaluation and Datasets

To validate MOTIF, the researchers created two primary datasets:

  1. MOTIF-Bench: A benchmark pairing public macOS frameworks (with ground-truth headers) with their compiled binaries. It contains stratified samples across categories like System, Media, and Web.
  2. MOTIF-Private: A manually curated set of real-world private frameworks (e.g., StorageKit, DiskManagement) used to verify that reconstructed headers compile and link in practice.

Key Results and Insights

  • Massive Accuracy Gains: On MOTIF-Bench, the framework improved signature recovery from a baseline of 15% (standard static analysis) to 86%.
  • Outperforming the Giants: The fine-tuned 8B MOTIF-MODEL outperformed general-purpose models like GPT-4o and Claude 3.5 Sonnet in domain-specific tasks, such as identifying types within collections (arrays/dictionaries).
  • The Power of Feedback: The iterative feedback from the semantic linter was the primary driver of accuracy, forcing the model to generate code that is not just plausible but syntactically and semantically correct.
  • Real-World Impact: In case studies, MOTIF successfully reconstructed headers that facilitated downstream security research, such as identifying unintended XPC messaging interfaces that could lead to sandbox escapes.

Limitations and Future Work

While MOTIF represents a significant leap forward, challenges remain. Custom C-style structs stripped of metadata are still difficult to reconstruct without deep data-flow analysis. Additionally, some type information only appears during dynamic casts at runtime. Future iterations of MOTIF may incorporate dynamic analysis (e.g., using lldb) to observe types in memory, further closing the gap in undocumented interface recovery.

Summary updated

Abstract

Private macOS frameworks underpin critical services and daemons but remain undocumented and distributed only as stripped binaries, complicating security analysis. We present MOTIF, an agentic framework that integrates tool-augmented analysis with a finetuned large language model specialized for Objective-C type inference. The agent manages runtime metadata extraction, binary inspection, and constraint checking, while the model generates candidate method signatures that are validated and refined into compilable headers. On MOTIF-Bench, a benchmark built from public frameworks with groundtruth headers, MOTIF improves signature recovery from 15% to 86% compared to baseline static analysis tooling, with consistent gains in tool-use correctness and inference stability. Case studies on private frameworks show that reconstructed headers compile, link, and facilitate downstream security research and vulnerability studies. By transforming opaque binaries into analyzable interfaces, MOTIF establishes a scalable foundation for systematic auditing of macOS internals.
BibTeX
@misc{kharlamova2026exposing,
  author = {Arina Kharlamova and Youcheng Sun and Ting Yu},
  title = {{Exposing Hidden Interfaces: LLM-Guided Type Inference for Reverse Engineering macOS Private Frameworks}},
  year = {2026},
  eprint = {2601.01673},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2601.01673},
}
Figure