hats-finance / Fenix-Finance-0x83dbe5aa378f3ce160ed084daf85f621289fb92f

0 stars 0 forks source link

Wrong `DOMAIN_TYPEHASH` definition #17

Open hats-bug-reporter[bot] opened 4 months ago

hats-bug-reporter[bot] commented 4 months ago

Github username: @Rotcivegaf Twitter username: rotcivegaf Submission hash (on-chain): 0x778dc107b91369f0e44e5fbd99b51edb2d9d32d27731be2f41e4e609d6f6dbd7 Severity: medium

Description: Lines:

Description:

In the build of the DOMAIN TYPEHASH the string version is forgotten, but the delegateBySig function, build the domainSeparator with the keccak256(bytes(version))

This broke the EIP 712, and the delegateBySig function

Attack Scenario:

Some contract or dapp/backend could building the DOMAIN_TYPEHASH with "right" struct(include the version) and try to use the delegateBySig function but this function will revert in the with the message "VotingEscrow::delegateBySig: invalid signature" because the expect DOMAIN_TYPEHASH in the VotingEscrow.sol contract was built with the "wrong" struct

Recommended Mitigation Steps:

Acording the EIP 712, in the Definition of domainSeparator:

Add string version, to the EIP712Domain string:

@@ -1113,7 +1113,7 @@ contract VotingEscrowUpgradeable is
     //////////////////////////////////////////////////////////////*/

     /// @notice The EIP-712 typehash for the contract's domain
-    bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
+    bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)");
BohdanHrytsak commented 4 months ago

Thank you for the submission.

This issue is inherited from Thena and is independent of the changes we made, which makes it OOS.

(Possibly to be revised)

rotcivegaf commented 4 months ago

Will it be revised?

BohdanHrytsak commented 4 months ago

Since it is inherited from Thena/Chronos, and does not have critical consequences, but only to incorrectness in the construction of signatures, it remains outside the scope due to insufficient impact to be recognized in the scope