Closed c4-bot-3 closed 7 months ago
saxenism (sponsor) disputed
Considered invalid
because the signed version can not contain signature.
The Warden specifies that the TransactionHelper
violates the EIP-712 specification; this is incorrect as the specification does not concern itself with the actual underlying data structure; only with the arguments hashed and the type-hash utilized alongside those arguments.
As the type-hash matches the arguments hashed in the TransactionHelper::_encodeHashEIP712Transaction
function, no incompatibility with the standard is observed. Moreover, introducing the signature
as part of both the type-hash and the aforementioned function is incorrect given that a signature cannot sign itself.
alex-ppg marked the issue as unsatisfactory: Invalid
Lines of code
https://github.com/code-423n4/2024-03-zksync/blob/4f0ba34f34a864c354c7e8c47643ed8f4a250e13/code/system-contracts/contracts/libraries/TransactionHelper.sol#L84-L87 https://github.com/code-423n4/2024-03-zksync/blob/4f0ba34f34a864c354c7e8c47643ed8f4a250e13/code/system-contracts/contracts/libraries/TransactionHelper.sol#L25-L71 https://github.com/code-423n4/2024-03-zksync/blob/4f0ba34f34a864c354c7e8c47643ed8f4a250e13/code/system-contracts/contracts/libraries/TransactionHelper.sol#L118-L136
Vulnerability details
Impact
According to EIP-712 spec, the typehash should contain all the fields defined in the struct. The current implementation of
EIP712_TRANSACTION_TYPE_HASH
, however, misses thesignature
field.Proof of Concept
File: TransactionHelper.sol
EIP712_TRANSACTION_TYPE_HASH
is defined as above.File: TransactionHelper.sol
While struct
Transaction
is defined as above.We can clearly see, that
signature
field defined inTransaction
struct is not defined in theEIP712_TRANSACTION_TYPE_HASH
.Moreover, when we'll examine
_encodeHashEIP712Transaction()
function - thesignature
is also missing there.File: TransactionHelper.sol
Tools Used
Manual code review
Recommended Mitigation Steps
Add missing
signature
field.Assessed type
Other