Repository navigation
Description
Context
During #79 hardware bring-up we discovered the PBA was unlocking the wrong drive.
selectSED chose the first NVMe controller that answered Level-0 Discovery as Opal.
The lab board exposes 4 NVMe drives, several Opal-capable; a blank Samsung 980 PRO
enumerated before the provisioned Swissbit SED, so the PBA queried the blank drive
→ StartSession returned 0x0c (its LockingSP is Manufactured-Inactive) and we spent
days misdiagnosing it as ComID contention / a firmware TCG wall. It was none of that —
just the wrong drive. On the correct (Swissbit) drive, unlock works (sed unlock ok).
The immediate fix narrowed selection to "the locked Opal drive with an active shadow
MBR" (d.Locked && d.MBREnabled) in selectSED (cmd/pba/sedunlock.go). That works on
the current single-locked-SED rig, but it is a heuristic, not a robust concept.
Problem
selectSED picks the first transport whose Discovery reports
OpalSSC && LockingSupported && Locked && MBREnabled. This is insufficient:
- Multiple locked SEDs can be present → ambiguous which to unlock.
- A target already unlocked earlier in boot (or with MBRDone set) won't match
Locked && MBREnabled→ "no SED found", false negative. - It does not tie unlock to the drive the PBA was actually booted from — the only
drive we have a credential/policy for. Unlocking an arbitrary locked SED is wrong and
a potential security concern (unlocking a drive that isn't the intended target). - The shadow-MBR PBA model implies a 1:1 relationship between the booted PBA image and
its SED; selection should reflect that, deterministically.
What we need: a concept (ADR) for target-drive identification
Evaluate and pick one, ideally a prioritized chain with fail-closed fallback:
- Boot-device match (preferred). Identify the NVMe controller/namespace the PBA was
loaded from by matchingEFI_LOADED_IMAGE_PROTOCOL.DeviceHandle(its device path) to
the carrier handle's device path. Ties unlock to "the drive we booted from" —
unambiguous and correct for the shadow-MBR model. Needs go-boot support to read the
loaded-image device path and compare device paths. - Policy-specified identity. The boot policy names the target SED by a stable
identity (NVMe serial / model / EUI64 / WWN), read via NVMe Identify Controller.
Robust across enumeration order; requires provisioning the identity into the policy. - Credential-verified (last resort). Among locked SEDs, the target is the one our
credential authenticates — but this attempts auth on each, consuming PIN-retry budget
and risking lockout. Not preferred.
Security requirements (threat model + ADR)
- Unlock only the intended drive; never an unintended SED.
- Fail closed if the target cannot be identified unambiguously (0 matches, or >1
ambiguous matches) — do not "pick one". - Decision belongs in the threat model and a dedicated ADR (security-critical behavior).
Acceptance criteria
- ADR documenting the chosen target-drive identification concept + fail-closed rules.
selectSEDimplements it; the interimLocked && MBREnabledheuristic is replaced or
explicitly backed by it.- Tests (extending
cmd/pba/sedunlock_test.go):- decoy non-target Opal drive is skipped (already added:
TestUnlockSEDSkipsNonTargetOpalDrive), - multiple locked SEDs → correct selection or fail-closed-on-ambiguity,
- already-unlocked target handled,
- boot-device match (if approach Enable branch protection on main #1).
- decoy non-target Opal drive is skipped (already added:
- go-boot support for the chosen identity source (loaded-image device-path match, or
NVMe Identify Controller serial), with host stubs for testability.
References
- Opal session-setup conformance on real hardware: Properties exchange + Authenticate (StartSession 0x0c) #79 — the wrong-drive bug, full root-cause investigation, and the interim fix.
cmd/pba/sedunlock.go—selectSED.internal/transport/— NVMe PassThru and Storage Security carriers.
Activity
walterchris commentedon Jul 4, 2026
Interim heuristic now merged (#86):
selectSEDselects the locked Opal SED with an active Shadow MBR (OpalSSC && LockingSupported && Locked && MBREnabled), fixing the #79 wrong-drive bug. This is a stopgap and the rework this issue tracks is still needed:Locked==false, e.g. warm reboot / retry), failing closed with "no locked Opal SED".A code comment at
selectSED(cmd/pba/sedunlock.go) points here. The chosen mechanism should be recorded in an ADR when built.fix(opal): selectSED picks the locked Opal SED (Shadow MBR active), n…
docs: rewrite README (current + planned features); retire stale Phase…
walterchris commentedon Jul 5, 2026
Security review (2026-07-05) reinforces this — becomes MEDIUM once a real PIN prompt ships
The SED/Opal-angle security review flagged this exact gap as finding F1, and raised its severity ceiling:
selectSED(cmd/pba/sedunlock.go:76-97) picks the target purely by self-asserted Level-0 Discovery flags (OpalSSC && LockingSupported && Locked && MBREnabled) and takes the first enumeration match — nothing binds selection to the boot device or a verified drive identity.Attack (evil-maid): attach/reflash a rogue drive that answers Discovery with those flags and enumerates before the genuine SED.
selectSEDreturns the rogue client andClient.Unlocktransmits the StartSession HostChallenge — the PIN — to the attacker's drive (internal/opal/method.go:58-72,internal/opal/client.go:90), harvesting it.Severity: LOW today (the MVP PIN is compiled into the image and already extractable — R-003), but MEDIUM once ADR-0009's user-entered PIN replaces it. The review's explicit recommendation: bind selection to a verified drive identity — policy-pinned NVMe serial/WWN, or the firmware boot-device handle — before any real PIN source lands, and gate that change on the same human/ADR review as the PIN-prompt change.
This is exactly the config-file drive-targeting rework already scoped here. Touches R-002 (accepted residual), threat-model A1/A7/§6.2. Please treat the drive-identity binding as a hard prerequisite for the production PIN work, not just a robustness improvement.
chore(deps): bump go-boot pin tpba.5 -> tpba.6 (NVMe Identify serial)
walterchris commentedon Aug 16, 2026
Status note (2026-08-16): building blocks for the robust-selection rework have landed since this was filed — go-boot v1.6.2-tpba.6 (merged, #108) added NVMe Identify-Controller serial read and ConnectController explicitly for serial-based drive targeting, and the NVMe-passthru carrier (#111) exposes
Serial()per drive. The policy schema could now carry a target serial/WWN andselectSEDcould match it instead of the locked+MBREnabled heuristic. Still open; unchanged in priority (the heuristic works on the current single-locked-SED rig).