Summary
The deployProxyAndDistributeByOwner
and distributeByOwner
miss require check and could be triggered at incorrect timestamps.
Vulnerability Details
The deployProxyAndDistributeByOwner
and distributeByOwner
miss require check and could be triggered at incorrect timestamps.
if (saltToCloseTime[salt] > block.timestamp) revert ProxyFactory__ContestIsNotClosed();
Please check the following functions:
function deployProxyAndDistributeByOwner(
address organizer,
bytes32 contestId,
address implementation,
bytes calldata data
) public onlyOwner returns (address) {
bytes32 salt = _calculateSalt(organizer, contestId, implementation);
if (saltToCloseTime[salt] == 0) revert ProxyFactory__ContestIsNotRegistered();
if (saltToCloseTime[salt] + EXPIRATION_TIME > block.timestamp) revert ProxyFactory__ContestIsNotExpired();
address proxy = _deployProxy(organizer, contestId, implementation);
_distribute(proxy, data);
return proxy;
}
and
function distributeByOwner(
address proxy,
address organizer,
bytes32 contestId,
address implementation,
bytes calldata data
) public onlyOwner {
if (proxy == address(0)) revert ProxyFactory__ProxyAddressCannotBeZero();
bytes32 salt = _calculateSalt(organizer, contestId, implementation);
if (saltToCloseTime[salt] == 0) revert ProxyFactory__ContestIsNotRegistered();
if (saltToCloseTime[salt] + EXPIRATION_TIME > block.timestamp) revert ProxyFactory__ContestIsNotExpired();
_distribute(proxy, data);
}
Impact
Missing checks could allows triggering function at incorrect times / EVM states.
Tools Used
Manual
Recommendations
Add the missing check:
if (saltToCloseTime[salt] > block.timestamp) revert ProxyFactory__ContestIsNotClosed();