Chapters

6 Capability-Based Access Control

security
access-control
iot

6.1 Overview: Authority You Hold, Not a Role You Have

This section: Overview: Authority You Hold, Not a Role You Have — Picture a service worker who needs to open one plant-room door and reset one air unit before noon.

Give One Holder Only the Right It Needs

Picture a service worker who needs to open one plant-room door and reset one air unit before noon. A broad staff role would also expose other rooms and controls. The site owner instead wants a held key that names the two allowed actions and nothing more.

Write the authority in one sentence. Name the holder, object, action, start, end, and limit on passing the right to someone else. Make the held proof impossible for an untrusted holder to forge or alter; if it is a bearer token, protect it from copying. Record who issued it and how a checker can reject an old or altered copy.

Test a forged copy, a stolen copy, a late use, a second handoff, a removed object, and a worker who leaves early. Check both allowed and denied actions. A narrow key can reduce harm, but possession still matters and taking back a copy may be hard.

Keep dangerous local controls behind a gate that can deny the act even when the holder reaches the machine. Loss of a distant check should not turn into broad access by default.

This opening does not claim that held rights beat roles in every system. Practitioner maps issue, use, handoff, and removal. Under the Hood examines how rights are made unforgeable, narrowed, stored, passed on, and revoked.

Sometimes the easiest permission to reason about is not a name on a list. It is a key in the holder’s hand: this token opens this door, for this action, until this limit. Capability-based access control starts from that simple picture and then asks the hard IoT questions: can the key be forged, copied, delegated, narrowed, or taken back?

In role-based access control, the system asks which roles the requester has and which permissions those roles carry. Capability-based access control uses a different representation of authority. A capability is an unforgeable token that both names a specific object and carries the operations allowed on it. Holding the capability is the permission. The system does not look you up in a list; it checks the token you present.

Shield Shelly

“A capability is a claim until someone shows the token resists forgery and explains how its authority ends.”

Here she reads capabilities the way she reads sessions: what the holder can do, how far it can travel, and how it gets revoked.

The clearest analogy is a physical key. A key to room 12 does not care who you are — whoever holds it can open room 12, and they can hand it to someone else. A capability is a key for a particular action on a particular thing. This is fundamentally different from a guest list, which is checked against your identity at the door. A capability is the ticket you carry; an access-control list is the list the doorkeeper holds.

A capability is a held, unforgeable token that grants a specific right on a specific object. Because authority travels with the token, capabilities must be impossible to forge, they can be delegated by handing them on, and — the catch — a token already in someone’s hands is typically harder to take back than an entry in a list. Start simple: decide exactly what object and action the holder needs, then make the token narrow enough that losing it does not unlock the whole fleet.

Why does this matter for IoT? Capabilities can express fine-grained, per-object rights: read a named sensor but write only its temperature setpoint, or open the trunk but never start the engine. A suitable system can let one device delegate a narrow slice of its authority to a neighbor without contacting a central issuer for each handoff. Rights within a capability can be encoded as compact permission flags, though the protected object reference and token also consume memory.

6.1.1 The Key-in-Hand View

  • Unforgeable token: Possession grants the right, so an untrusted holder must not be able to forge it — protect it through the runtime or a cryptographic signature or MAC.
  • Object plus rights: A capability designates a specific object and the operations allowed on it, not a broad identity label.
  • Delegable, but sticky: A holder can pass a capability (or a narrower subset) onward. The trade-off is that revoking it is typically harder than deleting a list entry (a kernel can track derived copies; a copied bearer token needs expiry or a denylist).

6.1.2 Everyday IoT Examples

Work from the simplest case toward the broader design consequence. First, a valet key for a car is a capability subset: it can typically drive and park but not open the trunk or the glovebox. Next, a shareable, time-limited code that opens only the front door — and nothing else — can act as a bearer capability if it is unforgeable and checked for that door. Finally, “This token lets the holder read sensor 42 until noon” describes a capability if the token is unforgeable and names that sensor; “this user has an admin role” still needs the role’s permissions checked.

6.1.3 Overview Knowledge Check

If you can explain why authority travels with a held token, you have the core idea. Continue to Practitioner to represent capabilities, compose them, and choose when the key-in-hand pattern is better than another role.

6.2 Practitioner: Represent, Compose, and Choose

This section: Practitioner: Represent, Compose, and Choose — In practice, fine-grained rights within a capability are often represented as permission flags — independent bits for operations such as read, write, execute, or audit on the named object.

In practice, fine-grained rights within a capability are often represented as permission flags — independent bits for operations such as read, write, execute, or audit on the named object. A composite rights set combines several flags, and an access check confirms that all required bits are present, not merely some. The rights bits can fit in a couple of bytes, but the capability also needs a protected reference or authenticated token that binds them to an object.

6.2.1 Base, Ceiling, and Elevation

A robust design distinguishes a user’s or device’s base capabilities, granted by default, from its maximum capabilities, an absolute ceiling it can never exceed even when temporarily elevated. A canElevate flag controls whether elevation is allowed at all. When a sensitive action is needed — an emergency shutdown, a firmware write — the holder elevates specific capabilities for a short, time-boxed window, gated by extra authorization such as a supervisor’s approval. This is cleaner than swapping roles or minting a temporary admin account, because (if the grants are logged) the audit trail shows exactly which extra rights were used, when, and under whose approval.

Shelly’s Access Ledger

  • Who: the holder elevating specific capabilities for a short, time-boxed window.
  • What: elevation can never exceed the maximum ceiling, even temporarily.
  • Proof: the audit trail names exactly which extra rights were used and who approved them.

6.2.2 Choosing Among RBAC, Capabilities, and ABAC

ModelBest WhenStrengthWatch Out For
RBACStable job categories with a small number of roles.Simple to set up, reason about, and audit.Role explosion when cases need many narrow roles.
Capability-basedPer-object custom rights or delegation.Precise least authority; decentralized sharing.Revocation of tokens already handed out; tokens must be unforgeable.
ABACDecisions depend on context (time, location, state).Expressive, policy-as-code, scales by attribute.More complex to author and evaluate.

6.2.3 Worked Example: Shift Reassignment Without Role Explosion

Picture an industrial control room where operators rotate across shifts and certification levels. With pure RBAC, every combination tends to spawn its own role — a day-shift level-three role, a night-shift level-three role, and so on — until the role list is unmanageable. A capability design could instead issue an operator narrowly scoped, time-limited authority for a named control, leaving the resource definitions untouched. Emergency shutdown sits at the operator’s ceiling and requires a second person’s approval. The example avoids a combinatorial role table; RBAC with temporal extensions, or ABAC, could also handle changing shifts.

6.2.4 Capabilities in the Physical World

Digital vehicle keys illustrate narrower rights. A shared or valet key is an attenuated capability: for example, it can drive but cannot open the trunk or exceed a set speed. Early keyless-entry systems relied on weak proprietary ciphers that security researchers were able to clone. A digital key must resist forgery, but a bearer credential can still be copied or stolen, so its storage, transfer, and revocation also matter.

6.2.5 Practitioner Knowledge Check

If you can represent rights as flags, gate elevation by a ceiling, and choose the model by need, you can stop here. Continue to Under the Hood for unforgeability, delegation, and the revocation trade-off.

6.3 Under the Hood: Unforgeability, Delegation, and Revocation

This section: Under the Hood: Unforgeability, Delegation, and Revocation — The deeper layer explains what makes a capability actually work and where the model breaks.

The deeper layer explains what makes a capability actually work and where the model breaks. Two properties carry the whole design: the token must be impossible to forge, and the system must have an answer for taking authority back.

6.3.1 The Bit Mechanics

When the rights within a capability are represented as flags, each permission is an independent bit position, not a step in a ladder — setting the fourth bit does not imply the first three. Composite rights sets are built by OR-ing flags together. An access check is conjunctive: the granted set must contain every required bit, which is the bitwise test (granted & required) == required. A rights set can fit in a small integer on a microcontroller; the complete capability still needs a protected object reference or authenticated token.

Shelly’s Access Ledger

  • Who: whoever holds the protected capability presents it for a check; a bitmask alone is not proof of authority.
  • What: flags are independent bits, not a ladder -- the fourth bit implies nothing about the first three.
  • Proof: the check is conjunctive -- every required bit must be present, not just one.

6.3.2 Unforgeability Is the Whole Game

Because possession grants authority, a capability is only safe if an untrusted holder cannot forge or alter it. Two established approaches are a protected reference, mediated by a runtime or kernel, and a cryptographically authenticated token. Unix file descriptors and seL4 kernel capabilities illustrate protected references; a process can pass a descriptor to another process as a delegation. Macaroons use chained MACs, and a signed or MAC-protected, time-limited URL can also carry authority if it names the resource and permitted operation. The verifier must check the protection, scope, and any expiry. A plain client-editable string of flags is not an unforgeable capability.

6.3.3 Where the Rights Live, and the Revocation Trade-Off

A central design question is whether the rights travel with the client or stay on the server. If you place permission flags in a client-held bearer token, its claims must be cryptographically authenticated — otherwise the client edits its own permissions. Without a live revocation check, a valid token can be used until it expires; RFC 6750 §5.3 recommends short-lived bearer tokens, while RFC 7662 describes token introspection for checking current state. If instead you hand the client an opaque session identifier and keep its rights server-side, revocation can take effect on the next checked request, but you have moved back toward an ACL-style lookup. Kernel-managed capabilities have their own revocation mechanisms, such as seL4’s revocation of derived capabilities. Choose short lifetimes plus a denylist or introspection when authority lives client-side; choose server-side rights when you need revocation on the next request.

6.3.4 Delegation, the Confused Deputy, and Ambient Authority

Delegation is a defining strength: a holder can pass a capability, or an attenuated subset of it, to another principal without a central issuer approving each handoff. Capabilities also resist the confused-deputy problem, in which a privileged program is tricked into misusing its broad authority on an object an attacker names. Because a capability bundles the object designation with the authority, the caller must supply the capability for the specific object, provided the deputy uses only the caller-supplied capability for that operation, so a deputy cannot be steered onto something it was not given. The danger to manage is the opposite: ambient authority, where capabilities are inherited automatically and broadly. Linux CAP_SYS_ADMIN is a broad process privilege, not an object capability like a seL4 reference, and is close to full root. Grant the narrowest capability explicitly rather than relying on inherited power.

6.3.5 Audit as Categorized Events

A capability system should record categorized audit events — access attempted versus granted, elevation requested, and denials — rather than flat log lines. Categorized events let monitoring raise alerts automatically (a burst of denied elevations is a probing signal) and make compliance forensics tractable.

6.3.6 Mechanisms and Failure Modes

MechanismWhat It GuaranteesEvidence to RequestFailure Mode If Weak
Unforgeable tokenHolders cannot fabricate authority.Kernel-protected references or cryptographically authenticated tokens.Plain flag strings let a client forge permissions.
Conjunctive checkAll required rights must be present.A bitwise all-bits-match test, tested with negatives.An any-bit match grants access on a partial right.
Attenuated delegationShared authority is never wider than the original.Delegation that can only narrow, never widen, rights.Unbounded delegation escalates privilege.
Revocation stateAuthority can be withdrawn before expiry if checks reach the verifier.A denylist or introspection for bearer tokens; server-side rights or kernel revocation where applicable.An unrevoked bearer token can remain valid until expiry.
Least ambient authorityPrograms hold only the authority they were given.Narrow explicit grants, no broad inherited capabilities.Over-broad inherited rights enable confused-deputy abuse.

6.3.7 Common Pitfalls

  • Unsigned capability flags in client tokens. If the token is not cryptographically protected, the client simply forges its own rights.
  • Assuming bearer tokens revoke instantly. A locally validated bearer token can remain usable until expiry unless the verifier checks revocation state.
  • Over-broad ambient authority. A broad process privilege such as Linux CAP_SYS_ADMIN can defeat least authority when inherited or granted unnecessarily.
  • Treating flags as a hierarchy. Bits are independent; one capability does not imply the ones below it.
  • No revocation path at all. Without revocation, a capability system can be weaker than a simple list; define expiry, revocation, or both and test the delay.

6.3.8 Under-the-Hood Knowledge Check

At this depth, a capability is a precise, held authority that is only as good as its unforgeability and its revocation story. Rights within a capability may use independent flags; protect the complete token by the runtime or by cryptography, delegate by narrowing where supported, and choose how the system will revoke authority. A trustworthy review checks that forged tokens are rejected, that delegation cannot widen rights, and that revocation actually works.

6.4 Summary

This section: Summary — Review a capability by the rights it grants, how the holder can delegate them, and how authority is revoked.

Review a capability by the rights it grants, how the holder can delegate them, and how authority is revoked. First, a capability is an unforgeable, held token that designates a specific object and the operations allowed on it; possession is the permission, in contrast to an access-control list checked against identity. Next, fine-grained rights within a capability are commonly represented as independent permission flags, composed with bitwise OR and checked conjunctively so that all required bits must be present. Then, separate base capabilities from a maximum ceiling, and grant sensitive rights only through short, time-boxed elevation with extra authorization, which keeps a clean audit trail. Then, choose capabilities for per-object custom rights and decentralized sharing; choose RBAC for stable categories and ABAC for context-dependent decisions. Then, unforgeability is essential: protect capabilities either as runtime or kernel-mediated references (like file descriptors) or as cryptographically authenticated tokens (like macaroons); plain flag strings are forgeable. Then, the revocation trade-off is central: client-held signed capabilities stay valid until expiry unless you add a denylist or introspection, while server-side rights take effect on the next request but resemble an ACL lookup. Then, capabilities support attenuated delegation and resist the confused-deputy problem, but over-broad ambient (inherited) authority undermines least authority. Finally, the durable lesson is that a capability must be cryptographically strong and fine-grained, since a forgeable capability is worthless.

6.5 Key Takeaway

This section: Key Takeaway — Capability-based access control puts precise, least authority in the holder’s hands as an unforgeable token.

Capability-based access control puts precise, least authority in the holder’s hands as an unforgeable token. Make the token impossible to forge, let delegation only narrow rights, and decide up front where authority lives: client-side for decentralized sharing with short lifetimes and a denylist, or server-side when you need revocation on the next request. A capability you cannot protect or revoke is not access control.

6.6 See Also

This section: See Also

Access Control for IoT

Compare capabilities with the RBAC, ABAC, and OAuth models and the least-privilege principle.

Advanced Access Control

See capability flags put to work in sessions, token lifecycle, and privilege elevation.

Auth & Authorization Basics

Ground the model in identity, authentication, authorization, and accounting.

Find help

3 reviewed answers.

Where should I start in a module?

Open the module page from the sidebar to see its chapters in order. Use the module map to return to a topic you need.

Modules and paths

Reviewed

What can I try when a project does not work?

Check the symptom, then work through the diagnostic steps. Keep the error message and the smallest example that reproduces it.

When you are stuck

Reviewed

How do interactive examples work?

Use the interactive guide to check how examples and simulations work before changing your project.

Interactive examples guide

Reviewed