Skip to content

Commit

Permalink
Check for Double Initialization (#436)
Browse files Browse the repository at this point in the history
The test/example Safe signer launchpad pattern in the ERC-4337 module
directory did not contain an important security check preventing double
initialization which could lead to an account being taken over.

In order to better document the security requirements for such a
contract, we added the double initialization check to the pre-validation
setup.

Huge kudos to Ackee Blockchain for bringing this to our attention
:muscle:.
  • Loading branch information
nlordell authored Jun 12, 2024
1 parent 9a18245 commit d90b57d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions modules/4337/contracts/test/TestSafeSignerLaunchpad.sol
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ contract TestSafeSignerLaunchpad is IAccount, SafeStorage {
receive() external payable {}

function preValidationSetup(bytes32 initHash, address to, bytes calldata preInit) external onlyProxy {
require(_initHash() == bytes32(0), "Already initialized");
_setInitHash(initHash);
if (to != address(0)) {
(bool success, ) = to.delegatecall(preInit);
Expand Down

0 comments on commit d90b57d

Please sign in to comment.