Closed code423n4 closed 1 year ago
gzeon-c4 marked the issue as primary issue
lack of proof
as transactions do go through properly.
livingrockrises marked the issue as sponsor acknowledged
@tomarsachin2271
livingrockrises requested judge review
gzeon-c4 changed the severity to QA (Quality Assurance)
gzeon-c4 marked the issue as grade-b
Actually @gzeon-c4 , it's indeed implemented as it should. Please invalidate my issue.
gzeon-c4 marked the issue as grade-c
Actually @gzeon-c4 , it's indeed implemented as it should. Please invalidate my issue.
Thanks for the confirmation, just re-read https://eips.ethereum.org/EIPS/eip-712#rationale-for-typehash and confirm it is implemented correctly.
Lines of code
https://github.com/code-423n4/2023-01-biconomy/blob/main/scw-contracts/contracts/smart-contract-wallet/SmartAccount.sol#L45-L48 https://github.com/code-423n4/2023-01-biconomy/blob/main/scw-contracts/contracts/smart-contract-wallet/SmartAccount.sol#L424-L446 https://github.com/code-423n4/2023-01-biconomy/blob/main/scw-contracts/contracts/smart-contract-wallet/SmartAccount.sol#L435
Vulnerability details
Impact
The type hash used for encoding and decoding AccountTx signatures in the
SmartAccount
wallet is correct but is not encoded the same way than how the type hash was generated. It is likely to confuse anybody interacting with their smart wallet and is also non-EIP712 compliant.Proof of Concept
See the following Rationale about the
typehash
for EIP712 signatures: https://eips.ethereum.org/EIPS/eip-712#rationale-for-typehashAn example of a typehash implemented in Solidity:
Which is then encoded like so:
In the
SmartAccount
contract, theMAIL_TYPEHASH
translates as theACCOUNT_TX_TYPEHASH
and thehashStruct()
function can be seen as theencodeTransactionData()
function.The issue is that the
ACCOUNT_TX_TYPEHASH
is not implemented correctly. In theencodeTransactionData()
function.The transaction data, which have the
byte
type is hashed using thekeccak256
method. On the other hand, the typehash don't use the same type returned from thekeccak256
which isbytes32
.Tools Used
Manual inspection
Recommended Mitigation Steps
Don't hash the transaction data in the
encodeTransactionData()
so that it respects theACCOUNT_TX_TYPEHASH
.