-
Notifications
You must be signed in to change notification settings - Fork 55
Fix soundness vulnerability: bind public input to FS transcript #315
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
The GKR + PCS protocol did not bind public_input to the Fiat-Shamir transcript, allowing a malicious prover to forge proofs by adapting the public input after seeing the challenges. This fix adds public_input hashing to the transcript in: - Rust prover (gkr/src/prover/snark.rs) - Rust verifier (gkr/src/verifier/snark.rs) - Go recursive verifier (recursion/modules/verifier/verifier.go) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Summary of ChangesHello @niconiconi, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves a significant soundness vulnerability within the GKR+PCS proof system. By ensuring that public inputs are properly bound to the Fiat-Shamir transcript early in the proof generation and verification process, it eliminates a critical attack vector. This enhancement prevents malicious actors from exploiting a linear relationship between public inputs and sumcheck errors to forge proofs, thereby bolstering the cryptographic security and integrity of the system. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request addresses a critical soundness vulnerability by binding the public input to the Fiat-Shamir transcript. The changes are applied consistently across the Rust prover, Rust verifier, and Go recursive verifier, and appear to correctly fix the issue. My review found the implementation to be correct. I have one suggestion for the Rust verifier to refactor a small piece of duplicated code to improve maintainability.
| // Bind public input to the FS transcript to prevent malleability attacks | ||
| for v in public_input { | ||
| transcript.append_field_element(v); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic to bind the public input to the transcript is duplicated in the par_verify function (lines 320-323). To improve maintainability and avoid code duplication, consider extracting this logic into a private helper function.
For example, you could add a helper function to Verifier:
fn bind_public_input_to_transcript(
transcript: &mut Cfg::TranscriptConfig,
public_input: &[<Cfg::FieldConfig as FieldEngine>::SimdCircuitField],
) {
// Bind public input to the FS transcript to prevent malleability attacks
for v in public_input {
transcript.append_field_element(v);
}
}Then, you can call it from both verify and par_verify like this:
Self::bind_public_input_to_transcript(&mut transcript, public_input);- Update download URLs from GCS to GitHub Releases format - Add -L flag to wget for redirect support (required for GitHub) - Add workflow to generate and upload test data to releases - Add script for local test data generation The test data will be hosted at: https://github.com/PolyhedraZK/Expander/releases/download/testdata-v1/ To populate the release, run the "Generate and Upload Test Data" workflow manually after merging this PR. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Summary
public_inputwas not bound to the Fiat-Shamir transcriptpublic_inputhashing to the transcript before any challenges are generatedChanges
Rust Prover (
gkr/src/prover/snark.rs):c.public_inputinto transcript after creation, before PCS commitRust Verifier (
gkr/src/verifier/snark.rs):public_inputinto transcript in bothverifyandpar_verifyfunctionsGo Recursive Verifier (
recursion/modules/verifier/verifier.go):public_inputinto transcript inVerifyfunctionTest plan
cargo check --all)go build ./...)🤖 Generated with Claude Code