You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The code above can be translated to the following constraints:
// kr is short for challenges.keccak_input()
// padding_zero = kr^93
if i < 93: input_bytes_acc[i] = garbage_bytes[i];
if 93 <= i < 96: input_bytes_acc[i] = garbage_bytes[i] + input[i] // vulnerability here
if i >= 96: input_bytes_acc[i] = input[i]
In the example, it means
0x21 = garbage_bytes[93] + input[93]: we can set input[93] to any byte that we want.
The text was updated successfully, but these errors were encountered:
So we should not put the "valid bytes" at the right-end and expect the bytes beyond valid is 0
For example, consider we have a N bytes segment and only m bytes in it is valid (m is dynamic)
Currently we put the m bytes at the right end of N bytes like [ 0 .... 0 <m bytes>]
and calculate the rlc = <RLC of the other> * (R**m) + <RLC of N bytes>, which is not sound
But we can put m bytes at left end: [<m bytes> 0 .... 0]
and calculate the rlc = (R**(m-n) *(<RLC of the other> * (R**N) + <RLC of N bytes>)
An example case:
I.e. the input bytes are as follows (note that we always right-pad the real input with 0 to have length 192)
That is, we have call_data_length = 96 + 3 = 99.
zkevm-circuits/zkevm-circuits/src/evm_circuit/execution/precompiles/modexp.rs
Lines 787 to 792 in 517127f
The code above can be translated to the following constraints:
In the example, it means
0x21 = garbage_bytes[93] + input[93]
: we can setinput[93]
to any byte that we want.The text was updated successfully, but these errors were encountered: