Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intermediary firmware deletes seed #1597

Closed
tsusanka opened this issue May 5, 2021 · 6 comments · Fixed by #1600
Closed

Intermediary firmware deletes seed #1597

tsusanka opened this issue May 5, 2021 · 6 comments · Fixed by #1600
Assignees
Labels
bug Something isn't working as expected
Milestone

Comments

@tsusanka
Copy link
Contributor

tsusanka commented May 5, 2021

Describe the bug
Intermediary FW works fine but we completely forgot we also want to give it to to users that have their device initialized. In this case Intermediary FW wipes the device completely along with seed.

Firmware version and revision
Both intermediary 1.10.0 and 1.8.0.

To Reproduce
Steps to reproduce the behavior:

  1. Get device with old bootloader.
  2. Initialize.
  3. Upload Intermediary firmware.
  4. Observe the seed is gone.

Expected behavior
Seed is kept. The Intermediary firmware wipes it which is not what we want.

@tsusanka tsusanka added bug Something isn't working as expected P1 High labels May 5, 2021
@prusnak
Copy link
Member

prusnak commented May 5, 2021

The fact we erase the old firmware and storage is not an oversight, but rather a feature -

erase_firmware_and_storage();

However, this does not fit our user story when we'd like to use interim firmware also for people with initialized devices.

From my POV the only thing we need to change is to remove the call to erase_firmware_and_storage and the function itself.

This theoretically could open a possibility for an attacker to user interim FW to downgrade to possibly vulnerable bootloader version it is shipping. However, this is circumvented by calling check_and_replace_bootloader which bails out if we hit an unknown bootloader (possibly from the future):

check_bootloader(false);

@prusnak
Copy link
Member

prusnak commented May 5, 2021

Possible fix in #1600

@tsusanka
Copy link
Contributor Author

tsusanka commented May 6, 2021

It also removes this scary screen right?

image

@andrewkozlik
Copy link
Contributor

As I understand it, there was a valid reason why the interim firmware deleted itself and the storage and that was to remove the need for user confirmation, see #4 (comment). Perhaps we could check whether the storage is initialized and delete the firmware and storage only if it's not. The check doesn't need to be complicated, we just need to look at the first word of the norcow sectors. On the other hand this behavior could create some complexity for Suite. Not sure.

@alex-jerechinsky alex-jerechinsky added this to the 21.06 milestone May 10, 2021
@alex-jerechinsky alex-jerechinsky assigned prusnak and unassigned hiviah May 10, 2021
@tsusanka
Copy link
Contributor Author

We have agreed that we will check the storage and:

  • If the storage is initialized do nothing.
  • If the storage is not initialized erase both firmware and storage.

@prusnak
Copy link
Member

prusnak commented May 13, 2021

Closed via #1600

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants