adr1anh
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    3
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # Issue with public inputs Let's assume our R1CS shape has $2^n$ variables, $\ell$ public inputs (including the initial 1, or $u$), and $2^m$ constraints, where $\ell < 2^n$. Take $N = \max\{2^{n+1}, 2^m\}$ as the size of the public parameters. Our witness is the vector $W \in \mathbb{F}^{2^{n}}$ considered as a multilinear polynomial in $n$ variables $W(X_0,\ldots,X_{n-1})$. We define $P(X_0,\ldots,X_{n-1})$ as the MLE of the $\ell$ public inputs. From this, we construct the $Z \in \mathbb{F}^{2^{n+1}}$ vector where its MLE has $n+1$ variables $$ Z(X_0,X_1,\ldots,X_{n}) = (1-X_0)\cdot W(X_1,\ldots,X_{n}) + X_0\cdot P(X_1,\ldots,X_{n}) $$ Consider that $W,P$ are valid solutions, but the prover wants to use a malicious output $\tilde{P} \in \mathbb{F}^\ell$. We can craft a malicious $\tilde{W}$ as $$ \tilde{W}(X_0,\ldots, X_{n}) = (1-X_0)\cdot W(X_1,\ldots,X_{n}) + X_0\cdot P(X_1,\ldots,X_{n}) - X_0 \cdot \tilde{P}(X_1,\ldots,X_{n}) $$ The evaluation list of $\tilde{W}$ is represented as $W$ concatenated with $P - \tilde{P}$, for a length of $2^{n}+\ell$. It's easy to commit to this polynomial since our commitment key supports larger vectors. Notice that the corresponding $\tilde{Z}$ is equal to $Z$ since the $\tilde{P}$ component cancels out. The prover returns the malicious evaluation of $W$ $$ e_{\tilde{W}} = \frac{(1-r_0)\cdot e_W + r_0\cdot (e_P - e_{\tilde{P}})}{1-r_0} $$ The verifier computes the evaluation of $Z$ to verify the Sumcheck $$ e_Z = (1-r_0)\cdot e_{\tilde{W}} + r_0 \cdot e_{\tilde{P}} = (1-r_0)\cdot e_{W} + r_0 \cdot e_{P} $$ such that the evaluation matches. If the PCS verifying the evaluations from Sumcheck does not enforce that $W$ has at most $2^{n}$ values, and instead batches it with other evaluations by considering $W'(X_0,\ldots,X_n) = (1-X_0)W(X_1,\ldots,X_n)$ and shifting the evaluation by the first Lagrange polynomial $e_W' = (1-r_0)e_W$, then the verifier will validate the opening of the malicious $e_{\tilde{W}}$. ## Why this attack works The problem comes from the fact that the evaluation $e_W$ is sent to the verifier after the verifier sends the Sumcheck challenge $r_0$. This allows an attacker to compute the malicious evaluation which will pass the Sumcheck, and will be valid as an evaluation of a polynomials with $2^{n+1}$ variables. In this particular case, there is no check ensuring that $|W| < 2^n$, which could be enforced either through the PCS, or via another Sumcheck invocation. ## Impact In the SNARK without pre-processing, all evaluations from the outer and inner instances are batched by invoking another instance of the Sumcheck protocol. This latter instance applies padding to the $W$ and $E$ vectors to ensure the evaluations $e_W$ and $e_E$ are for the points $r_y[1..]$ and $r_x$ respectively. This acts as a degree check, as long as the PCS ensures that both vectors have length at most $\max\{2^{n}, 2^m\}$. Therefore, it is not affected by this attack. For the pre-processing SNARK however, all Sumcheck instances are padded to $N = \max\{2^{m}, 2\cdot 2^{n}, |A| + |B| + |C|\}$, and batched together. Since there is no "evaluation-batching" Sumcheck instance at the end, there is no guarantee that $W$ is not defined to cancel out the public input, allowing an attacker to create a fraudulent proof for any public inputs of their choice. ## Fix We describe 3 different way of fixing this issue, each with a different cost. ### Opening $W$ at the correct point The simplest approach to solving the problem is to use another invocation of the PCS opening protocol, where $W \in 2^{n}$ is opened at the last $n$ challenges of $\vec{r}$ from the Sumcheck. This is the solution implemented in the Nova repo in [PR 274](https://github.com/microsoft/Nova/pull/274)after we report the issue. Unfortunately, it has a big impact on performance in terms of prover/verifier time and proof size, since the PCS opening arguments makes up a large portion of the proof complexity. ### Batched PCS Reduction with Sumcheck We can solve the issue in the same way as is done with the non pre-processing SNARK, where we use another Sumcheck invocation to batch all PCS opening queries at different points, and reduce them to queries at the same common point defined by the Sumcheck randomness. Computationally this is cheaper for the prover since there are no additional commitments involved. It does however increase the proof size by $O(\log{N})$ field elements, and the verifier will need to compute as many additional hashes for Fiat-Shamir. ### Bounded Witness Sumcheck The witness vector $W$ is used as part of the `MemorySumcheck` which is defined over vectors of size $N$. It is defined as Therefore, we need to ensure that $W$ is zero in the range $[2^n, \ldots, N-1]$, so that the concatenation with public inputs $X$ does not overlap. This approach involves adding another claim to the batched Sumcheck instead and checking $W$ directly, rather than checking its evaluation produced by Sumcheck. The main idea is to prove that a random linear combination of the elements of $W$ in the range $[2^n,\ldots,N-1]$ equals 0. To do so, we construct a special $\mathsf{eq}$ polynomial over $\log N$ variables, which equals 0 in the first $2^n$ evaluations, but corresponds to the usual definition on the other points. It's exact definition is given by the multi-linear polynomial $\mathsf{eq}_{\leq \log N}(\vec{\tau}, \vec{X})$ over $\log N$ variables, using a random point $\vec{\tau} \in \mathbb{F}^{\log N}$: $$ \mathsf{eq}(\vec{\tau}, \vec{X}) - \left(\prod_{i=0}^{\log N - n -1} (1-\tau_i)(1-X_i)\right)\left(\prod_{i=\log N - n}^{\log N -1} (1-\tau_i)(1-X_i) + \tau_i\cdot X_i\right) $$ It is easy to check that this polynomial vanishes when $\vec{X} = (0,\ldots,0,X_{\log{N}-n},\ldots,X_{\log{N}-1})$, corresponding the first $2^n$ points of the boolean hypercube. When any of the first $\log N - n$ entries are 1, then the second component vanishes and the polynomial is equal to $\mathsf{eq}(\vec{\tau}, \vec{X})$. The memory Sumcheck instance is required to consider its input polynomials over $\log(N)$ variables. Currently it uses the vector $Z$ directly, and we run into the issue described above. We would like to ensure that $|W| < 2^n$. To do so, we need to add the following claim to the instance: $$ 0 = \sum_{\vec{x} \in \{ 0,1 \}^{\log(N)}} \mathsf{eq}_{\leq \log N}(\vec{\tau}, \vec{x}) \cdot W(\vec{x}) = \sum_{\stackrel{\vec{x} \in \{ 0,1 \}^{\log(N)}}{(x_0,\ldots,x_{\log N - n -1})} \neq\vec{0}} \mathsf{eq}(\vec{\tau}, \vec{x}) \cdot W(\vec{x}). $$ The right-hand side shows that we are indeed proving that a random linear combination of $W[2^n,\ldots, N-]$ is 0. This approach does not increase the proofs size, and marginally increases the prover/verifier costs since the claim is proved using the existing batched Sumcheck instance.

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully