Skip to content

fix: validate cipher blocks and derivation parameters - #1035

Merged
andiwand merged 2 commits into
mainfrom
review/17-crypto-blocks
Oct 5, 2026
Merged

andiwand merged 2 commits into
mainfrom
review/17-crypto-blocks

Conversation

@andiwand

@andiwand andiwand commented Oct 4, 2026 •

Copy link
Copy Markdown
Member

🤖 Generated with Claude Code

Malformed AES and Triple-DES input can reach Crypto++ release-mode block operations with incomplete blocks. Validate the mandatory block size in one shared processing helper, removing the duplicated wrappers. Reject PBKDF2 iteration counts and Argon2 lengths that would be truncated by their APIs.

Validation: 35 targeted crypto, PDF encryption, legacy Office encryption, and document-file tests pass, including partial-block rejection and known AES/PBKDF2 results.

@andiwand
andiwand force-pushed the review/16-cfb-ownership branch from acb9369 to 56ae165 Compare October 4, 2026 21:11
Base automatically changed from review/16-cfb-ownership to main October 4, 2026 21:12
andiwand and others added 2 commits October 4, 2026 23:12
The shared block check now throws for a partial last block. In a PDF,
that error is not caught per object, so one damaged string stopped the
whole document. Before, Crypto++ decrypted the whole blocks and left the
partial block as zero bytes. The decryptor now passes only the whole
blocks after the IV, so the out-of-bounds read stays fixed and the
whole blocks still decrypt. The AES-V2 and AES-V3 paths share the helper.

A crypto test also confirms that Blowfish CFB, a stream mode, accepts
any length, because an ODF Blowfish stream has no block alignment.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gb1fLafqqzehpqPuU6uBfn
@andiwand
andiwand force-pushed the review/17-crypto-blocks branch from 2728d90 to 44e177f Compare October 4, 2026 21:18
@andiwand
andiwand merged commit a7c6838 into main Oct 5, 2026
36 checks passed
@andiwand
andiwand deleted the review/17-crypto-blocks branch October 5, 2026 05:49
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.

1 participant