fix: bounds check before slicing decrypted AES-CBC data#103
Open
travis-barnett wants to merge 1 commit intobrowserutils:masterfrom
Open
fix: bounds check before slicing decrypted AES-CBC data#103travis-barnett wants to merge 1 commit intobrowserutils:masterfrom
travis-barnett wants to merge 1 commit intobrowserutils:masterfrom
Conversation
For Chrome db version >= 24, decryptAESCBC strips 32 bytes of prefix padding from the decrypted data. If the decrypted value is shorter than the prefix padding (e.g. empty or very short cookie values), this causes a panic: slice bounds out of range [32:N] where N < 32. Add a bounds check to return an error instead of panicking, allowing the iterator to skip the bad cookie gracefully. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
This is a secondary edge case bug in the fix for #92 . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
For Chrome db version >= 24,
decryptAESCBCstrips 32 bytes of prefix padding from the decrypted data. If the decrypted value is shorter than the prefix padding (e.g. empty or very short cookie values), this causes a panic:This adds a bounds check to return an error instead of panicking, allowing the iterator to skip the bad cookie gracefully.
Change
Added a check before the final slice in
decryptAESCBC():This is a follow-up to commit 00fc21c which fixed the similar
crypto/cipher: input not full blockspanic.🤖 Generated with Claude Code