Q&A-1Design and validate embedded security for threat model.
Answer
Core answer (first 90 seconds). Assume a Cortex-M MCU with external flash, a network interface, and field-updatable firmware. Before any control, the threat model fixes four things: assets (device identity key, firmware image, sensor data, actuation authority), adversaries (remote network, local bus, physical/board-level, supply chain), trust boundaries (ROM→bootloader→app, MCU→secure element, device→backend), and consequences (safety, fleet-wide key compromise). Design against the strongest adversary you claim to defend, and name the ones you don't.
The design is a chain of trust. An immutable mask ROM holds the hash of the root public key in eFuse/OTP. ROM verifies the first-stage bootloader's ECDSA P-256 signature, that stage verifies the application, and each stage's hash is extended into a measurement register (TPM PCR or DICE). The device private key lives in a secure element (e.g. ATECC608B) or in read-protected OTP: never in flash. On boot the device sends a signed quote over the measurements to the backend, which compares against golden values; unknown measurements quarantine the device.
Trade-offs. The deciding criteria are BOM cost, boot latency, and what the attacker can reach.
| Key storage | Cost | Defends against | Weakness |
|---|---|---|---|
| Key in flash | $0 | nothing | trivially dumped |
| Key in OTP, read-protected | $0 | software readout | decapsulation, glitching |
| Secure element | ~$0.60 at volume | key extraction | I2C bus, extra part |
| TPM 2.0 | several $ | full measured boot + sealing | size, cost |
Signature choice: on a 100 MHz Cortex-M4 an ECDSA P-256 verify is roughly 30–60 ms per stage; RSA-2048 verify with e=65537 is a few ms but the signature is 256 bytes versus 64. Three boot stages of ECDSA add ~100–180 ms to boot: acceptable for most, not for a hard real-time wake path. If boot latency is the binding constraint, verify only the app and keep the bootloader in ROM.
Failure modes and detection.
- Rollback: attacker flashes an older, validly signed image with a known CVE. Detect with a monotonic counter in OTP: boot refuses when image version < counter and logs the rejection. Without the counter, signature checks pass and the attack succeeds.
- Debug port left open: JTAG/SWD enabled in production. Detect in factory test by reading the fuse and failing the unit; in the field, attest a debug-locked measurement.
- Supply chain: counterfeit or tampered module. Detect at first boot: attestation against golden PCRs, unknown signing key → quarantine, not silent trust.
- Safety conflict: a fail-secure control (brick on failed attestation) can disable a safety function. Cross-check with FMEA and define fail-safe versus fail-secure per function.
Validation. Version the threat model and trace each abuse case to a requirement and a test: rollback abuse case → monotonic counter requirement → test that flashes v1 over v3 and asserts boot refusal. Re-run the trace whenever an interface or trust boundary changes; a stale model is the failure that hides all the others.
What an interviewer pushes on: why not software-only key storage (answer: decapsulation), and how you'd detect a compromised device already in the field (answer: attestation drift, not just boot-time checks).
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.