Sparkn

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

Incorrect encoding of the `data` field in EIP712 digest

Summary

EIP712 specifies that "The dynamic values bytes and string are encoded as a keccak256 hash of their contents."
But argument bytes data is not hashed. It breaks compatibility with EIP712

Vulnerability Details

Here you can see that bytes calldata data is not hashed when calculate digest

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)));
...
}

Impact

Hash is not EIP712 compatible

Tools Used

Manual Review

Recommendations

- bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(contestId, data)));
+ bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(contestId, keccak256(data))));

Support

FAQs

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