Sparkn

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

Use Native Account Abstraction over ecrecover for Validation

Summary

Use native account abstraction over ecrecover for validation.

Vulnerability Details

By reviewing the documentation, it is understood that the contracts should be deployed to any EVM-compatible chains. If the contracts are to be deployed to zksync, we need to take into account additional security concerns. Let's delve into the "Security and Best Practices" guidelines provided by zksync.
https://era.zksync.io/docs/dev/building-on-zksync/best-practices.html#use-native-account-abstraction-over-ecrecover-for-validation

Use zkSync Era's native account abstraction support for signature validation instead of this function.
We recommend not relying on the fact that an account has an ECDSA private key, since the account may be governed by multisig and use another signature scheme.

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

If an account is managed by a multi-signature setup or employs alternative signature schemes, it could potentially introduce security vulnerabilities.

Tools Used

vscode

Recommendations

If the contract is deployed on zksync, it is recommended to use zkSync Era's native account abstraction support for signature validation instead of this function.

Support

FAQs

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

Give us feedback!