Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix critical bug: Assert valid padding #168

Merged
merged 7 commits into from
Feb 3, 2024
Merged

Conversation

0xSachinK
Copy link
Contributor

@0xSachinK 0xSachinK commented Feb 3, 2024

Bug

A malicious prover can insert a forged body hash in the padding. The current regex circuits will extract both the correct body hash and the forged body hash. The signature verification would still be performed on the correct body hash; thus the sig check would pass. But, the sha256 hash of the body would be compared to the forged body hash. This allows the malicious prover to fake the entire email body! The padding bug also allows a malicious prover to insert invalid body substrings in the body padding, thus forging parts of the body.

Fix

Asserts that input padded header AND body only contain 0's.

@0xSachinK 0xSachinK changed the title Aseert valid padding Assert valid padding Feb 3, 2024
Copy link
Member

@saleel saleel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@saleel saleel requested a review from Divide-By-0 February 3, 2024 19:31
@Divide-By-0
Copy link
Member

LGTM

@saleel saleel requested a review from Bisht13 February 3, 2024 19:44
@Divide-By-0 Divide-By-0 merged commit 54df5f8 into zkemail:main Feb 3, 2024
6 checks passed
@0xSachinK 0xSachinK changed the title Assert valid padding Fix critical bug: Assert valid padding May 18, 2024
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