Mind the Heap: Preventing Capability Leakage Across CHERI Compartments
Seyedhamed Ghavamnia, Maurice D. Hanisch, Julien Vanegue
Abstract
CHERI enforces spatial memory safety and referential pointer integrity by replacing integer pointers with unforgeable capabilities that carry bounds and permissions. This rules out many conventional pointer-fabrication attacks and shifts exploitation toward the reuse of existing privileged capabilities obtained through vulnerabilities or unintended disclosure. CheriBSD's library compartmentalization reduces such disclosure by isolating per-compartment execution stacks. However, heap memory remains shared across compartments, and may lead to capability leakage through both reuse and explicit sharing. In this paper, we show that CHERI's compartmentalization guarantees can be bypassed through two distinct attack vectors, even in the absence of allocator bugs. First, cross-compartment reuse of freed heap regions can leak privileged capabilities through residual allocator state. Second, unnecessary sharing of compartment-owned heap objects can leak capabilities to less-trusted compartments through ordinary program data structures and interfaces. To mitigate unnecessary sharing of live capabilities, we introduce type-directed capability sealing, which uses static analysis of library interfaces and CHERI sealing to preserve opaque-handle semantics for library-owned objects. As a complementary defense against residual capability reuse, we adapt the established practice of per-compartment allocation pools to CheriBSD's library-compartmentalization runtime. Our design integrates with CheriBSD's existing library compartmentalization mechanisms without requiring application or library modifications. Experimental results on micro- and macrobenchmarks show that the combined system incurs minimal overhead (less than 5% on average) while preventing capability leakage through both heap reuse and unnecessary cross-compartment sharing.
Ask Lune
Know where this paper stands in minutes, not an afternoon.
Lune can read the top-tier papers that cite it and the ones closest to it, and tells you what it claims, what came after and where it falls short, each point cited to the paper it comes from. No skimming, no AI slop.
Related papers
- CHERIoT: Complete Memory Safety for Embedded DevicesSaar Amar, David Chisnall, Tony Chen, Nathaniel Wesley Filardo et al.MICRO 2023 · 22 citations
- PoisonCap: Efficient Hierarchical Temporal Safety for CHERIYuecheng Wang, Jonathan Woodruff, Alfredo Mazzinghi, Peter Rugg et al.CCS 2026 · 3 citations
- Cornucopia: Temporal Safety for CHERI HeapsNathaniel Wesley Filardo, Brett F. Gutstein, Jonathan Woodruff, Sam Ainsworth et al.S&P 2020 · 71 citations
- Efficient Linkage-Based Compartmentalization on CHERIDapeng Gao, John Baldwin, Jessica Clarke, Nicholas C. Connolly et al.CCS 2026
- Capstone: A Capability-based Foundation for Trustless Secure Memory AccessJason Zhijingcheng Yu, Conrad Watt, Aditya Badole, Trevor E. Carlson et al.USENIX Security 2023
