Sparkn

CodeFox Inc.
DeFiFoundryProxy
15,000 USDC
View results
Submission Details
Severity: medium

The `deployProxyAndDistributeByOwner` and `distributeByOwner` miss an important check

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();
// require(saltToCloseTime[salt] == 0, "Contest is not registered");
// require(saltToCloseTime[salt] < block.timestamp + EXPIRATION_TIME, "Contest is not expired");
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();
// distribute only when it exists and expired
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();

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.