-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mitigate attacks on garbage collection
This PR consists of, essentially, 3 changes: 1. Instead of storing ciphertexts (and their metadata) starting at location `keccak256(ciphertext)`, store them at location `keccak256(keccak256(ciphertext))`. That makes it hard for malicious users to force garbage collection on arbitrary locations in protected storage (by deserializing arbitrary positions as metadata). 2. Flag locations that contain ciphertext handles in protected storage by setting a flag at location `keccak256(keccak256(loc))`. That ensures malicious users can't first persist a handle without it being honestly obtainded and then, after it has been honestly obtained and stored at another location, overwrite the first location and mess up the refcount of the honestly verified one. The location is hashed twice to avoid clashes with cihpertexts (and their metadata) in protected storage. Here, we assume that a well-formed ciphertext cannot be 32 bytes long and, hence, be a valid location. To have a clash, there needs to be a hash collision. 3. Remove explicit reseved protected storage slots. Since we now hash ciphertext handles (in change 1), it is hard for malicious users to force garbage collection of reserved slots. Note that these changes are backwards-incompatible with existing data on-chain and existing chains need to be restarted from genesis. See the section on `Privileged Storage` in the whitepaper for more information: https://github.com/zama-ai/fhevm/blob/main/fhevm-whitepaper.pdf Resolves #168.
- Loading branch information
1 parent
8181b69
commit 05fa59e
Showing
3 changed files
with
125 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.