-
Notifications
You must be signed in to change notification settings - Fork 19
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
Unable to export firmware properly #83
Comments
Hi! Nitrokey App v1.4 is planned to warn user about that. Firmware fix is already prepared, but it confused the App v1.3 (potentially making more harm than good), hence not merged yet. Please retest the export, with making sure before that the UV is set to read-write. Log excerpt:
To do:
cc: @alex-nitrokey |
Actually, I got confused, sorry. Just checked, and |
I'm quite sure this issue is not caused by the unencrypted volume being read-only as I've set it to r/w and the described steps for reproduction sometimes work in part, but it never fully works. Maybe some component falsely thinks that it is read-only and fails, but that doesn't explain why the exported firmware binary is broken in cases where it does work. Until there is no solution to this, I consider my Nitrokey as compromised, because the firmware can not be verified. |
@muellermartin Please elaborate "broken". Did you follow these instructions to verify and compare the firmware? |
@muellermartin Here are the updated instructions for macOS: @jans23 The problem is, that macOS sees too small file of the exported firmware. We have not seen that on Linux. I have not seen that myself, when tested the firmware verification lately too. Will check. |
For my definition of broken, see my original post (read/write errors and only 4096 bytes in firmware). Yes, it did follow the steps. Basically I fail at step 4, because the firmware can not be exported properly (hence the title of this issue). |
What's the status of this issue other than havin to wait for version 1.4 of the application? I can't trust my Nitrokey farther than I can throw it unless I'm able to verify the firmware. |
@muellermartin I understand your concerns. Actually I plan to take this on this week, specifically tomorrow, and would be best to resolve it asap. The milestone is just an upper time limit for the issue to be solved. |
Confirmed firmware export is troublesome under macOS 10.13.6. Investigating further. |
Export the firmware multiple times, and test its size. Hardcoded device set to /dev/sde1 Related: https://github.com/Nitrokey/nitrokey-app/issues/399 Signed-off-by: Szczepan Zalega <[email protected]>
Moved to Storage firmware repository. |
Retested under Fedora 29 with Nitrokey/libnitrokey@a2b7b9a. In a stress test it turned out, that overall success rate for export is 3/10 and 5/20. Solution:
Edit: relevant references:
|
Thanks for testing this and finding a possible cause! I even can confirm this under macOS: I've unmounted the unencrypted volume (had to use the workaround in issue Nitrokey/nitrokey-app#337, i.e. use Disk Utility to disable the volume to bypass the automount) and then used the export functionality in Nitrokey App. Funnily, the unencrypted volume was set to read-only and the firmware export worked nevertheless, although according to issue #69 this shouldn't have worked). This worked on the first try. I did not try it several times to test the reproducibility. And the good news is that the exported firmware also could be successfully verified with the provided script (
|
Thank you for the feedback! Related: #45 |
Based on your stress test I've added a similar test for macOS (see PR Nitrokey/libnitrokey#151). The results for me:
|
@NKelias Could you take a brief look to that, if time would permit? |
Expected behaviour
Firmware can be exported into a file and this file can be successfully matched against the original release of the same version.
Current behaviour
Mostly the exported
firmware.bin
file is not listed in the file system of the USB storage although the notification says it was successfully exported.When the Nitrokey Storage is remounted several times and/or the firmware export is repeated (not sure what helps there), the file appears, but is somewhat faulty. For example, if the file is copied to disk, the Finder shows following error message (German):
Nevertheless, the file gets copied – at least it seems so (there is a copy and it contains data). Because when using
nkcompare.sh
from Nitrokey/nitrokey-storage-firmware/tools
to compare the exported binary with the original one from GitHub, the binaries do not match ("Firmware binaries mismatch"). This is likely because the exportedfirmware.bin
contains very few data (only exact 4096 bytes!) and the rest is filled with zeros (see attachedfirmware.bin
).When using
cp
instead of Finder for coyping thefirmware.bin
file from the USB storage to the disk, following error is shown:And the resulting copy is an empty file (0 bytes).
Deleting the file from the Nitrokey storage works, though.
Directly reading the file from the USB storage (e.g.
xxd /Volumes/Nitrokey/firmware.bin | less
also gives anInput/output error
).Steps for reproduction
Preconditions
Nothing special.
Steps
firmware.bin
is visible in the filesystem of the USB storage.firmware.bin
(e.g. for comparison with original firmware)Logs
Logs attached:
Faulty firmware dump
firmware.bin.zip
The text was updated successfully, but these errors were encountered: