Safe Smart Accounts is the most audited and battle-tested smart contract on Ethereum, protecting over $100 billion in assets. Safe Social Recovery Module is a subcomponent of the wallet that allows you to recover access to your wallet if your wallet keys are lost.
Safe was first implemented on Ackee Blockchain to conduct a security review of the Safe Social Recovery Module. Candid This is a two-day engineering schedule from June 6 to June 14, 2024.
methodology
We started our review using static analysis tools. Stay awake. Then we dug deep into the logic of the contract. We used the Wake test framework for testing and fuzzing.
During our review, we paid special attention to the following:
- Verifying the recovery mechanism cannot be bypassed.
- Verify that the system’s arithmetic is correct;
- Detects possible reentrancy in your code.
- Ensure that access control is neither too lax nor too strict.
- I’m looking for general issues like data validation.
With fuzz testing, we created a differential model of the system in Python and defined several flows that executed all the functions and branches of the code. During execution, we verified certain assertions and checked the following invariants between the flows.
- The guardian in the contract state matches the test model.
- The owner of the contract state matches the test model.
- The guardian threshold of the contract state does not exceed the number of guardians in the test model.
- In the contract state, the threshold of owners does not exceed the number of owners of the test model.
range
An audit was performed on the commit. e6d45c8
The exact scope is the following files:
- Contract/Module/SocialRecovery/SocialRecoveryModule.sol
- Contract/Modules/Social Recovery/Storage/GuardianStorage.sol
result
Here we present our research findings.
Critical severity
No serious problems were found.
High severity
No high severity issues were found.
Medium severity
M1: You can take ownership of your wallet using other modules.
Low severity
No low severity issues were found.
Warning Severity
W1: Verified hashes are stored in the repository.
Information Severity
No information severity issues were found.
conclusion
Our review resulted in two findings, ranging from warning to medium severity. The most severe issue is the possibility of restoring wallets from other modules (see M1 issue). The codebase is overall of very high quality.
Ackee Blockchain safely recommends:
- Addresses all reported issues.
Ackee Blockchain’s full security audit report, including a more detailed explanation of all findings and recommendations, can be found here.
We were very pleased to conduct the audit with Safe and look forward to continuing our collaboration in the future.