Monthly research note. Theme: Cryptographic Infrastructure.
TL;DR
A focused memo on Secure Firmware Updates: Signed Manifests and Rollback Protection: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.
Treat “timeouts” as a third outcome: not success, not failure—ambiguity you must model.
Key takeaways
- Rotation and rollback are core features—design them before you ship.
- Side-channel constraints turn performance details into security boundaries.
- Audit logs are evidence: make them tamper-evident and queryable during incidents.
- Make failure modes explicit and observable.
- Design rollbacks as part of the happy path.
Why this matters
- Side channels turn performance details into security boundaries.
- Policy drift silently turns strong crypto into weak practice.
- Most organizations don’t know where their keys live—until an incident.
- Operational reality (rotation, audit, rollback) is where crypto systems fail.
Key questions
- What is your disaster recovery story for KMS/HSM outages?
- What is the root of trust (HSM, TPM, offline CA, threshold ceremony)?
- How do keys rotate safely (overlap windows, dual-sign, staged rollout)?
- Which operations must be constant-time and how do you validate that?
- How do you prove usage (who signed what, when, and why) without leaking secrets?
- What is the rollback plan when a new algorithm breaks production?
Assumptions
- Attackers can observe timing and resource usage in shared environments.
- Some environments are hostile (CI, ephemeral runners, shared build agents).
- Secrets leak through logs, metrics, crash dumps, and backups unless prevented.
- Certificate chains and policies evolve; clients won’t all update together.
Non-goals
- Designing audit trails that expose sensitive plaintext or identifiers.
- Passing raw private keys across process boundaries.
Parsing is an attacker-controlled interface—validate early and fail fast.
Model & invariants
Audit integrity is a cryptographic property:
Treat key identifiers as capabilities with purpose constraints—enforce in code and policy.
Bind every derived key to context: protocol, role, version, and transcript.
Invariants must be checkable from evidence you actually have (state + logs + counters).
Security properties
- Least authority: privileges are scoped by purpose and time.
- Replay resistance: duplicated inputs do not change outcomes.
- Authenticity: actions are bound to identity and purpose.
- Downgrade resistance: negotiation can’t silently weaken security posture.
Failure modes
- Config drift that weakens security posture over time.
- Mixed-version behavior that violates assumptions silently.
- Timeout ambiguity causing double-apply or partial state transitions.
- Recovery paths that only work when nothing is broken.
Caches tend to become sources of truth unless you can recompute and validate them.
Design sketch
flowchart TD
gen["KeyGen (HSM/KMS)"] --> use["Use (TLS/VPN/Signing)"]
use --> rot["Rotate (policy + automation)"]
rot --> revoke["Revoke (incident)"]
revoke --> audit["Audit/Forensics"]
audit --> genImplementation notes
Crypto infra is a product: UX, policy, audit, and rollback must compose.
Acknowledge only after durability (or make “ack” explicitly best-effort).
#[derive(Clone, Copy, Debug)]
pub enum Purpose { Tls, Jwt, Firmware, Ledger }
pub struct KeyHandle { id: String, purpose: Purpose }
// Enforce purpose and algorithm policy at the boundary, not in the caller.Verification strategy
- Chaos for KMS: inject throttling, partial outages, and latency spikes.
- Forensics tests: can you reconstruct “who signed what” under load?
- Config drift detection: policy-as-code with diffs treated as security events.
- Constant-time validation: microbenchmarks + side-channel tooling where feasible.
- Misuse resistance tests: wrong purpose, wrong context, wrong key type must fail.
Operational notes
- Separate duties and restrict production key access paths.
- Alert on policy drift: cipher suites, key sizes, algorithm toggles, TTL changes.
- Test backup/restore for crypto material with the same rigor as databases.
- Make audit streams append-only and queryable during incidents.
- Inventory keys and usage paths; treat unknown usage as an incident.
Attach explicit rollout/rollback triggers to changes that touch security or correctness.
What to monitor
- Authz failures and policy denials (unexpected spikes).
- Rollback events and the conditions that triggered them.
- Error budget burn + tail latency under load.
- Invariant violation rate (should be ~0).
- Admission-control / rate-limit rejections (by reason).
Rollback plan
- Prefer backward-compatible changes; avoid “flag day” upgrades.
- Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.
- Define an explicit rollback trigger (metrics + thresholds).
- Use canaries and staged rollout; stop early when signals degrade.
- Keep dual-write / dual-verify windows where appropriate.
Evidence
- RFC 8446: TLS 1.3 (1) — Modern handshake design, key schedule, and downgrade resistance patterns.
- Evidence: Handshake transcript binding and downgrade resistance patterns; monitor negotiation paths and failure reasons.
- Let's Encrypt Incident Reports (2) — Real-world PKI incidents and operational lessons.
- Evidence: Rotation and revocation are operational protocols; extract failure patterns into drills and automated rollbacks.
Open questions
- What would a KMS compromise look like in your telemetry?
- How do you guarantee that audit does not become a data exfiltration channel?
- Which secrets must remain confidential for 10+ years and where are they stored today?
- What is your plan for emergency revocation at global scale?
Checklist
- Telemetry captures correctness signals.
- Assumptions listed and reviewed.
- Rollback plan rehearsed and automated.
- Costs bounded (CPU/memory/bandwidth) under adversarial inputs.
- Safety properties stated as invariants.
- Failure modes enumerated with mitigations.
Further reading
- RFC 8446: TLS 1.3 — Modern handshake design, key schedule, and downgrade resistance patterns.
- Let's Encrypt Incident Reports — Real-world PKI incidents and operational lessons.
- RFC 5869: HKDF — Domain separation and key derivation done sanely.
- NIST SP 800-57 Part 1 Rev. 5 — Key management guidance: lifecycle, strength, and policy.
- Learn TLA+ — Practical entry point for specification and model checking.
- Designing Data-Intensive Applications (Kleppmann) — The systems-engineering baseline for correctness, replication, and failure.