Skip to content

Commit

Permalink
docs(contracts): OZ-M01 Malicious User Can Increase the Gas Cost of V…
Browse files Browse the repository at this point in the history
…erification (#1135)

Co-authored-by: HAOYUatHZ <[email protected]>
  • Loading branch information
zimpha and 0xmountaintop authored Mar 5, 2024
1 parent 6c50e6e commit 8a4645e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/libraries/verifier/ZkTrieVerifier.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ library ZkTrieVerifier {
/// | 1 byte | ... | 1 byte | ... |
/// | account proof length | account proof | storage proof length | storage proof |
/// ```
///
/// Possible attack vector:
/// + Malicious users can influence how many levels the proof must go through by predicting addresses
/// (or storage slots) that would branch the Trie until a certain depth. Even though artificially
/// increasing the proof's depth of a certain account or storage will not cause a DoS scenario, since
/// the depth can still reach the maximum depth size in the worst-case scenario, artificially increasing
/// the proof's depth will increase the number of iterations the `walkTree` method has to perform in order
/// to reach the respective leaf. If protocols that use this verifier limit the gas used on-chain to perform
/// such a verification (to a reasonable value), then a malicious user might be able to increase it for a
/// particular transaction by reaching a similar hashed key to a certain depth in the Trie.
function verifyZkTrieProof(
address poseidon,
address account,
Expand Down

0 comments on commit 8a4645e

Please sign in to comment.