Nitrokey Storage firmware checksum mismatch

Good day,

According to the nitrokey app my Nitrokey Storage contains version 0.45 of the firmware.

I exported the firmware from my Nitrokey storage to verify it against the firmwares available here:

https://github.com/Nitrokey/nitrokey-storage-firmware/tree/master/binary

However, the checksums differ:

Online bin:
$ sha256sum firmware_V0.45.bin 
bc161f81d23069950e89c2200ee3c9cec6cefa69af0fe2b0479fc7ef0e2905a5  firmware_V0.45.bin

Exported bin:
$ sha256sum firmware.bin 
fc889d7382e8a0dbb9229d6f2822295694b2ce32cb22efb43c45fa7d340ccb13  firmware.bin`

A diff of the hexdumps of the two files show the following:

$ diff exported online
11139,11140c11139,11140
< 0002ba40  eb 0b c4 1b 16 39 f7 dc  eb 0b c7 7b ff ff ff ff  |.....9.....{....|
< 0002ba50  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
---
> 0002ba40  eb 0b c4 1b 16 39 f7 dc  eb 0b c7 7b 00 00 00 00  |.....9.....{....|
> 0002ba50  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
11418c11418
< 0002d0d0  00 00 00 05 00 00 00 19  00 00 00 7d ff ff ff ff  |...........}....|
---
> 0002d0d0  00 00 00 05 00 00 00 19  00 00 00 7d 00 00 00 00  |...........}....|
11514,11517c11514,11515
< 0002d770  00 00 00 00 ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
< 0002d780  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
< *
< 0003e000
---
> 0002d770  00 00 00 00                                       |....|
> 0002d774`

Please advise
Thanks
cjdp

Hi cjdp!

This is a known issue: https://github.com/Nitrokey/nitrokey-storage-firmware/issues/18
I cannot provide much more details unfortunately.

Hi szszszsz,

From what I can tell all the zeroes / empty spaces have been replaced by ones ?

Maybe this is a bug in the app when exporting firmware (wild guess) ?

My only concern is that one of those ones might be interpreted as something that makes the firmware less secure ?

cjdp

App is just sending the export command to device, which handles the rest itself. After that it is not participating in the process.
On Flash memory storage the default state for erased bit is 1 (on contrary to 0 on usual medium). That would be a nice observation! Under favourable circumstances the issue’s fix consists only of the device having just to translate the empty spaces from 1 to 0 (to match the original firmware). One problem attached with this is to know the size of the firmware / detect firmware actual boundary.

This should not influence overall security.

Right, I am less worried now.

Is there anything I can do to assist you in debugging this issue ? BTW, I am using version 0.63 of the nitrokey app since that is the latest version available in Arch Linux.

Best regards
C J du Preez

It looks like you have found the cause, which helped greatly (thank you once again!). The only issue now is to correct the firmware implementation. You can subscribe to the updates on Github to be up-to-date with the issue progress. We have now some other issues needed to be fixed asap, so this might be a bit later than earlier. I encourage to explore the firmware sources and to try to fix it :wink:

Issue has been closed with a workaround. See link.