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

Example cred breaks with user verificaton enabled #192

Closed
Nesuma opened this issue Jul 14, 2020 · 6 comments
Closed

Example cred breaks with user verificaton enabled #192

Nesuma opened this issue Jul 14, 2020 · 6 comments
Labels
bug report Something isn't working

Comments

@Nesuma
Copy link

Nesuma commented Jul 14, 2020

I'm playing around with my Yubikey 5 and this library and right now im trying the example cred.
If I run the binary without any parameters I get cred: fido_makecred: FIDO_ERR_PIN_REQUIRED (0x36). After adding -P <pin> it seems to work. My token flashes and after touching the sensor the application ends without any errors. The problem occurs when I add -v to the parameters (to enable user verification). Then I receive cred: fido_makecred: FIDO_ERR_UNSUPPORTED_OPTION (0x2b) no matter if I also add the pin or not.

I looked at the code and noticed that calling fido_cred_set_uv with FIDO_OPT_FALSE or FIDO_OPT_TRUE always ends in the unsupported error while FIDO_OPT_OMIT does work. With OMIT replacing TRUE in the user verification part of examples/cred.c I can successfully run ./cred -v -P <pin>.

The output of fido-token -I doesn't show uv as an option but I don't know if it should. Registering online accounts with user verification required does work.

What version of libfido2 are you using?
1.4.0

What operating system are you running?
Linux archdesktop 5.7.7-arch1-1 #1 SMP PREEMPT Wed, 01 Jul 2020 14:53:16 +0000 x86_64 GNU/Linux

How does the problem manifest itself?
cred: fido_makecred: FIDO_ERR_UNSUPPORTED_OPTION (0x2b)

Is the problem reproducible?
./examples/cred -v

What are the steps that lead to the problem?
Compiling and running the example cred with -v

Does the problem happen with different authenticators?
I only have a Yubikey 5

Please include the output of fido2-token -L.
/dev/hidraw6: vendor=0x1050, product=0x0407 (Yubico YubiKey OTP+FIDO+CCID)

Please include the output of fido2-token -I.

fido_tx: d=0x559975c5f2a0, cmd=0x06, buf=0x559975c5f2a0, count=8
0000: ce 69 ca be e5 f5 ee e7
fido_rx: d=0x559975c5f2a0, cmd=0x06, buf=0x559975c5f2a8, count=17, ms=-1
rx_preamble: initiation frame at 0x7ffdf4a3c4e0
0000: ff ff ff ff 86 00 11 ce 69 ca be e5 f5 ee e7 00
0016: 09 00 03 02 05 02 06 05 00 00 00 00 00 00 00 00
0032: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0048: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
rx: payload_len=17
fido_rx: buf=0x559975c5f2a8, len=17
0000: ce 69 ca be e5 f5 ee e7 00 09 00 03 02 05 02 06
0016: 05
fido_dev_get_cbor_info_tx: dev=0x559975c5f2a0
fido_tx: d=0x559975c5f2a0, cmd=0x10, buf=0x7ffdf4a3c527, count=1
0000: 04
fido_dev_get_cbor_info_rx: dev=0x559975c5f2a0, ci=0x559975c5f340, ms=-1
fido_rx: d=0x559975c5f2a0, cmd=0x10, buf=0x7ffdf4a3bd20, count=2048, ms=-1
rx_preamble: initiation frame at 0x7ffdf4a3bc50
0000: 00 09 00 03 90 00 c3 00 aa 01 83 66 55 32 46 5f
0016: 56 32 68 46 49 44 4f 5f 32 5f 30 6c 46 49 44 4f
0032: 5f 32 5f 31 5f 50 52 45 02 82 6b 63 72 65 64 50
0048: 72 6f 74 65 63 74 6b 68 6d 61 63 2d 73 65 63 72
rx: payload_len=195
rx: continuation frame at 0x7ffdf4a3bc50
0000: 00 09 00 03 00 65 74 03 50 2f c0 57 9f 81 13 47
0016: ea b1 16 bb 5a 8d b9 20 2a 04 a5 62 72 6b f5 62
0032: 75 70 f5 64 70 6c 61 74 f4 69 63 6c 69 65 6e 74
0048: 50 69 6e f5 75 63 72 65 64 65 6e 74 69 61 6c 4d
rx: continuation frame at 0x7ffdf4a3bc50
0000: 00 09 00 03 01 67 6d 74 50 72 65 76 69 65 77 f5
0016: 05 19 04 b0 06 81 01 07 08 08 18 80 09 82 63 6e
0032: 66 63 63 75 73 62 0a 82 a2 63 61 6c 67 26 64 74
0048: 79 70 65 6a 70 75 62 6c 69 63 2d 6b 65 79 a2 63
rx: continuation frame at 0x7ffdf4a3bc50
0000: 00 09 00 03 02 61 6c 67 27 64 74 79 70 65 6a 70
0016: 75 62 6c 69 63 2d 6b 65 79 00 00 00 00 00 00 00
0032: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0048: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
fido_rx: buf=0x7ffdf4a3bd20, len=195
0000: 00 aa 01 83 66 55 32 46 5f 56 32 68 46 49 44 4f
0016: 5f 32 5f 30 6c 46 49 44 4f 5f 32 5f 31 5f 50 52
0032: 45 02 82 6b 63 72 65 64 50 72 6f 74 65 63 74 6b
0048: 68 6d 61 63 2d 73 65 63 72 65 74 03 50 2f c0 57
0064: 9f 81 13 47 ea b1 16 bb 5a 8d b9 20 2a 04 a5 62
0080: 72 6b f5 62 75 70 f5 64 70 6c 61 74 f4 69 63 6c
0096: 69 65 6e 74 50 69 6e f5 75 63 72 65 64 65 6e 74
0112: 69 61 6c 4d 67 6d 74 50 72 65 76 69 65 77 f5 05
0128: 19 04 b0 06 81 01 07 08 08 18 80 09 82 63 6e 66
0144: 63 63 75 73 62 0a 82 a2 63 61 6c 67 26 64 74 79
0160: 70 65 6a 70 75 62 6c 69 63 2d 6b 65 79 a2 63 61
0176: 6c 67 27 64 74 79 70 65 6a 70 75 62 6c 69 63 2d
0192: 6b 65 79
parse_reply_element: cbor type
parse_reply_element: cbor type
fido_dev_open_rx: FIDO_MAXMSG=2048, maxmsgsiz=1200
proto: 0x02
major: 0x05
minor: 0x02
build: 0x06
caps: 0x05 (wink, cbor, msg)
fido_dev_get_cbor_info_tx: dev=0x559975c5f2a0
fido_tx: d=0x559975c5f2a0, cmd=0x10, buf=0x7ffdf4a3c5e7, count=1
0000: 04
fido_dev_get_cbor_info_rx: dev=0x559975c5f2a0, ci=0x559975c5f7d0, ms=-1
fido_rx: d=0x559975c5f2a0, cmd=0x10, buf=0x7ffdf4a3bde0, count=2048, ms=-1
rx_preamble: initiation frame at 0x7ffdf4a3bd10
0000: 00 09 00 03 90 00 c3 00 aa 01 83 66 55 32 46 5f
0016: 56 32 68 46 49 44 4f 5f 32 5f 30 6c 46 49 44 4f
0032: 5f 32 5f 31 5f 50 52 45 02 82 6b 63 72 65 64 50
0048: 72 6f 74 65 63 74 6b 68 6d 61 63 2d 73 65 63 72
rx: payload_len=195
rx: continuation frame at 0x7ffdf4a3bd10
0000: 00 09 00 03 00 65 74 03 50 2f c0 57 9f 81 13 47
0016: ea b1 16 bb 5a 8d b9 20 2a 04 a5 62 72 6b f5 62
0032: 75 70 f5 64 70 6c 61 74 f4 69 63 6c 69 65 6e 74
0048: 50 69 6e f5 75 63 72 65 64 65 6e 74 69 61 6c 4d
rx: continuation frame at 0x7ffdf4a3bd10
0000: 00 09 00 03 01 67 6d 74 50 72 65 76 69 65 77 f5
0016: 05 19 04 b0 06 81 01 07 08 08 18 80 09 82 63 6e
0032: 66 63 63 75 73 62 0a 82 a2 63 61 6c 67 26 64 74
0048: 79 70 65 6a 70 75 62 6c 69 63 2d 6b 65 79 a2 63
rx: continuation frame at 0x7ffdf4a3bd10
0000: 00 09 00 03 02 61 6c 67 27 64 74 79 70 65 6a 70
0016: 75 62 6c 69 63 2d 6b 65 79 00 00 00 00 00 00 00
0032: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0048: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
fido_rx: buf=0x7ffdf4a3bde0, len=195
0000: 00 aa 01 83 66 55 32 46 5f 56 32 68 46 49 44 4f
0016: 5f 32 5f 30 6c 46 49 44 4f 5f 32 5f 31 5f 50 52
0032: 45 02 82 6b 63 72 65 64 50 72 6f 74 65 63 74 6b
0048: 68 6d 61 63 2d 73 65 63 72 65 74 03 50 2f c0 57
0064: 9f 81 13 47 ea b1 16 bb 5a 8d b9 20 2a 04 a5 62
0080: 72 6b f5 62 75 70 f5 64 70 6c 61 74 f4 69 63 6c
0096: 69 65 6e 74 50 69 6e f5 75 63 72 65 64 65 6e 74
0112: 69 61 6c 4d 67 6d 74 50 72 65 76 69 65 77 f5 05
0128: 19 04 b0 06 81 01 07 08 08 18 80 09 82 63 6e 66
0144: 63 63 75 73 62 0a 82 a2 63 61 6c 67 26 64 74 79
0160: 70 65 6a 70 75 62 6c 69 63 2d 6b 65 79 a2 63 61
0176: 6c 67 27 64 74 79 70 65 6a 70 75 62 6c 69 63 2d
0192: 6b 65 79
parse_reply_element: cbor type
parse_reply_element: cbor type
version strings: U2F_V2, FIDO_2_0, FIDO_2_1_PRE
extension strings: credProtect, hmac-secret
aaguid: 2fc0579f811347eab116bb5a8db9202a
options: rk, up, noplat, clientPin, credentialMgmtPreview
maxmsgsiz: 1200
maxcredcntlst: 8
maxcredlen: 128
fwversion: 0x0
pin protocols: 1
fido_tx: d=0x559975c5f2a0, cmd=0x10, buf=0x559975c5f750, count=6
0000: 06 a2 01 01 02 01
fido_rx: d=0x559975c5f2a0, cmd=0x10, buf=0x7ffdf4a3bde0, count=2048, ms=-1
rx_preamble: initiation frame at 0x7ffdf4a3bd10
0000: 00 09 00 03 90 00 04 00 a1 03 08 00 00 00 00 00
0016: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0032: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0048: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
rx: payload_len=4
fido_rx: buf=0x7ffdf4a3bde0, len=4
0000: 00 a1 03 08
pin retries: 8
fido_tx: d=0x559975c5f2a0, cmd=0x10, buf=0x559975c5f750, count=6
0000: 40 a2 01 01 02 07
fido_rx: d=0x559975c5f2a0, cmd=0x10, buf=0x7ffdf4a3bda0, count=2048, ms=-1
rx_preamble: initiation frame at 0x7ffdf4a3bcd0
0000: 00 09 00 03 90 00 01 01 00 00 00 00 00 00 00 00
0016: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0032: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0048: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
rx: payload_len=1
fido_rx: buf=0x7ffdf4a3bda0, len=1
0000: 01
cbor_parse_reply: blob[0]=0x01
bio_rx_info: bio_parse_info
bio_get_info_wait: tx/rx

Output of example cred

>  ./cred -v        
is_fido: open
is_fido: open
is_fido: open
is_fido: open
is_fido: open
is_fido: open
fido_tx: d=0x564f8d40d8c0, cmd=0x06, buf=0x564f8d40d8c0, count=8
0000: 9c 84 9f 2d ae b2 e9 40
fido_rx: d=0x564f8d40d8c0, cmd=0x06, buf=0x564f8d40d8c8, count=17, ms=-1
rx_preamble: initiation frame at 0x7ffe9a7d3730
0000: ff ff ff ff 86 00 11 9c 84 9f 2d ae b2 e9 40 00
0016: 09 00 0f 02 05 02 06 05 00 00 00 00 00 00 00 00
0032: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0048: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
rx: payload_len=17
fido_rx: buf=0x564f8d40d8c8, len=17
0000: 9c 84 9f 2d ae b2 e9 40 00 09 00 0f 02 05 02 06
0016: 05
fido_dev_get_cbor_info_tx: dev=0x564f8d40d8c0
fido_tx: d=0x564f8d40d8c0, cmd=0x10, buf=0x7ffe9a7d3777, count=1
0000: 04
fido_dev_get_cbor_info_rx: dev=0x564f8d40d8c0, ci=0x564f8d40be70, ms=-1
fido_rx: d=0x564f8d40d8c0, cmd=0x10, buf=0x7ffe9a7d2f70, count=2048, ms=-1
rx_preamble: initiation frame at 0x7ffe9a7d2ea0
0000: 00 09 00 0f 90 00 c3 00 aa 01 83 66 55 32 46 5f
0016: 56 32 68 46 49 44 4f 5f 32 5f 30 6c 46 49 44 4f
0032: 5f 32 5f 31 5f 50 52 45 02 82 6b 63 72 65 64 50
0048: 72 6f 74 65 63 74 6b 68 6d 61 63 2d 73 65 63 72
rx: payload_len=195
rx: continuation frame at 0x7ffe9a7d2ea0
0000: 00 09 00 0f 00 65 74 03 50 2f c0 57 9f 81 13 47
0016: ea b1 16 bb 5a 8d b9 20 2a 04 a5 62 72 6b f5 62
0032: 75 70 f5 64 70 6c 61 74 f4 69 63 6c 69 65 6e 74
0048: 50 69 6e f5 75 63 72 65 64 65 6e 74 69 61 6c 4d
rx: continuation frame at 0x7ffe9a7d2ea0
0000: 00 09 00 0f 01 67 6d 74 50 72 65 76 69 65 77 f5
0016: 05 19 04 b0 06 81 01 07 08 08 18 80 09 82 63 6e
0032: 66 63 63 75 73 62 0a 82 a2 63 61 6c 67 26 64 74
0048: 79 70 65 6a 70 75 62 6c 69 63 2d 6b 65 79 a2 63
rx: continuation frame at 0x7ffe9a7d2ea0
0000: 00 09 00 0f 02 61 6c 67 27 64 74 79 70 65 6a 70
0016: 75 62 6c 69 63 2d 6b 65 79 00 00 00 00 00 00 00
0032: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0048: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
fido_rx: buf=0x7ffe9a7d2f70, len=195
0000: 00 aa 01 83 66 55 32 46 5f 56 32 68 46 49 44 4f
0016: 5f 32 5f 30 6c 46 49 44 4f 5f 32 5f 31 5f 50 52
0032: 45 02 82 6b 63 72 65 64 50 72 6f 74 65 63 74 6b
0048: 68 6d 61 63 2d 73 65 63 72 65 74 03 50 2f c0 57
0064: 9f 81 13 47 ea b1 16 bb 5a 8d b9 20 2a 04 a5 62
0080: 72 6b f5 62 75 70 f5 64 70 6c 61 74 f4 69 63 6c
0096: 69 65 6e 74 50 69 6e f5 75 63 72 65 64 65 6e 74
0112: 69 61 6c 4d 67 6d 74 50 72 65 76 69 65 77 f5 05
0128: 19 04 b0 06 81 01 07 08 08 18 80 09 82 63 6e 66
0144: 63 63 75 73 62 0a 82 a2 63 61 6c 67 26 64 74 79
0160: 70 65 6a 70 75 62 6c 69 63 2d 6b 65 79 a2 63 61
0176: 6c 67 27 64 74 79 70 65 6a 70 75 62 6c 69 63 2d
0192: 6b 65 79
parse_reply_element: cbor type
parse_reply_element: cbor type
fido_dev_open_rx: FIDO_MAXMSG=2048, maxmsgsiz=1200
fido_tx: d=0x564f8d40d8c0, cmd=0x10, buf=0x564f8d40c620, count=182
0000: 01 a5 01 58 20 f9 64 57 e7 2d 97 f6 bb dd d7 fb
0016: 06 37 62 ea 26 20 44 8e 69 7c 03 f2 31 2f 99 dc
0032: af 3e 8a 91 6b 02 a2 62 69 64 69 6c 6f 63 61 6c
0048: 68 6f 73 74 64 6e 61 6d 65 74 73 77 65 65 74 20
0064: 68 6f 6d 65 20 6c 6f 63 61 6c 68 6f 73 74 03 a3
0080: 62 69 64 58 20 78 1c 78 60 ad 88 d2 63 32 62 2a
0096: f1 74 5d ed b2 e7 a4 2b 44 89 29 39 c5 56 64 01
0112: 27 0d bb c4 49 64 6e 61 6d 65 6a 6a 6f 68 6e 20
0128: 73 6d 69 74 68 6b 64 69 73 70 6c 61 79 4e 61 6d
0144: 65 66 6a 73 6d 69 74 68 04 81 a2 63 61 6c 67 26
0160: 64 74 79 70 65 6a 70 75 62 6c 69 63 2d 6b 65 79
0176: 07 a1 62 75 76 f5
fido_rx: d=0x564f8d40d8c0, cmd=0x10, buf=0x7ffe9a7d3030, count=2048, ms=-1
rx_preamble: initiation frame at 0x7ffe9a7d2f60
0000: 00 09 00 0f 90 00 01 2b 00 00 00 00 00 00 00 00
0016: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0032: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0048: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
rx: payload_len=1
fido_rx: buf=0x7ffe9a7d3030, len=1
0000: 2b
cbor_parse_reply: blob[0]=0x2b
fido_dev_make_cred_rx: parse_makecred_reply
cred: fido_makecred: FIDO_ERR_UNSUPPORTED_OPTION (0x2b)
@Nesuma Nesuma added the bug report Something isn't working label Jul 14, 2020
@martelletto
Copy link
Contributor

martelletto commented Jul 14, 2020 via email

@Nesuma
Copy link
Author

Nesuma commented Jul 14, 2020

But how can the token not support to not verify the user? I just tried some of the demos from this list again and on my Windows machine, when I choose user verification: discouraged it still asks for my PIN and only works after I enter it. On my Linux machine it works to register on these demo websites without being asked for a pin. Therefore the token can be used without the PIN... It doesn't make sense for me at all now

@martelletto
Copy link
Contributor

martelletto commented Jul 14, 2020 via email

@martelletto
Copy link
Contributor

Sorry, forgot to conclude: your Windows browser is talking FIDO2 to the key, while your Linux browser is talking U2F to the key.

@Nesuma
Copy link
Author

Nesuma commented Jul 15, 2020

Ok that explains the behaviour. So all in all libifido is working correctly but it is not possible to use a Yubikey 5 over FIDO2 without a PIN and my only option is to use U2F or a different token if I don't want to use PINs. Thank you for your help

Edit: Another error on my side, there are two PINs, one is used for personal identity verification (piv) and the other one is used for FIDO2, on which my problem depends. Using Yubicos tools ykman to reset the PIV-PIN restores a default PIN, resetting the FIDO2 Pin sets no PIN. Without a FIDO2 PIN asking the authenticator for info returns noclientPin (with libifido2: fido-token -I ) and so far I can now successfully register and authenticate without a PIN.

@Nesuma Nesuma closed this as completed Jul 15, 2020
@Nesuma
Copy link
Author

Nesuma commented Jul 15, 2020

I just realized that I didn't understand that the PIN and user verification aren't belonging together. Setting uv to true or false doesn't toggle the PIN because the PIN is depending on the option clientPin, a different part of CTAP2.

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

No branches or pull requests

2 participants