Sparkn

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

`ProxyFactory::deployProxyAndDistributeBySignature` function uses signature that do not have expiration

Summary

Signatures signed by the organizer in the deployProxyAndDistributeBySignature function lack an expiration timestamp, potentially leading to unauthorized access and misuse. A missing expiration timestamp allows the signed message to remain valid indefinitely, which enables the signer to retain control beyond the intended timeframe.

Vulnerability Details

The vulnerability arises from the absence of an expiration timestamp in the signature verification process within the deployProxyAndDistributeBySignature function. EIP-712, which is utilized for signature verification, does not inherently include an expiration date for signatures. This omission leaves the decision of implementing an expiration mechanism to the application layer or the contract itself.

Without an expiration parameter, a user who signs a message essentially grants a "lifetime license" to the signed action. In the context of the given code, this means that once an organizer signs a message to deploy a proxy and distribute prizes, the signature remains valid indefinitely. This allows the organizer to exercise control beyond the originally intended timeframe of the contest.

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

The absence of an expiration timestamp for signatures signed by organizers may lead to unauthorized access. Without an expiration mechanism, the signed message remains valid indefinitely, allowing the signer to retain control beyond the intended timeframe.

Tools Used

Manual Review

Recommendations

To mitigate this vulnerability, it is recommended to incorporate an expiration parameter within the signed message. By introducing a timestamp deadline, the contract can ensure that signatures have a limited validity period. This will help prevent long-term misuse and provide better control over the lifecycle of signed actions.

Support

FAQs

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