nitrokey-start-firmware icon indicating copy to clipboard operation
nitrokey-start-firmware copied to clipboard

upgrade_by_passwd.py can brick the key on single invocation

Open nakato opened this issue 6 years ago • 6 comments

A single invocation of "upgrade_by_passwd.py" with the wrong admin key will brick the key in a single run if factory_reset=no

I would not expect the tool to try a single pin 3 times in a row without prompting, it would probably be best to make this less aggressive.

nakato avatar Feb 23 '19 10:02 nakato

@szszszsz I think, a fix would be to delete this loop. In my opinion a user, not the script should restart if something failed.

But this may should be fixed upstream, don't you think? Shall I ask NIIBE on the gnuk-mailingslist?

alex-nitrokey avatar Feb 25 '19 10:02 alex-nitrokey

@nakato Agreed.

@alex-nitrokey That is a good candidate for the cause indeed. The loop should only continue in a case, where the connection issues had occurred, not when the PIN had been incorrect. It would be the safest to remove it for now. Could you prepare a patch for NIIBE and send him via the mailing list? It would be faster to explain the problem, when the fix is presented as well, and perhaps it will be merged directly. We should apply the patch in our repository anyway, until the handling is improved.

szszszsz avatar Feb 25 '19 10:02 szszszsz

I created a PR in #13

I added a check if auth attempt actually worked. The loop breaks if the authentication failed. This helps to keep the feature of killing scdaemon automatically intact.

alex-nitrokey avatar Feb 25 '19 16:02 alex-nitrokey

Did you check if latest Gnuk contains a fix for that issue already, perhaps?

jans23 avatar Feb 25 '19 16:02 jans23

Did you check if latest Gnuk contains a fix for that issue already, perhaps?

Well... actually I should have, but I didn't.

alex-nitrokey avatar Feb 25 '19 16:02 alex-nitrokey

Doesn't look like it.

alex-nitrokey avatar Feb 25 '19 16:02 alex-nitrokey