Building Secure Software with CHERI

Questions developers should ask about memory safety, compartmentalisation, and authority.

The security properties of a CHERI system depend on how software is built, compiled, structured, and compartmentalised. Two products may both claim to “use CHERI” while providing very different levels of protection.

To understand what protection a system actually provides, engineers should ask a few practical questions about architecture, authority, threat models, and evidence.

1. What are you trying to protect?

Before discussing CHERI features, identify the data, services, and operations that matter:

Then identify:

CHERI can only enforce security boundaries that exist in the software architecture. If every component has access to everything, there is little isolation for the hardware to enforce.

2. Which attackers and failures matter?

Security depends on what you expect the system to defend against. A browser renderer, a cloud service, and an industrial controller will have very different threat models.

A threat model describes the conditions the design is expected to withstand, e.g. whether an attacker can:

3. Which CHERI execution mode is used?

The most important question is often: what code is actually using CHERI protections?

Ask what the relevant software actually does:

These modes describe related but distinct protections. A pure-capability application is not necessarily compartmentalised, and a hybrid application may protect only selected interfaces.

4. What protections are actually enabled?

Different CHERI deployments provide different security properties. Verify which protections are enabled in your system rather than assuming they come automatically from CHERI hardware.

Check each relevant property separately:

CHERI provides architectural building blocks, but some properties require compiler, allocator, operating-system, or runtime support. Temporal safety is an important example. Record the mechanism in use rather than assuming it from the processor alone.

5. How much authority does each component receive?

A component can still become a major security risk if it holds capabilities that grant broad access to memory, files, services, or secrets.

When reviewing a system, draw the authority flow between components. Explicitly identify which capabilities cross each boundary:

Least privilege means giving each component only the authority required for its current task.

6. How do you verify the design?

Useful evidence for engineering reviews includes:

A demonstration shows that one scenario worked. It is not automatically evidence for every build, platform, or attack path.

A more useful security statement

A broad statement might be:

The product is secure because it uses CHERI.

A more reviewable statement is:

The network parser runs in its own compartment as pure-capability code. It receives a read-only capability bounded to one input buffer and a capability for one validated output queue. Tests confirm that out-of-bounds reads, writes, and unauthorised service calls fault without exposing application keys or affecting other compartments.

The second statement can be reviewed, tested, and improved. It also makes the remaining questions visible.

Key takeaways

Where next

Capabilities

A pointer bug becomes dangerous when changing a number changes authority.

Continue