Skip to content

CLI Truncated Tag Authentication fix#222

Closed
ikkebr wants to merge 2 commits intogoogle:masterfrom
ikkebr:master
Closed

CLI Truncated Tag Authentication fix#222
ikkebr wants to merge 2 commits intogoogle:masterfrom
ikkebr:master

Conversation

@ikkebr
Copy link
Copy Markdown

@ikkebr ikkebr commented Mar 31, 2026

The CLI verify command accepts truncated authentication tags of arbitrary length, including a single byte. The verification routine base64url-decodes the user-supplied --tag argument and uses the decoded length as the comparison length for CRYPTO_memcmp(). No minimum tag length is enforced. An attacker supplying a 1-byte tag only needs to match the first byte of the real tag.

ikkebr added 2 commits March 31, 2026 09:32
No minimum tag length was enforced. A user supplying a 1-byte tag only needed to match the first byte of the real tag, reducing the authentication check to a 1-in-256 brute-force
Prevented Truncated Tag comparison
@burgerdev
Copy link
Copy Markdown
Collaborator

Hi @ikkebr,

there may be a misunderstanding here, this is actually working as intended.

When using the CLI, you are in full control of the arguments you pass to it, and can verify any sort of requirements externally, keeping the (C) implementation simple. Anyway, forcing the full tag length is definitely not how it's intended to be used - you'd usually want to check something like 4 bytes. This is what's implemented in the glome-login CLI and in the PAM module, where we're directly dealing with attacker-supplied data and have no means to implement external checks.

You might be interested in the Rust CLI, which is about to replace the C CLI (#221) and has an additional flag with which you can enforce a minimum length.

/// Minimum tag length
///
/// Ideally a multiple of 4, defaults to 10 matching the
/// MIN_ENCODED_AUTHCODE_LEN in login/login.h.
/// Must be at least 2 and will be increased to 2 if the argument is lower.
#[arg(long, value_name = "n", default_value_t = 10)]
min_tag_length: u8,

Cheers, Markus

@burgerdev burgerdev closed this Apr 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants