Pandora: Principled Symbolic Validation of Intel SGX Enclave Runtimes
Fritz Alder, Lesly-Ann Daniel, David Oswald, Frank Piessens, Jo Van Bulck
IEEE Symposium on Security and Privacy 2024 · Day 3 · Continental Ballroom 5
Overview
Intel Software Guard Extensions (SGX) are designed to provide a "fortress inside the process," allowing sensitive code and data to execute in isolation from the rest of the system, even a compromised operating system or hypervisor. However, as highlighted by speaker Yan Bu from the diset research group at KU Leuven, SGX has been a frequent target for attacks over the past decade, with many vulnerabilities stemming from its software interface – the "weakest point" where the untrusted world interacts with the trusted enclave. This talk introduces Pandora, a novel symbolic execution tool specifically designed to validate the security of Intel SGX shielding runtimes.

Key moments
- 0:00 Introduction: Pandora and Intel SGX vulnerabilities
- 2:00 Enclave Shielding Runtimes: Bridging secure and untrusted worlds
- 4:00 Pandora's focus: Validating the entire SGX runtime ecosystem
- 4:50 Pandora's Novelties: Runtime-agnostic execution and plugin detection
- 6:00 Symbolic execution explained with a PIN code example
- 7:00 Challenge: Angr not designed for SGX binaries
- 8:00 Complex SGX binary loading and attestation process
Pandora: Principled Symbolic Validation of Intel SGX Enclave Runtimes
Speakers: Fritz Alder, Lesly-Ann Daniel, David Oswald, Frank Piessens, Jo Van Bulck
Conference: IEEE S&P
YouTube: https://www.youtube.com/watch?v=pdPBghjKBlc
Overview
Intel Software Guard Extensions (SGX) are designed to provide a "fortress inside the process," allowing sensitive code and data to execute in isolation from the rest of the system, even a compromised operating system or hypervisor. However, as highlighted by speaker Yan Bu from the diset research group at KU Leuven, SGX has been a frequent target for attacks over the past decade, with many vulnerabilities stemming from its software interface – the "weakest point" where the untrusted world interacts with the trusted enclave. This talk introduces Pandora, a novel symbolic execution tool specifically designed to validate the security of Intel SGX shielding runtimes.
Pandora addresses a critical gap in prior research, which predominantly focused on validating application logic built on top of SGX, often relying on Intel's official SDK. Instead, Pandora targets the foundational shielding runtimes themselves, which act as the crucial "bridge" transparently interposing every entry and exit of an enclave application to sanitize critical state. A vulnerability in a shielding runtime, the researchers emphasize, is akin to a zero-day rootkit, capable of compromising all applications running atop it, making their robust validation paramount for the entire SGX ecosystem.
The research behind Pandora brings two key novelties to the field: a runtime-agnostic method for extracting a "truthful" binary representation of an enclave for accurate symbolic execution, including low-level initialization code, and a flexible plugin-based architecture for easily defining and adding new vulnerability detection schemes. Through extensive evaluation across 11 diverse SGX runtimes, Pandora uncovered over 200 vulnerabilities, underscoring the necessity of principled, automated tools to secure this vital trusted execution environment technology.
Background
▶ Watch: Introduction: Pandora and Intel SGX vulnerabilities (0:00)
Intel SGX aims to protect sensitive computations by allowing developers to create enclaves – protected regions of memory and CPU state that are isolated from the host operating system, hypervisor, and even other enclaves. This isolation is enforced by the CPU hardware, ensuring confidentiality and integrity of code and data within the enclave. While this hardware-backed isolation is powerful, the interface between the untrusted host application and the trusted enclave code presents a significant attack surface.
The speaker likened the challenge of securing this interface to defending a castle, where attackers often target the weakest entry points. Indeed, a continuous stream of vulnerabilities has been identified in projects like Microsoft's Open Enclave over the past five years, demonstrating the persistent difficulty in correctly implementing secure interactions. These vulnerabilities often arise from three key levels:
- Program-visible state: Issues like improper handling of pointer arguments in shared address space, where an attacker might manipulate a pointer to direct the enclave to sensitive internal memory.
- Program-invisible state: Abuse of CPU registers, such as the stack pointer or control flags (RFLAGS), which can modify the protected program's behavior in unexpected ways if not properly sanitized upon enclave entry.
- Microarchitecture level: Defenses against side-channel attacks often rely on the programmer inserting specific cleansing or serialization instructions, which, if missed or incorrectly applied, can expose information.
To address the complexity of securely bridging the untrusted and trusted worlds, enclave shielding runtimes have emerged. These runtimes automatically interpose on every enclave entry and exit, performing crucial sanitization tasks such as validating pointer arguments, cleansing CPU registers, and managing low-level initialization and runtime libraries. This abstraction simplifies SGX development for programmers, leading to a diverse ecosystem of runtimes. This ecosystem includes Intel's official SDK, Microsoft's Open Enclave, library operating systems like Graphene and Gramine (which shield existing legacy applications), and language-specific runtimes (e.g., for Rust).
Prior research primarily focused on analyzing applications built on top of the Intel SDK, which represents only a fraction of the broader SGX ecosystem. Pandora's motivation stems from the recognition that vulnerabilities in these underlying shielding runtimes pose a far greater systemic risk. Any flaw in a runtime can be exploited to compromise all applications that rely on it, making runtime validation a critical, yet previously underexplored, area. The problem is further compounded by the "moving target" nature of SGX security, with Intel continuously refining its recommendations (e.g., MXCSR sanitization for timing attacks), necessitating automated and principled tools to keep pace with evolving threats and defenses.
Key Findings
▶ Watch: Pandora's focus: Validating the entire SGX runtime ecosystem (4:00)
Pandora's development introduced two fundamental novelties that significantly advance the state of symbolic execution for SGX runtimes:
- Truthful Binary Extraction: A runtime-agnostic methodology to extract a precise, byte-granular memory dump of an SGX enclave as it is actually loaded and attested by the hardware. This includes the low-level initialization code and all critical metadata, providing an accurate starting point for symbolic execution that prior ad-hoc solutions lacked. This "truthful" representation ensures that the symbolic execution truly reflects the attested Mr Enclave value, which is crucial for remote attestation.
- Pluggable Vulnerability Detection: An extensible framework that allows security researchers to define and integrate new types of vulnerability detectors as plugins. This modular design enables Pandora to adapt to emerging threat models and simplifies the process of searching for diverse classes of flaws.
Leveraging these innovations, the researchers launched Pandora against a broad spectrum of 11 different SGX runtimes. This selection spanned production-grade and academic projects, encompassing both closed-source and open-source implementations, thereby covering a significant portion of the active SGX ecosystem. The evaluation yielded a staggering discovery: over 200 vulnerable locations within the codebase of these runtimes.
These vulnerabilities were diverse, categorized into issues related to pointer sanitization, ABI (Application Binary Interface) sanitization, memory-mapped I/O alignment, and control flow integrity. Crucially, many of these findings were in low-level initialization and relocation logic – areas often overlooked by prior studies that focused on higher-level application logic. The ability to find such deep-seated flaws underscores Pandora's effectiveness in uncovering systemic weaknesses that could undermine the fundamental security guarantees of SGX. The researchers collaborated with the affected parties, providing detailed, interactive HTML reports to facilitate triage and remediation efforts.
Technical Deep Dive
▶ Watch: Pandora's Novelties: Runtime-agnostic execution and plugin detection (4:50)
Pandora builds upon the mature Angr symbolic execution framework, a Python-based library known for its capabilities in analyzing x86 binaries. Symbolic execution, at its core, simulates program execution not with concrete inputs, but with symbolic values. When the program encounters a conditional branch (e.g., if (x > 0)), symbolic execution explores all possible paths by branching off the program state, using a constraint solver to determine input conditions that lead to each path. This principled approach allows comprehensive exploration of program behavior, often finding vulnerabilities that would be missed by traditional fuzzing due to vast state spaces.
However, applying Angr directly to Intel SGX binaries presents significant challenges:
- Runtime-Specific Binary Loading: SGX enclaves are not standard operating system binaries. Their loading process is highly involved, requiring interaction with the SGX driver and hardware to construct a specific memory layout. This layout includes critical structures like Thread Control Structures (TCS), Safe State Areas (SSA), stacks, heaps, and code/data segments, all arranged in a precise order and location. This initial memory layout is cryptographically attested by the hardware, generating a unique Mr Enclave value that remote stakeholders use to verify the enclave's integrity. Angr, designed for conventional OS binaries, cannot natively handle this complex, attested loading process.
- Inter-World Interactions: Normal applications interact with the OS via system calls, which Angr is optimized to model. SGX enclaves, however, interact with the untrusted host application through explicit enclave entry and exit mechanisms, which Angr does not inherently understand or model.
Pandora overcomes these challenges with an innovative approach to truthful binary extraction and an enclave-aware engine:
Truthful Binary Extraction:
Instead of relying on ad-hoc methods or specific SDK versions, Pandora takes a principled approach. It executes the target enclave's loader once in a controlled environment. During this execution, Pandora leverages Ptrace (a system call for process tracing) to hook into the SGX driver's interactions. By monitoring all system calls made to the SGX driver, Pandora meticulously tracks every individual page that is added to the enclave's memory. This allows it to construct a byte-granular memory dump that perfectly replicates the final, attested memory layout of the enclave. Concurrently, it captures crucial layout metadata, including enclave boundaries, entry points, and thread-local data structures. This comprehensive dump, accurately reflecting the Mr Enclave attestation value, is then fed into a custom Angr loader tailored for SGX.
Pandora's Engine:
Positioned between Angr and the custom loader, Pandora's engine acts as a central orchestrator for SGX-specific behaviors:
- SGX Instruction Emulation: It models the behavior of specific x86 instructions for SGX that Angr might not fully understand or correctly emulate.
- Powerful Taint Tracker: A sophisticated taint tracker is integrated to monitor the flow of attacker-controlled (tainted) data throughout the enclave. This is crucial for identifying how untrusted inputs might influence sensitive operations.
- Re-entry Mechanism: The engine manages the complexities of enclave re-entry and exit, allowing symbolic execution to seamlessly transition between trusted and untrusted contexts.
- Enclave-Aware Symbolic Memory Model: This component integrates neatly into Angr, providing a memory model that understands SGX's unique memory protections and access rules, serving as a robust foundation for future SGX symbolic execution research.
Pluggable Vulnerability Detection:
With the accurate symbolic execution environment established, Pandora's engine exports "interesting events" to a set of plugins, which subscribe to these events for vulnerability detection. These events include enclave entry/exit, memory accesses to tainted pointers, and more. The core of these plugins lies in maintaining invariants – security properties that should always hold true. If an invariant is violated, a vulnerability is flagged.
Two prominent examples of plugins and their invariants are:
- Pointer Sanitization Plugin:
- Problem: Confused deputy attacks where an attacker provides a pointer to untrusted memory, but then manipulates it to point to a secret location inside the enclave. Without proper checks and copies, the enclave might dereference this pointer, effectively leaking internal secrets. The complexity is compounded by composite arguments (structs containing pointers), nested pointers, Time-of-Check to Time-of-Use (TOCTOU) vulnerabilities, pointer arithmetic, and even compiler optimizations that can eliminate crucial checks.
- Invariant: "All addresses or pointers that are even partially tainted by the attacker should lie fully outside the enclave and cannot partially lie inside The Enclave." This rule ensures that any attacker-controlled pointer cannot be used to read or write to sensitive enclave memory.
- ABI Sanitization Plugin:
- Problem: CPU registers, such as the stack pointer, RFLAGS (flags register), and configuration registers for floating-point units or vector extensions (e.g., MXCSR), can be abused if not properly cleansed upon enclave entry. An attacker could set these registers to unexpected values in the untrusted world, influencing the enclave's execution in a malicious way (e.g., causing unexpected instruction behavior, leading to timing attacks). The constant evolution of Intel's guidance (e.g., refined MXCSR sanitization) makes this a moving target.
- Invariant: "All control registers should not be tainted by attackers when they are being read." This ensures that the enclave's control flow and sensitive operations are not influenced by attacker-controlled register states.
Other plugins enforce invariants for memory-mapped I/O alignment (checking correct alignment and cleansing instructions) and control flow integrity (ensuring the target of a control flow instruction is not controlled by an adversary). When a vulnerability is detected, Pandora generates rich, interactive HTML reports detailing the issue, including taint propagation, disassembly, CPU register dumps, and a full trace of basic blocks leading to the vulnerability, significantly aiding human analysis and triage.
Demo / Proof of Concept
▶ Watch: Challenge: Angr not designed for SGX binaries (7:00)
While the presentation did not feature a live, interactive demonstration of Pandora's execution, the speaker provided a detailed overview of the tool's output and its utility in identifying and reporting vulnerabilities. The core proof of concept lies in the comprehensive, interactive HTML reports generated by Pandora's pluggable vulnerability detection scheme.
These reports serve as the tangible output of Pandora's analysis, designed to be highly informative for both researchers and developers for triage and remediation. Each report begins with a brief summary of the issues found, categorized by severity level. Upon drilling down, the reports provide exact details of each vulnerability, illustrating how taint has propagated from untrusted inputs to sensitive locations within the enclave. Crucially, these reports include clickable elements that reveal:
- Disassembly: The exact assembly code where the vulnerability was triggered.
- CPU Register Dump: A snapshot of all relevant CPU registers at the point of the vulnerability, showing their values and any taint status.
- Trace Log: A full log of the execution path, detailing the sequence of basic blocks traversed to reach the vulnerable state.
The speaker emphasized that these rich, interactive reports were found to be "extremely helpful" by both the research team and the companies they collaborated with during the disclosure process. This robust reporting mechanism effectively demonstrates Pandora's ability to not only detect vulnerabilities but also provide actionable intelligence for their understanding and resolution, serving as a powerful proof of concept for its design and implementation.
Defensive Implications
▶ Watch: Complex SGX binary loading and attestation process (8:00)
The findings from Pandora's extensive analysis of SGX runtimes carry significant implications for developers, security researchers, and anyone relying on SGX for secure computing:
- For SGX Runtime Developers: The discovery of over 200 vulnerabilities, many in low-level initialization and relocation logic, underscores the critical need for rigorous, automated security validation. Runtime developers should integrate tools like Pandora into their continuous integration/continuous deployment (CI/CD) pipelines. Adopting a principled approach to sanitization – particularly for pointer arguments and CPU registers on enclave entry/exit – is paramount. The invariants identified by Pandora's plugins (e.g., no partially tainted pointers inside the enclave, no tainted control registers) should serve as guiding principles for secure runtime design.
- For SGX Application Developers: While Pandora primarily targets runtimes, its findings highlight the foundational importance of a secure runtime environment. Application developers should prioritize using well-vetted and actively maintained SGX runtimes. They should also be acutely aware of the attack surface presented by the enclave interface, even when using an abstract SDK. Understanding potential runtime vulnerabilities can inform better application-level defensive programming, even if the primary responsibility for runtime security rests with the runtime maintainers.
- For Security Researchers: Pandora is designed not just as a validation tool but as a "validation architecture." Its open-source nature and pluggable design invite further research. Security researchers can leverage Pandora's framework, custom Angr loader, and enclave-aware engine to develop new vulnerability detection plugins, explore novel attack vectors, or analyze other trusted execution environments. The truthful binary extraction method provides a robust foundation for future symbolic execution efforts in complex, hardware-backed security contexts.
- General Best Practices: The complexities highlighted by Pandora in handling pointer arithmetic, nested pointers, composite arguments, and the dynamic nature of ABI sanitization (e.g., MXCSR updates) reinforce the message that manual security reviews are often insufficient. Automated, principled tools are indispensable for catching subtle and intricate flaws that human reviewers or even compilers might overlook or introduce. The "moving target" nature of SGX security demands continuous vigilance and adaptable security analysis tools.
Key Takeaways
- Pandora is a novel symbolic execution tool specifically designed for principled validation of Intel SGX shielding runtimes, addressing a critical gap in prior SGX security research.
- It introduces a runtime-agnostic method for "truthful" binary extraction, ensuring accurate symbolic execution of the exact, attested enclave memory layout, including low-level initialization code.
- Pandora features a flexible, pluggable vulnerability detection architecture that allows researchers to easily define and integrate new types of security invariants and detectors.
- Through extensive evaluation, Pandora uncovered over 200 vulnerabilities in 11 diverse SGX runtimes, including critical flaws in foundational initialization and relocation logic.
- The research highlights the paramount importance of securing SGX shielding runtimes, as vulnerabilities at this level can compromise all applications built upon them, akin to a zero-day rootkit.
- Pandora is open-source and intended to serve as a "validation architecture" for the broader security research community, encouraging further development and analysis of trusted execution environments.
About the Speaker(s)
The research behind Pandora was a collaborative effort involving multiple individuals from the diset research group at KU Leuven and the University of Birmingham. The presentation was delivered by Yan Bu from the diset research group at KU Leuven. The co-authors of this work include Fritz Alder, Lesly-Ann Daniel, David Oswald (from the University of Birmingham), Frank Piessens (from KU Leuven), and Jo Van Bulck (also from KU Leuven). Their collective expertise spans system security, trusted execution environments, and symbolic analysis, contributing to the development of this advanced tool for SGX runtime validation.
Reviews
Dr. Zero (Offensive Security Researcher) — MUST SEE
Pandora delivers a critical, principled symbolic execution framework for validating Intel SGX shielding runtimes, a previously underexplored attack surface. Its novel binary extraction and pluggable detection uncovered over 200 systemic vulnerabilities, providing an indispensable tool for securing foundational TEEs. This research sets a new standard for automated, deep security analysis in complex hardware-backed environments.
Heather Calloway (CISO) — STRONG ACCEPT
This research uncovers critical, systemic vulnerabilities in Intel SGX shielding runtimes, akin to zero-day rootkits, which can compromise all applications. Pandora, a novel symbolic execution tool, found over 200 flaws, demanding immediate attention to runtime vetting, automated security validation, and a re-evaluation of foundational trust models for anyone leveraging SGX for sensitive computations.
→ Top-rated talks at IEEE Symposium on Security and Privacy 2024