Skip to content

ClearSession does not abort Bitcoin signing or fully scrub signer state #616

Description

@BitHighlander

Summary

ClearSession does not abort an in-flight Bitcoin signing state machine, and the branch's signing_abort() does not fully scrub the signing key material it does own.

Found while auditing PR #604 at exact head 1d446ccbc9cf32a6e499990e65bcf7b358f1325b.

Evidence

  • lib/firmware/messagemap.def:15-20 registers SignTx, TxAck, and ClearSession as independently dispatchable inbound messages.
  • lib/board/messages.c:122-139 dispatches any mapped message directly; it has no expected-message-type gate for an active signing session.
  • lib/firmware/fsm.c:300-303 handles ClearSession by calling only session_clear(true) and returning success.
  • By contrast Initialize and Cancel call signing_abort() (fsm_msg_common.h:1-10, :582-590).
  • lib/firmware/signing.c:96 holds the current raw private key in file-static privkey[32], populated at :1857.
  • signing_abort() at :2151-2159 wipes node and the root pointer itself, but not privkey, transaction/hash state, or the HDNode referenced by root.

Closed issues #452/#546 record the private-key/root fixes on alpha; those fixes are absent from this 7.14.3 head.

Impact

High — authorization loss is not a signing boundary. After transaction approval and before the final streamed TxAck, a host can clear the session and continue the still-live signer. Separately, abort leaves a spend key resident for the boot lifetime.

Acceptance criteria

  • Make ClearSession, lock, wipe, Initialize, and Cancel invoke one central Bitcoin signing teardown before reporting success.
  • Backport the closed alpha private-key/root scrubbing fixes and wipe all signing accumulators/state that can carry authorization or key material.
  • Add an integration test that interposes ClearSession at every TxRequest stage and proves every later TxAck is rejected with no signature/serialization.
  • Add unit instrumentation proving confidential signing buffers are zero after success and every abort path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions