Sparkn

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

Race condition between owner and organizer. Same contest can be distributed by owner and organizer by signature if contest is expired.

Summary

Signature has been signed before expiration date, but relayer might have submitted it after expiraton date.

But owner has already distributed prize, so organizer's prize decision is ignored.

Vulnerability Details

function deployProxyAndDistributeBySignature(
address organizer,
bytes32 contestId,
address implementation,
bytes calldata signature,
bytes calldata data
) public returns (address) {
bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(contestId, data)));
if (ECDSA.recover(digest, signature) != organizer) revert ProxyFactory__InvalidSignature();
bytes32 salt = _calculateSalt(organizer, contestId, implementation);
if (saltToCloseTime[salt] == 0) revert ProxyFactory__ContestIsNotRegistered();
if (saltToCloseTime[salt] > block.timestamp) revert ProxyFactory__ContestIsNotClosed();
address proxy = _deployProxy(organizer, contestId, implementation);
_distribute(proxy, data);
return proxy;
}

Impact

Race condition between owner and organizer.

Tools Used

Manual Review

Recommendations

Should lock prize money for fixed period after distribution.

During that time, organizer should be able to override owner's decision.

Support

FAQs

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