Skip to content

Reject zero-length AEAD authentication tags (GH #1364) - #1365

Open
Coralesoft wants to merge 1 commit into
weidai11:masterfrom
Coralesoft:fix/issue-1364-zero-length-tags
Open

Reject zero-length AEAD authentication tags (GH #1364)#1365
Coralesoft wants to merge 1 commit into
weidai11:masterfrom
Coralesoft:fix/issue-1364-zero-length-tags

Conversation

@Coralesoft

@Coralesoft Coralesoft commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Fixes #1364.

GCM, EAX, CCM, ChaCha20-Poly1305, and XChaCha20-Poly1305 accepted zero-length authentication tags through the one-shot APIs and authenticated filters. EncryptAndAuthenticate produced no tag, and DecryptAndVerify could report tampered ciphertext as authentic. Reject a zero tag size in AuthenticatedSymmetricCipherBase::TruncatedFinal, which every affected path reaches during finalisation.

The one-shot APIs process the message before finalisation, so output buffers may already contain data when the exception is thrown. Callers must discard that output.

The reporter's reproducer finds both affected cases before this change and none after it. Valid-tag controls still pass.

GCM, EAX, CCM, ChaCha20-Poly1305, and XChaCha20-Poly1305 accepted zero-length authentication tags through EncryptAndAuthenticate, DecryptAndVerify, and the authenticated filters. Verification with a zero-length tag could report tampered ciphertext as authentic.

Reject a zero tag size in AuthenticatedSymmetricCipherBase::TruncatedFinal, which all five algorithms and both filter paths reach during finalisation.
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.

Crypto++ AEAD APIs accept zero-length authentication tags and report modified ciphertext as valid

1 participant