Distributed Systems Security and Trust Questions
Security problems that exist because a system is distributed: keeping trust state correct while it propagates across many services, clusters and regions. Covers credential, token and certificate revocation under eventual consistency and network partitions; fleet-wide rotation of signing keys, secrets and trust anchors without outages (key rollover and grace windows, canary rotation, recovery from a compromised root); distributed authorization (replicated policy decision points, cached decisions, fail-open versus fail-closed when an auth dependency degrades); propagating caller identity and permissions through service call chains; tamper-evident audit trails across services and regions (hash chains, Merkle proofs, ordering events with imperfect clocks); Byzantine and partially trusted participants; cross-cluster and cross-organization trust federation; securing shared distributed components such as caches and message brokers against injection, replay and cross-tenant access; protecting data in transit across region boundaries; and tenant isolation as a security blast-radius boundary. Steady-state mTLS, service-mesh identity and network segmentation mechanics are covered by zero-trust service-to-service security; single-system cryptography and KMS basics by applied cryptography.
A root signing key used to mint service identity certificates was discovered to be compromised. You are the SRE lead. Produce an incident response and remediation plan: immediate containment and revocation steps, how to remove the compromised trust anchor, re-issue a new CA and rotate workload certificates at scale (millions of instances), communicate with external partners, and minimize downtime while making the system secure again. Discuss cryptographic constraints, rollback strategies, and monitoring to verify success.
Sample Answer
Direct answer
A compromised root is not something you can "revoke" in the usual sense: a root CA (certificate authority) is a trust anchor, a key every workload trusts because it is in their configured trust bundle, and the only way to stop trusting it is to remove it from every bundle. So the plan is: stop the bleeding (freeze the compromised key, hunt for attacker-minted certificates, shrink what the old root can vouch for), stand up a new root in a clean ceremony, run a short dual-trust window in which workloads trust both roots while every certificate is re-issued from the new one, then remove the old root everywhere and verify that nothing still presents or accepts it. Downtime is avoided by ordering: trust the new root first, re-issue second, distrust the old root last. The hard constraint is that during the dual-trust window the attacker's certificates are still trusted, so that window must be short and watched.
Phase 0: first hour, containment and scoping
- Declare the incident, name an incident commander, open a war room, start a timeline. Legal and communications join now, not later.
- Freeze the key: disable the compromised key in the HSM (hardware security module), revoke every credential and role that could invoke it, and stop all automated issuance that chains to it. Preserve logs and host images for forensics.
- Scope the compromise: was the key exfiltrated (copied out, so the attacker can sign anything, forever) or was the signing service abused (the key never left; the attacker could only request signatures during a known window)? The second case is much smaller: every certificate the attacker got is in your issuance logs.
- Hunt attacker certificates: compare every certificate seen in the wild (mesh proxy handshake logs: the connection logs a service mesh, the network of small proxies, one per workload, that carries and secures service-to-service traffic, writes each time its proxies complete a TLS handshake, the negotiation in which client and server exchange and verify certificates before encrypted traffic starts; plus load balancer logs) against your issuance log. Any certificate that chains to the root but is not in your log is attacker-minted and tells you what they are impersonating.
- Short-term guardrails while you prepare the replacement: tighten authorisation so that high-value services (payments, identity, secrets) accept only an allowlist of SPIFFE IDs (workload identity names under the SPIFFE standard, Secure Production Identity Framework For Everyone) or certificate serials (the unique serial number stamped on each certificate you issue, so you can allowlist exactly the ones your own issuance log shows as legitimate) you issued; raise alerting on new identities appearing.
Phase 1: build the new trust anchor
- Ceremony: generate the new root offline in an HSM with M-of-N custody (for example 3 of 5 custodians must be present), witnessed and recorded. Do not reuse any host, HSM partition, pipeline or credential from the old chain until forensics clears it.
- Design it to fail smaller next time: a certificate chain has three tiers: the root (the offline trust anchor itself), intermediates (subordinate CAs the root signs once, which do the day-to-day signing so the root never has to come online), and leaf certificates (the end-entity certificates a workload actually presents on a connection, signed by an intermediate). Keep the root offline and issue per-region or per-environment intermediates, each with a path length constraint of 0 (it can sign leaf certificates but not further CAs) and, where your clients enforce them, name constraints (limit which names or URI SANs, the subject alternative names that carry SPIFFE IDs, an intermediate may certify). A future intermediate compromise then affects one region, and the root never touches the network.
- Do not cross-sign the new root with the old one. Cross-signing means having one root issue a certificate over the other root's public key, so anyone who already trusts root A automatically trusts anything root B signs too; that is how you migrate trust between two healthy roots, but here it would let the untrusted old root vouch for the new one, handing the attacker a path back in.
Phase 2: dual trust, then rotate millions of workloads
flowchart LR
A[Bundle: old root only] --> B[Bundle: old + new root]
B --> C[Re-issue all leaf certs from new chain]
C --> D[Bundle: new root only]
D --> E[Verify: no old-chain handshakes]
C -. "rollback target" .-> B
Step A to B, push the new bundle. Every workload must trust the new root before anything presents a new-chain certificate, or handshakes fail. Distribute through the normal channel (the mesh's trust bundle distribution, SPIRE, the SPIFFE Runtime Environment, or the service mesh control plane) and gate the next step on telemetry: 100% of proxies reporting the new bundle version.
Step B to C, re-issue at scale. Workloads fetch new leaf certificates from the new intermediates. This plan commits to a 6-hour re-issuance window as the target (a business-hours window with slack for retries and backoff); 2 hours is shown only as the aggressive case worth checking your infrastructure against, not a promise the plan makes. Capacity arithmetic for 2 million instances:
6 h×3,600 s/h2,000,000 certs≈92.6 signatures/s (the committed target),2×3,6002,000,000≈277.8 signatures/s (the aggressive case)Split across regional intermediates both rates are modest, but verify each against your issuer's measured signing rate and your HSM's, and add jitter so 2 million agents do not stampede in the first minute. Roll out by ring (deploy in expanding waves, each one gated on the previous wave's health before the next starts): internal tooling, then one low-risk region, then the rest, with automatic pause on handshake-error spikes. Workloads keep serving while they rotate; existing connections complete, and new connections use the new certificate.
Step C to D, distrust the old root. Once telemetry shows no workload presenting an old-chain certificate, push bundles containing only the new root. This is the moment the attacker's certificates stop working.
Window length: this whole A-to-D sequence should be hours, not weeks. If automation allows, target same day. The window is your exposure.
External partners
- Notify partners who trust your root (federation, mTLS (mutual TLS) integrations where both sides present certificates, customer devices) with: what happened at a level legal approves, the new root's fingerprint (a short cryptographic hash of the root certificate, unique enough that comparing it byte for byte confirms a partner has the genuine new root and not a substitute), and a firm deadline for removing the old one.
- Deliver the fingerprint out of band (a signed advisory on a separate channel plus a phone confirmation between named contacts), never only in an email that could come from the attacker.
- Offer a validation endpoint partners can test against before the cutover; track each partner's status on a board. Partners who miss the deadline lose connectivity rather than keeping a compromised trust path open, and that decision is made in advance by an executive, not improvised.
Cryptographic constraints to plan around
- No CRL (certificate revocation list) or OCSP (Online Certificate Status Protocol) for roots. Revocation lists are signed by the issuer; a root's "revocation" would be signed by the compromised key itself. Bundle removal is the only mechanism.
- Every certificate issued under the old root is untrustworthy, including legitimate ones, because the attacker can mint identical-looking ones. Everything gets re-issued.
- Pinned and embedded roots (firmware, mobile apps, appliances, partner configs) cannot be updated by your control plane. Inventory them first; they set your real deadline.
- Clock skew: issue new certificates with a small backdated
notBeforeso slightly slow clocks do not reject them. - Algorithm choice: take the opportunity to use the current recommended key type (for example ECDSA, the elliptic curve digital signature algorithm, on P-256 or P-384) and plan how you would do this again; the rotation you are rehearsing now is also your future crypto-agility.
Rollback strategy
Rollback never means going back to trusting only the old root. The safe rollback target is the dual-trust state (B): if re-issued certificates break something, revert those workloads to their old-chain certificate, which still works in state B, fix, and retry. Keep bundle versions immutable and numbered so "roll back to bundle v41" is one command. Once you reach state D, rolling back re-opens the attacker's access, so it requires incident-commander sign-off.
Monitoring to verify success
- Bundle version per proxy (target 100% on each step before moving on).
- Handshakes by issuing chain: old-chain presentations should fall to zero before step D, and old-chain acceptances must be zero after it.
- Handshake failure rate per service and region during each ring (the canary signal for pausing).
- Certificates observed that are absent from the issuance log (should be zero on the new chain; any hit is a new incident).
- Partner cutover status and synthetic probes from partner-like clients.
Trade-offs and pitfalls
- Speed vs safety: a same-day rotation risks breakage; a slow one leaves the attacker trusted. Pre-built automation and quarterly root-rotation drills are what let you have both.
- Minimising downtime by skipping step A (pushing new certificates before new trust) is the classic self-inflicted outage.
- Forgetting non-mesh consumers (batch jobs, databases with client-certificate authentication, VPN concentrators) leaves pockets that break at step D or, worse, keep trusting the old root silently.
Compare opaque tokens that require introspection with self-contained JWTs in a global microservices environment that experiences intermittent network partitions. Discuss revocation complexity, cacheability, introspection latency, consistency of revocation decisions, and proposed architectures for both approaches. Provide guidelines for SREs on when to prefer opaque tokens vs JWTs based on trust boundaries and SLOs.
Sample Answer
Direct answer
An opaque token is a random string that means nothing by itself; a service must ask the authorisation server "is this valid, and for whom?" (token introspection, standardised in RFC 7662). A JWT (JSON Web Token) carries its claims (the payload's key-value assertions about the token, such as who it identifies and when it expires) and a signature, so any service can validate it locally. Under network partitions the difference becomes a choice between consistency and availability of the auth decision: opaque tokens give you accurate, immediately revocable decisions but fail (or go stale) when the introspection endpoint is unreachable; JWTs keep working through a partition but keep honouring a revoked token until it expires or a denylist reaches that node. My recommendation for a global microservices estate: opaque tokens at the external trust boundary, introspected at the regional gateway, exchanged for short-lived JWTs inside, with the partition behaviour chosen per route from its SLO (service-level objective) and risk.
Side-by-side on the five named axes
| Axis | Opaque + introspection | Self-contained JWT |
|---|---|---|
| Revocation complexity | Simple: delete the token server-side, next introspection says inactive | Hard: the token stays valid until exp (a standard JWT claim: the timestamp after which the token is no longer valid); needs short lifetimes plus a pushed denylist |
| Cacheability | Cache introspection results per token for a short TTL (time-to-live); every cached second is a second of possible staleness | Validation needs only the signing public keys (a JWKS, JSON Web Key Set, cached for hours) |
| Introspection latency | A network call per cache miss: ~1 ms in-region, one cross-region RTT (round-trip time, say 80 to 150 ms) if the auth server is remote | None; signature check is local CPU |
| Consistency of revocation decisions | Strong while reachable: all services see the same answer within the cache TTL | Eventually consistent: each node's view depends on denylist propagation; bounded by token lifetime |
| Behaviour in a partition | Must choose: fail closed (outage for that route) or serve from stale cache | Keeps working; revoked tokens accepted until exp unless the local denylist already had them |
Proposed architecture for each approach
Opaque-token architecture
- A token service with a replicated token store in every region (not one central region), so introspection is an in-region call. Tokens are created with a region-independent ID and the store is replicated asynchronously; revocations replicate the same way, with priority.
- Introspection happens once at the edge gateway (the proxy at the boundary between the open internet and your internal services, which terminates and inspects every incoming request), not in every microservice; results are cached for a short TTL (for example 10 seconds).
- Revocation is a delete in the store plus a purge message to gateway caches.
JWT architecture
- Access tokens with a 5-minute lifetime, signed by keys published through a JWKS endpoint; refresh tokens (long-lived credentials a client exchanges for a fresh access token, so it does not have to make the user log in again) held server-side.
- A revocation stream pushing token IDs and per-user "revoked before" timestamps to every service's in-memory denylist.
- Services validate locally; no runtime dependency on the auth server except key refresh and the stream.
The hybrid I would ship (the "phantom token" pattern)
sequenceDiagram
participant C as External client
participant GW as Regional gateway
participant AS as Regional token service
participant S as Internal service
C->>GW: request + opaque token
GW->>AS: introspect (cache miss only)
AS-->>GW: active, subject, scopes
GW->>GW: mint 60 s internal JWT
GW->>S: request + internal JWT
S->>S: verify signature locally
The outside world holds an opaque token: nothing leaks if it is logged, and it is revocable at once. The gateway's introspection call above gets back whether the token is active, its subject (whose token it is) and its scopes (the specific permissions it grants), and mints a JWT carrying only those. Inside, services get a JWT that lives 60 seconds, so revocation reaches internal calls within one minute without any denylist, and internal hops never block on the auth server.
Worked example: what a partition does
A request path spans three internal hops, and the EU region loses connectivity to the US for 20 minutes. The token service is replicated in both regions.
- All-JWT (5-minute access tokens): EU keeps serving. A token revoked in the US at minute 2 of the partition is honoured in EU until its
exppasses, at most 5 minutes after it was issued, because the revocation stream cannot cross the partition. Worst-case exposure: 5 minutes. - All-opaque with central introspection in the US: every EU cache miss fails. With a 10-second cache, EU effectively goes down for authenticated traffic within about 10 seconds of the partition starting, unless you fail open.
- Hybrid with regional token stores: EU introspects locally, so it stays up. A US-side revocation does not reach the EU store until the link heals, so exposure is the partition duration for that token on EU gateways. Mitigation: EU gateways notice replication lag (heartbeat sequence stops advancing: each region's token store publishes a steadily incrementing counter to the others on a fixed interval, and a store that has fallen out of contact stops advancing its counter) and, for high-risk scopes, reduce cache TTL to zero and require step-up (re-authentication) for new sessions, while low-risk reads continue.
The point to make out loud: no design gives both perfect revocation and full availability during a partition. You choose where to sit per route, and you choose it before the incident.
Guidelines for SREs: when to prefer which
Two terms recur in this table: fail closed means denying a request when the system cannot get a fresh answer (safer, less available), and fail open means allowing it anyway and accepting some risk (more available, less safe).
| Situation | Prefer | Why |
|---|---|---|
| Token crosses an external trust boundary (browsers, mobile, partners) | Opaque | Leak of a logged token reveals nothing; instant revocation at one choke point |
| Internal service-to-service calls with a tight latency SLO (say p99, the 99th percentile, under 50 ms) | Short-lived JWT | No per-hop network call; local validation |
| High-risk actions (payments, admin, data export) where acting on a revoked token is worse than an error | Opaque or JWT plus a live check, fail closed | Consistency over availability |
| Read-mostly, low-risk routes with a strict availability SLO | JWT, fail open on stale data within a bounded window | Availability over consistency |
| Multi-region, frequent partitions | Regional token stores; never a single global introspection endpoint | Keeps introspection in-region |
| Consumers you do not control validating tokens | JWT with published JWKS | They cannot call your introspection endpoint |
Monitoring that proves the choice is working: introspection p99 and error rate per region, cache hit rate, revocation propagation lag per region (with a synthetic revoked-token canary), and the count of requests served under fail-open.
Trade-offs and pitfalls
- Introspecting at every microservice multiplies latency and load by the number of hops; do it once at the edge.
- Long cache TTLs on introspection quietly turn opaque tokens into JWTs with worse performance; keep TTLs short and deliberate.
- Putting sensitive claims in JWTs (email, roles, internal IDs) exposes them to anyone holding the token, since JWT payloads are only encoded, not encrypted.
- Forgetting key rotation for JWTs: services must refresh the JWKS and accept both old and new keys during rotation, or a rotation becomes an outage.
Your platform needs a secrets and API key management system for services sitting behind an API gateway. It must support zero-downtime key rotation, immediate revocation, audit logging, and minimal blast radius if a key leaks. Explain the storage model, how keys get distributed to gateways and services, how you would orchestrate rotation, and the emergency revocation flow.
Sample Answer
Direct answer
Split the problem into two kinds of secret. Client API keys (presented by callers to the gateway) are stored only as hashes in a central key registry and pushed to gateways as a versioned, in-memory snapshot plus a change stream (a continuous feed of create, scope-change and revoke events, so a gateway only has to apply what changed rather than re-fetch everything), so a gateway can validate a key locally and a revocation reaches every gateway in seconds. Service secrets (database passwords, third-party credentials) live in a secrets manager, encrypted under keys held in a KMS (key management service) or HSM (hardware security module), and are fetched at runtime by workloads that authenticate with their platform identity, never with a secret baked into an image. Rotation always runs through a window where old and new are both valid; revocation skips that window and is pushed, acknowledged and audited.
Terms
- Blast radius: how much one leaked key can do. Shrink it with per-client, per-environment, narrowly scoped, short-lived credentials.
- Envelope encryption: each secret is encrypted with its own data key, and that data key is encrypted with a master key that never leaves the KMS/HSM.
- Secret zero: the first credential a brand-new workload needs in order to fetch all its other secrets. How you bootstrap it decides whether the whole design is sound.
Storage model
flowchart LR
ADM[Key admin API] --> REG[(Key registry: hashes + metadata)]
REG --> STR[Change stream]
STR --> G1[Gateway region A]
STR --> G2[Gateway region B]
SM[(Secrets manager)] --> KMS[KMS or HSM master key]
W[Service workload] -->|platform identity| SM
REG --> AUD[(Append-only audit log)]
SM --> AUD
Client API keys. Generate 256 random bits, format as pk_live_<keyid>_<secret>. Store keyid, SHA-256(secret), owner, scopes, environment, status, created and expiry times. Never store the key itself: it is shown once at creation. A fast hash is correct here (unlike passwords): passwords are hashed with deliberately slow algorithms like bcrypt because people choose low-entropy, guessable values, so the hash must be expensive enough to make guessing infeasible. A 256-bit random secret has no such weakness: it cannot be brute-forced regardless of hash speed, so bcrypt's deliberate slowness buys nothing and would add latency on every request. The keyid prefix lets gateways look up the record in one step and lets secret-scanning tools (automated scanners that watch code repositories for accidentally committed credentials) recognise a leaked key in a public repository.
Service secrets. Stored in the secrets manager under envelope encryption, organised by path per service and environment (prod/orders/db), with a policy granting each workload identity exactly its own paths. Prefer dynamic secrets where the backend supports them: the secrets manager creates a unique database user per workload with a lease (a grant that expires automatically unless the workload renews it before the deadline) of, say, 1 hour, so there is nothing long-lived to leak and each credential is attributable to one workload.
Sizing the gateway snapshot. With 2,000,000 active client keys at about 32 bytes of hash plus 100 bytes of metadata each: 2,000,000 x 132 = 264,000,000 bytes, about 252 MiB. That fits in gateway memory, so every validation is a local lookup with no network call. If it did not fit, gateways would cache on demand with a short TTL (time-to-live) and fall back to the registry on a miss.
Distribution to gateways and services
- Gateways load a full snapshot at start-up (tagged with a version number), then apply a change stream of
created / scope_changed / revokedevents in order. Each gateway reports the version it has applied, so the control plane (the system that manages and coordinates gateway configuration, as distinct from the data plane that carries live request traffic) always knows the laggards, the gateways that have fallen behind the latest version. If the stream breaks, the gateway re-fetches a snapshot; if it cannot, it keeps serving from its last snapshot and alerts, because refusing all traffic is worse than a snapshot a few minutes old, except for revocations (see below). - Services fetch their secrets at start-up through a local agent (a sidecar: a helper process deployed alongside the application container that does this fetching and renewal on the app's behalf), which renews leases before expiry and writes secrets to an in-memory file the app re-reads, so rotation does not require a redeploy.
Secret zero: bootstrapping a brand-new workload
The failure pattern is putting a long-lived token in CI (continuous integration) variables or the container image so the new container can log in to the secrets manager. Instead, let the platform vouch for the workload:
- CI/CD pipeline: the CI provider issues a short-lived OIDC (OpenID Connect) token describing the exact repository, branch and job; the secrets manager or the cloud provider's security token service (STS) trusts that issuer and exchanges the token for credentials scoped to that pipeline. No static secret exists in CI at all.
- Ephemeral containers: Kubernetes projects a service-account token that is audience-bound (it can only be redeemed by the exact service it was issued to, not replayed elsewhere) and expires; the agent presents it, the secrets manager validates it against the cluster and returns a short-lived token for that service's paths. On a cloud VM the equivalent is the instance identity document: a document signed by the cloud provider itself, attesting which specific VM instance is making the request.
- When no platform identity exists, use a single-use, short-lived wrapped token delivered by the deploy system (Vault calls this response wrapping: the secrets manager seals the real credential in an envelope that can be opened, or "unwrapped," exactly once): if an attacker used it first, the legitimate workload's unwrap fails and that failure is itself the alarm.
Zero-downtime rotation orchestration
For client API keys, rotation is the client's action, so the platform must allow two active keys per client:
- Client (or automation) creates key B; A and B are both valid.
- Client deploys B; the gateway emits
last_usedper key ID, so both sides can see traffic migrate from A to B. - When A has had zero traffic for a set period (for example 7 days), A is revoked. Keys also carry an expiry (for example 1 year), with warnings at 30 and 7 days.
For service secrets:
- Create the new credential in the backend (new DB password or user) while the old one stays valid.
- Publish it to the secrets manager as a new version; agents pick it up on their next refresh.
- Wait until every consumer reports the new version (or until one full refresh interval plus margin has passed).
- Disable the old credential, then delete it after a cooldown. If error rates rise after step 4, re-enabling the old credential is the rollback, which is why you disable before deleting.
Emergency revocation flow
Leak detected (secret scanner hit, anomaly alert or customer report):
- Revoke in the registry: status
revoked, with reason and actor recorded in the audit log. - Push: the revocation event goes on the change stream with priority; gateways apply it and acknowledge by version. Target: 99% of gateways within 5 seconds.
- Bound the tail: a gateway that has not acknowledged within the deadline is marked unhealthy and removed from the load balancer until it catches up. This turns "eventually revoked" into "revoked, or not serving traffic".
- Scope the damage: query the audit log for every request made with that key ID since the suspected leak time.
- Replace: issue a new key to the owner; for a service secret, rotate immediately without the normal overlap window, accepting a brief error spike.
Audit logging
Every key creation, scope change, revocation, secret read and failed authentication is written to an append-only store in a separate account that application operators cannot delete from. Log key IDs, never key material. Alert on reads from an unexpected identity, a spike in failed validations for one key ID (someone guessing), and use of a key from a new network or country.
Trade-offs and pitfalls
- Local validation vs instant revocation: local snapshots make validation fast and resilient but make revocation a distributed-propagation problem. The acknowledgement-plus-eviction step is what closes that gap; without it you only have "probably revoked".
- Rotation that requires a restart is rotation nobody runs. Hot reload of secrets is a prerequisite.
- Scoping is the cheapest blast-radius control: a key that can only read
ordersinstagingis a far smaller incident than a master key. - Common wrong turn: encrypting API keys reversibly "so support can look them up". If the platform can decrypt them, so can whoever compromises the platform.
You need a secure leader election and state replication scheme for a global control plane spanning five regions, where some nodes may behave maliciously (Byzantine). Choose an algorithm (e.g., PBFT, HotStuff), justify it for this use case, and describe the authentication and cryptographic protections, quorum sizes and performance implications, and the operational monitoring and recovery procedures to detect and handle malicious nodes.
Sample Answer
Direct answer
I would run a HotStuff-family protocol (the lineage behind DiemBFT, the consensus protocol originally built for Meta's Diem payments project, which uses a rotating leader and linear-cost leader changes) on 10 replicas, 2 per region, each operated in a separately administered failure domain. Ten replicas tolerate f=3 Byzantine faults with quorums of 7, which covers a whole region going dark (2 crashed replicas) plus one malicious replica at the same time. Every vote is signed with a per-replica key held in an HSM (hardware security module), votes are aggregated into quorum certificates, a quorum certificate being a single compact proof that at least 2f+1 replicas voted for the same thing, so nobody has to carry all their individual signatures around separately, transport is mTLS (mutual TLS), and equivocation (signing two conflicting votes) is automatically turned into evidence that ejects the replica. The price is roughly half a second of commit latency; that is per commit, not per second of throughput, because commits pipeline (explained below), so a control plane that changes configuration tens of times per second can still keep up.
Why BFT here, and why HotStuff over PBFT
The question stipulates malicious nodes, so crash-fault consensus (Raft, Paxos) is out: a single lying Raft leader can replicate forged entries. Both PBFT and HotStuff organise time into views: a view is one leader's term, during which that replica proposes and the others vote. A view change is the handoff from one leader to the next, whether that is routine (HotStuff) or triggered by a timeout on a suspected-bad leader (PBFT). Among BFT protocols:
| PBFT (Practical Byzantine Fault Tolerance) | HotStuff family | |
|---|---|---|
| Normal-case messages per decision (n = 10, idealised count) | pre-prepare 9 + prepare 81 + commit 90 = 180 (all-to-all) | 3 voting phases x 18 + decide 9 = 63 (leader-to-all, all-to-leader) |
| Leader change (view change) | Heavy: each replica sends proofs of what it prepared; message size grows with n, so about O(n^3) bits in total (the total bits sent grows roughly with the cube of the replica count, not just with n itself) | Linear: the new leader carries one quorum certificate |
| Leader rotation | Only on suspicion of failure | Every view by design |
| Commit latency | Lower (about 1.5 quorum round trips) | Higher (about 3.5 quorum round trips; two-phase variants such as HotStuff-2 reduce this) |
Justification for this use case: a malicious leader is the main performance attack in BFT. It stays within the rules while being slow or dropping selected requests, so no one can prove misbehaviour. PBFT keeps a leader until replicas time out on it and then pays an expensive view change; HotStuff rotates leaders every view and makes the change cheap, so a bad leader costs one view, not an outage. At 10 replicas the message count is not the deciding factor; the cheap, routine leader change is. What would flip it: a latency-critical path (sub-100 ms commits) with a stable, trusted-hardware leader, where PBFT's fewer round trips win.
Quorum sizes
For n replicas tolerating f Byzantine faults you need n≥3f+1, and quorums of 2f+1 guarantee any two quorums share at least f+1 replicas, so at least one honest replica is in both and blocks conflicting decisions:
n=10overlap of two quorums⇒f=⌊(10−1)/3⌋=3,q=2f+1=7≥2q−n=14−10=4=f+1Why not one replica per region (n = 5)? Then f=1 and the quorum is 4 of 5: losing one region uses the entire fault budget, and a single malicious node during a regional outage breaks liveness, meaning the system stops making progress (no decision can ever reach quorum), as opposed to a safety failure where it makes a wrong decision. Why not 7 (f = 2)? With 2 replicas in some regions, one regional outage again consumes the whole budget. Ten, 2 per region, is the smallest layout that survives "one region down plus one attacker".
Performance implications (illustrative numbers)
Assume illustrative round-trip times from the current leader: about 1 ms to its regional peer, then 70, 90, 140 and 200 ms to the other four regions. The leader needs 7 votes: 2 from its own region, 2 at 70 ms, 2 at 90 ms, and the 7th from the 140 ms region. So one quorum round trip, the time for the leader to broadcast and hear back from enough replicas to reach quorum, is about 140 ms.
Where the phase multipliers come from: the message-count row above already showed each protocol's phase structure. Basic HotStuff runs three sequential voting phases (prepare, pre-commit, commit), each of which is a full quorum round trip because the leader must broadcast and then wait for 2f+1 signed votes back before moving on, plus a final decide phase where the leader just broadcasts the completed quorum certificate and does not wait for any reply, so that phase costs about half a round trip (message travels out; no return trip is needed): 3×1+1×0.5=3.5 quorum round trips. PBFT's pre-prepare is the leader's own proposal and is not itself a voted round; it only starts the clock. The prepare phase is one full quorum round trip. The commit phase, however, can complete for the client as soon as 2f+1 commit votes are in, and because commit votes start arriving while the tail of the prepare round trip is still in flight, in the common case the two phases overlap into roughly one and a half round trips rather than two:
HotStuff commit≈3×140+0.5×140=490 ms,PBFT≈1.5×140=210 msBoth multipliers are illustrative, consistent with the phase counts above, not a formal proof; the qualitative point, that HotStuff pays roughly twice the round trips of PBFT per commit, is what drives the design trade-off below.
Throughput is decoupled from per-commit latency by pipelining: chained HotStuff starts the next proposal while the previous one is still collecting votes, so the 490 ms figure is the time for one commit to complete, not a cap on how many commits per second the system can sustain. This is an optimisation layered on top of the core protocol, not something the correctness argument depends on. Batching many control-plane writes into one proposal further raises effective throughput. Signature verification is the CPU cost; aggregating votes into one threshold signature (a single signature that only a quorum, not any individual replica, can produce, so it proves "2f+1 replicas signed this" without listing every signature separately) or aggregate signature (BLS, Boneh-Lynn-Shacham, signatures allow this) keeps quorum certificates compact. Put the leader-rotation schedule in region order so leaders rotate toward users rather than always paying the worst-case geometry.
Authentication and cryptographic protections
- Per-replica identity: each replica has its own signing key, generated in and never exported from an HSM or TPM (trusted platform module), and a certificate from a CA (certificate authority) dedicated to the control plane. No shared keys: a shared key lets one compromised node speak for all of them.
- Signed votes and proposals: every proposal and vote carries the view number, a block hash (a fingerprint of the exact proposed state, so a vote is provably for one specific proposal and not some other one with the same view number) and the signer's ID, so they cannot be replayed into a different view.
- Transport: mTLS between replicas prevents outsiders from injecting traffic; it does not replace vote signatures, because an insider has a valid TLS certificate.
- Client requests signed by the submitting operator or service, and authorised by policy that is itself part of the replicated state, so a malicious replica cannot invent requests.
- Membership changes go through consensus, and require the same 7-of-10 quorum, so an attacker cannot add Sybil replicas (fake identities) to grow past f.
- Independent domains: different operators, cloud accounts and ideally deployment pipelines per region pair. If one CI/CD (continuous integration and delivery) pipeline can push code to all 10, f=3 is fiction.
Monitoring: detecting malicious nodes
| Signal | What it catches |
|---|---|
| Equivocation proofs (two valid signatures from one replica on conflicting blocks in one view) | Provable Byzantine behaviour; auto-open an ejection proposal |
| Per-replica vote participation and vote latency | Selective silence, slow-voting attacks |
| Per-leader view success rate and timeouts | Leaders that stall or censor; feed into leader reputation so repeat offenders are skipped |
| Invalid-signature or malformed-message counts by sender | Forgery attempts, compromised keys |
| State-hash comparison across replicas at each checkpoint (a periodic, quorum-signed snapshot of the replicated state that later recovery and forensics can trust, taken every so many decisions rather than after every single one) | Divergent state (a replica applying different results) |
Treat attributable evidence (equivocation, invalid signatures) differently from suspicion (slowness). Evidence justifies automatic ejection; suspicion only lowers a replica's leader priority and pages a human, because an attacker could otherwise induce slowness in honest nodes to get them ejected.
Recovery procedures
- Eject: a membership-change proposal removes the replica and its key; it needs a 7-of-10 quorum. Now n=9 and f drops to 2, so restore the count quickly.
- Forensics before reuse: snapshot the ejected host; assume its key is compromised, revoke its certificate and never re-admit that key.
- Rebuild: provision a fresh replica from a clean image in the same failure domain, generate a new HSM key, and have it state-sync from a checkpoint signed by 2f+1 replicas, so it cannot be fed a forged snapshot by one bad peer.
- Re-admit via another membership change, back to n=10.
- If more than f replicas were compromised, BFT's guarantees are gone: freeze writes, pick the last checkpoint certificate you trust, rotate every replica key, and rebuild from that checkpoint. Rehearse this, because it is the scenario the protocol cannot handle for you.
Trade-offs and pitfalls
- Common-mode compromise (one bug, one image, one admin team) defeats any replica count; diversity is a design requirement, not polish.
- Latency budget: half a second per commit is fine for configuration and policy; do not put per-request data-plane decisions through this path. The data plane reads committed state locally.
- Cost of f = 3: 10 replicas plus HSMs across five regions; if the real threat is one compromised node, not region-plus-attacker, 7 replicas is a defensible cheaper choice, and saying so shows judgement.
Explain how Byzantine faults change security reasoning and the design of consensus for distributed systems. When should an SRE care about BFT algorithms rather than crash-fault-tolerant ones? Discuss authentication, quorum composition, and the risks of malicious nodes in multi-tenant or partially-trusted environments.
Sample Answer
Direct answer
A crash fault is a node that stops or goes silent; a Byzantine fault is a node that keeps running but lies: it sends different answers to different peers, forges or replays messages, or votes for two conflicting values. Crash-fault-tolerant (CFT) consensus such as Raft or Paxos assumes every node that speaks tells the truth, so a single lying node can corrupt it. Byzantine-fault-tolerant (BFT) consensus, such as PBFT (Practical Byzantine Fault Tolerance, an older, well-studied protocol) or the newer HotStuff family (used in systems like DiemBFT; its main selling point is a cheaper leader change), assumes up to f nodes may be malicious and still agrees correctly, at the cost of more nodes (at least 3f+1 instead of 2f+1), cryptographic authentication of every vote, and more messages. A candidate should be able to name at least one of these two protocols in depth, not necessarily both. An SRE should reach for BFT only when the nodes in the quorum are run by parties who do not trust each other, or when a single compromised node must not be able to rewrite shared state. Inside one organisation, the usual answer is CFT consensus plus strong identity and hardening.
How the security reasoning changes
Consensus is a group of nodes agreeing on one value or one ordered log. A quorum is the minimum set of nodes whose votes are enough to decide.
| Question | Crash-fault world (Raft, Paxos) | Byzantine world (PBFT, HotStuff) |
|---|---|---|
| What can a faulty node do? | Stop, restart, be slow | Anything: lie, equivocate (say "yes" to A and "no" to B), collude |
| Nodes needed to tolerate f faults | 2f+1 | 3f+1 |
| Quorum size | Majority, f+1 | 2f+1 |
| Is authentication required for correctness? | For security yes, for the algorithm's safety proof no | Yes: every vote must be attributable to exactly one node |
| Who is trusted? | Every member | No single member; only "at most f are bad" |
Why 3f+1: the quorum-intersection argument
Two properties matter for any consensus protocol: safety (nothing bad ever happens: no two quorums decide different values) and liveness (something good eventually happens: a decision does get reached, even while some nodes are unresponsive). Safety rests on this: any two quorums that could decide must overlap, so they cannot decide different things. With crashes, overlapping in one node is enough, because that node is honest and will not vote twice. With liars, the overlap must contain at least one honest node, so it must be at least f+1 nodes.
Quorums of size q out of n overlap in at least 2q−n nodes: two groups of size q drawn from a pool of n each exclude at most n−q members, so together they can exclude at most 2(n−q), leaving at least n−2(n−q)=2q−n members in both. You must still be able to reach a quorum while f nodes refuse to answer:
q2q−n⇒ 2(n−f)−n≤n−f(liveness: the honest nodes alone can form a quorum)≥f+1(safety: overlap contains an honest node)≥f+1 ⇒ n≥3f+1Taking the smallest quorum that still satisfies liveness, q=n−f, and substituting n=3f+1 gives the quorum size in the table above: q=(3f+1)−f=2f+1.
Worked numbers: to tolerate one bad node, CFT needs 3 nodes (quorum 2), BFT needs 4 (quorum 3). To tolerate two, CFT needs 5 (quorum 3), BFT needs 7 (quorum 5). With 4 BFT nodes, any two quorums of 3 share 2 nodes; at most 1 is lying, so at least 1 honest node saw both and refuses to vote for conflicting values.
What one malicious Raft node can do
Seeing the failure concretely is what convinces an interviewer. As a reminder, Raft normally works by electing one leader per term (an epoch number that increases every time a new election happens) among a set of followers; the leader alone accepts writes and replicates them, in order, to the followers, who simply accept and apply what the leader sends. That normal-case trust is exactly what a Byzantine node can abuse. A Raft follower that lies can claim an enormous term number, forcing everyone else to step down (a node that sees a higher term abandons its own leadership or vote and defers to the new one) and trigger repeated elections, which is a liveness attack. A malicious Raft leader is worse: followers accept whatever log entries it sends, so it can replicate a forged configuration change or a forged value (entries the followers wrongly apply as if they were legitimate), and it can send different entries to different followers. Raft has no defence because its safety proof assumes nodes follow the protocol. mTLS (mutual TLS, where both ends present certificates) stops outsiders from joining, but does nothing about an insider with a valid certificate.
Authentication
- Every protocol message is signed or MAC-authenticated (a MAC, message authentication code, is a shared-secret-based tag, cheaper to compute than a full signature but only verifiable by parties who hold that shared secret) so a vote is attributable to one replica and cannot be forged or replayed. PBFT's classic design uses message authentication codes between pairs in the common case for speed; HotStuff-family protocols use signatures that can be combined into a compact quorum certificate (proof that 2f+1 replicas voted).
- Keys per node, not per cluster. If all replicas share one key, the adversary who owns one node can speak as all of them, and your f becomes meaningless.
- Equivocation becomes evidence. Two signed, conflicting votes from one replica for the same round are cryptographic proof of misbehaviour you can use to eject it.
- Clients authenticate too. BFT protects agreement among replicas; it does not stop an authorised client from submitting a bad but well-formed request. Authorisation still has to happen.
Quorum composition: the part people get wrong
The 3f+1 bound assumes faults are independent. In practice f must count failure domains an adversary can control together, not boxes:
- If one cloud account, one operator team, or one software build controls two of four replicas, a single compromise yields two faults and exceeds f=1.
- Common-mode failure: if every replica runs identical code, one exploited vulnerability can turn all of them Byzantine at once. BFT then protects nothing. Diversity (different operators, clouds, hardware, sometimes implementations) is what makes the bound real.
- Sybil risk: in open membership, an attacker creates many identities to exceed f. Permissioned membership with vetted, per-node identities avoids this; changing membership must itself go through consensus.
Multi-tenant and partially trusted environments
- Multi-tenant platform, one operator: tenants do not run replicas, so the replicas trust each other; the tenant threat is at the API, not inside consensus. Use CFT (etcd, a Raft-based store) with strict tenant authorisation.
- Consortium or cross-organisation ledger (several banks, several companies sharing a settlement log): each party runs replicas and none trusts the others. This is the canonical BFT case.
- Partially trusted hardware (edge sites, customer premises, a confidential-computing deployment, where the workload runs inside a hardware-isolated enclave specifically because the host machine itself is not trusted): a node can be physically tampered with, so treating it as potentially Byzantine is reasonable.
When should an SRE care?
Recommendation, applied honestly: use CFT unless one of these is true.
- Replicas are operated by parties with conflicting incentives.
- A compromise of any single node must not be able to change the agreed state (regulatory or high-value integrity requirement), and you can place replicas in genuinely independent domains.
- The system is exposed to open membership.
What an SRE takes on with BFT: at least one more node per tolerated fault, O(n^2) message patterns in PBFT (the total messages exchanged grow roughly with the square of the replica count, fine at 4 to 20 replicas, painful at 100), signature verification CPU on every message, key management for every replica, and detection and ejection of misbehaving nodes as a routine operational task.
Trade-offs and pitfalls
- BFT is not intrusion prevention. It tolerates f bad nodes; it does not detect the (f+1)th. You still need monitoring and fast ejection.
- Choosing BFT for an internal control plane (the layer that makes configuration and coordination decisions, as opposed to the data plane that serves user traffic) where all nodes share an admin team, deployment pipeline and image often buys cost without security, because one compromise of that pipeline takes every node. Hardening the pipeline and signing the state is the better spend.
- Crash tolerance goes down per node. With 4 nodes, BFT tolerates only 1 failure of any kind; a CFT cluster of 5 tolerates 2 crashes. If availability matters more than adversarial nodes, CFT gives you more of it per machine.
Unlock Full Question Bank
Get access to all 25 Distributed Systems Security and Trust interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.