-
Notifications
You must be signed in to change notification settings - Fork 200
fix: added missing range checks in ShaBytesDynamic #579
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
Conversation
* make contract sdk simpler * reduce root inputs * delete convert function * summarize our library * update npm package * update package version * update attestation id * add util function to get revealed data
This reverts commit 847b88d.
|
hey @ArmanKolozyan, nice catch! |
|
Thanks a lot for the quick response, and I just DMed you on Telegram! |
|
@remicolin Just wanted to let you know that I added the range check for |
This reverts commit 0c8c873.
This pull request adds a missing range check in the
ShaBytesDynamictemplate to address the vulnerability described in the following issue:The
Sha256Bytestemplate assumes that the input length (in_len_padded_bytes * 8) is constrained to fit withinceil(log2(8 * max_num_bytes))bits. However, this assumption is not enforced at the call sites in this project. In particular,in_len_padded_bytes * 8is passed to subtemplates likeSha256General, where it is used in comparison and selector logic without first constraining it to the required bitwidth.To fix this, we add an explicit
Num2Bitsconstraint onin_len_padded_bytes * 8insideShaBytesDynamic.This prevents potential overflow-based exploits that could bypass internal constraints and produce incorrect outputs while still satisfying the circuit.
Closes #578.