Skip to content

CTAP1 requests with no command data payload (eg: U2F_VERSION) are incorrectly encoded #190

@micolous

Description

@micolous

U2FAPDUHeader::serialize() incorrectly encodes Nc = 0 (zero command data length), which makes authenticator-rs incorrectly serialize U2F_VERSION requests.

This issue affects CTAP1-compatible authenticators on all transports (not just NFC).

Per FIDO v1.1 U2F Raw Message Formats and FIDO v1.2 U2F Raw Message Formats, when Nc = 0, there are no Lc bytes. This encoding is adapted from ISO 7816-4:2005 extended APDUs (section 5.1, "Command-response pairs").

For example, a U2F_VERSION request (which has no command data, so Nc = 0) with Ne = 65536 should be:

(CLA)00 (INS)03 (P1)00 (P2)00 (Le)00 00 00

But at present, authenticator-rs sends Lc bytes:

(CLA)00 (INS)03 (P1)00 (P2)00 (Lc)00 00 00 (Le)00 00

Confusingly, FIDO v1.0 incorrectly describes ISO 7816-4:2005 extended APDUs (it doesn't special-case Nc = 0, omits Le, and suggests Lc is a uint24be), and then FIDO v2.0 and v2.1 cite FIDO v1.2 framing while describing FIDO v1.0 framing in-line.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions