BUG: nitrokey HOTP BROKEN

Hi all,

during tests I realized that HOTP with nitrokey and nitrokey-app does not work. Tracking down the issue I realized that nitrokey-app produces wrong HOTPs. This can easily be reproduced and verified.

From RFC 4226 tools.ietf.org/html/rfc4226 use the Secret = “3132333435363738393031323334353637383930”. Program Nitrokey using nitrokey-app as follows:

Manage Slots
(*) HOTP
Slot: HOTP slot *(any free) *Name: rfc4226

Secret key
Input format: (*) Hex
Secret Key: 3132333435363738393031323334353637383930

Parameters
HOTP length: (*) 6 digits
Moving factor seed: 0

Save

  • Open any editor you like/
  • Click nitrokey-app -> passwords -> rfc4226
  • Paste into editor
  • Repeat 9 times

According to RFC 4226 the HOTP values produced must be as follows (see page 31):

                   Truncated
   Count    Hexadecimal    Decimal        HOTP
   0        4c93cf18       1284755224     755224
   1        41397eea       1094287082     287082
   2         82fef30        137359152     359152
   3        66ef7655       1726969429     969429
   4        61c5938a       1640338314     338314
   5        33c083d4        868254676     254676
   6        7256c032       1918287922     287922
   7         4e5b397         82162583     162583
   8        2823443f        673399871     399871
   9        2679dc69        645520489     520489

However, the HOTPs produced by Nitrokey are:

Count HOTP
0     039329
1     710717
2     528155
3     980838
4     249088
5     354406
6     399156
7     478026
8     294892
9     941415

I have verified that behavior on two different Nitrokeys.

  • Ubuntu 15.10
  • Nitrokey App Version 0.2
  • Firmware Version 0.7

Please confirm and fix.

same here, both under Windows and Ubuntu 14.04LTS , result is the same wrong numbers. I also had to disconnect the card several times and insert it again to make the reset app work under Windows 10 (CryptoStickReset), btw same on Linux with gpg-connect-agent. The configuration app even returned a success for deleting a HTOP entry, but after reconnecting the entry was still there. Seems to me there is something fundamentally broken in App Version 0.2 Firmware 0.7 , I will claim my money back, starting with the installation and poor documentation, this stick is not yet ready and stable enough to get sold as a security device. It is a pitty it did sound like a real alernative to Yubikey.

I encountered the same problems with nitrokey-app (need to reconnect / reload, broken slot programming …). It sure is a pity, but having tested multiple different usb tokens - including yubikey - we realized that practically all of them do have problems, and none of them work reliably, especially in homogeneous environments or when trying to use them for multiple purposes. I think that the whole system is fundamentally broken.

But what troubles and annoys me most is the fact, that these problems seem to be completely ignored by developers and manufacturers alike, although they advertise their products as universal solutions for all problems, when in reality they can be used for a small subset of promised features, if at all.
For example, a broken HOTP implementation is a serious matter and should be dealt with quickly. Yet there is no reaction by nitrokey anywhere. No activity on Github, no comment on the forums. Nothing. It has been weeks since I first reported the issue. But again, same thing with other manufacturers. At least nitrokey is open source and open hardware, so anybody could try to fix these issues. Curiously, nobody does. Yet we are in need of working and reliable solutions. It’s sad.

A quick update on the matter. Programming nitrokey with the secret in Base32 encoding does provide the correct HOTPs. So it appears to be a string conversion issue or sth similar.

Confirm:

Manage Slots
(*) HOTP
Slot: HOTP slot (any free) Name: rfc4226

Secret key
Input format: (*) Base32
Secret Key: GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ

Parameters
HOTP length: (*) 6 digits
Moving factor seed: 0

Save

OTPs:

039329
710717
528155
980838
249088
354406
399156
478026
294892
941415

Still, please fix this!

Well, it seems my previous post was premature. Although I got it working with the Base32 presentation of above key, I immediately ran into issues when using another key. Trying to program the following key in both hex and b32:

b32:	EWKTEW2A2JK6662CWA2GJXPBOJQIGJBO
hex:	2595325b40d255ef7b42b03464dde1726083242e

The correct and expected first 10 HOTPs are:

398695
663930
515098
680035
006781
913452
093785
684287
989313
832155

The HOTPs produced by nitrokey are:

703331
095468
940191
721862
591533
653225
923834
821509
632097
464278

No matter what I try, HOTPs are always wrong. Whatever I did earlier to get the correct values, I can’t reproduce it for the new key. So it’s not just a string parsing issue. Programming of HOTPs is totally broken.

So again. Please, show some dedication to your product and react somehow.

Thanks for your analysis. We assume the error is in the Nitrokey App which is quite messy code. Since January our focus has been on rewriting the Nitrokey App from scratch, starting with a clean library-layer. This would be the most efficient approach to fix this and other errors but it will take a few more months. In the meanwhile we will try to fix it at the current Nitrokey App. Please give us some more time and I will inform you here.

The Nitrokey App is fixed now in the code repository. See: github.com/Nitrokey/nitrokey-app/commits/master

We will provide binaries later on.

[quote=“admin”]The Nitrokey App is fixed now in the code repository. See: github.com/Nitrokey/nitrokey-app/commits/master

We will provide binaries later on.[/quote]

Any ETA when you will provide the binaries?
Thanks a lot

Hi,
did anybody successfully login to Keepass2 with HOTP and could post his settings/procedure here please?
Or is the Nitrokey-App still the problem?
I also didn’t figure out, how the “Hotkeys” Capslock/Numlock etc insert the keys …

Greetings,
Niklas

Hi Niklas!

Could you make a new topic with this issue? It will be easier to organize.
As for Nitrokey App - HOTP issue was fixed some time ago and it surely works in latest release.
Regarding hotkeys - you have to choose OTP slot in the configuration. Then after double pressing chosen capslock/numlock/scrolllock the OTP code should be inserted by the key. App running is not needed while using hotkey.

Regards

Möööp! Rubbish

It is workin’ Knowledge about the Windowing inside the HOTP process would help :blush:
Ignore the text below.


Sorry, but that is not correct.

HOTP is working only the first time with Keepass2.
After the first login i have to use the secret key in recovery mode to log in again.

HOTP is not working and the Key-Shortcuts for automatic insertion are didn’t work also.

app 0.6.3
firm 0.44

Yeah also encountering problems with HOTP and keepass as stated above.

Regarding the Keepass configuration with Nitrokey devices I have responded here: