Skip to content

Erase the session on every timeout and at boot - #23

Open
oroderico wants to merge 1 commit into
mainfrom
harden-session-reset
Open

oroderico wants to merge 1 commit into
mainfrom
harden-session-reset

Conversation

@oroderico

Copy link
Copy Markdown
Owner

A software reset leaves DRAM as it was. The restart that ends a wallet session was trusted to erase it, but the previous session's stacks are heap memory and survived the reset, mnemonic included.

  • Zero the free heap at boot (scrub_free_heap in seedtool_platform_esp.c). FreeRTOS already fills every new task stack on creation, so the free heap is what can still hold the old session.
  • A declined session timeout now restarts from any screen, instead of unwinding back to the menu through screens that repaint the transcript and hash on the way.
  • seedtool_generate rejects a source/word-count pair with no required events, which used to produce a seed from SHA256(""), and zeroes its output on every error. seedtool_transcript checks its buffers.

Verified with: host self-test (new test for the generate/transcript cases), ASan/UBSan build, Python tests, firmware built twice in espressif/idf:v5.5.4 with the ELF audit and cmp. Not yet run on hardware: the boot scrub still needs a flashed board to confirm a marker left in RAM is gone after a restart.

A software reset leaves DRAM as it was, so the restart that ends a
session did not erase the stacks that held the seed. Zero the free heap
at boot, restart on any declined timeout instead of unwinding through
screens that repaint secrets, and reject a generation with no required
events.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant