Skip to content

crypto/ecies: fix panic on short ciphertext in symDecrypt#33753

Closed
BZO95 wants to merge 1 commit intoethereum:masterfrom
BZO95:crypto-ecies-length-check
Closed

crypto/ecies: fix panic on short ciphertext in symDecrypt#33753
BZO95 wants to merge 1 commit intoethereum:masterfrom
BZO95:crypto-ecies-length-check

Conversation

@BZO95
Copy link
Copy Markdown
Contributor

@BZO95 BZO95 commented Feb 4, 2026

Adds length check before slicing ciphertext in symDecrypt, prevents panic when ct is shorter than block size.

@BZO95
Copy link
Copy Markdown
Contributor Author

BZO95 commented Feb 4, 2026

flaky test

@fjl
Copy link
Copy Markdown
Contributor

fjl commented Feb 4, 2026

Is this condition still reachable? We recently extended a bounds check earlier in Decrypt that should prevent this from triggering. This fix looks good to me, and I'd merge it regardless, just trying to assess whether this is actually possible.

@BZO95
Copy link
Copy Markdown
Contributor Author

BZO95 commented Feb 5, 2026

@fjl Thanks for the review! I added it for defense-in-depth since this handles untrusted crypto input. The check is cheap and makes preconditions explicit, but happy to remove if you prefer.

@rjl493456442
Copy link
Copy Markdown
Member

It's a private function and is only invoked by the Decrypt.

We have the validation performed there and the input is regarded as trusted.

@BZO95
Copy link
Copy Markdown
Contributor Author

BZO95 commented Feb 5, 2026

@rjl493456442 Got it, closing this PR since the check isn't needed. Thanks!

@BZO95 BZO95 closed this Feb 5, 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.

3 participants