Impossibility to interact with other EIP-1271 smartcontract #132
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
duplicate-288
edited-by-warden
satisfactory
satisfies C4 submission criteria; eligible for awards
sponsor acknowledged
Technically the issue is correct, but we're not going to resolve it for XYZ reasons
Lines of code
https://github.com/code-423n4/2023-01-biconomy/blob/main/scw-contracts/contracts/smart-contract-wallet/interfaces/ISignatureValidator.sol#L19
https://github.com/code-423n4/2023-01-biconomy/blob/main/scw-contracts/contracts/smart-contract-wallet/SmartAccount.sol#L342
Vulnerability details
Impact
Impossibility of SCW smartaccount to sign messages, and to accept signed messages, with EIP-1271 smartcontracts :
SmartAccount.sol#L342 - ISignatureValidator.sol#L5-L6 - ISignatureValidator.sol#L19
Proof of Concept
Signature validation is not conformant with EIP-1271 :
signature validation is checked against a wrong value :
0x20c13b0b
instead of0x1626ba7e
== EIP1271_MAGIC_VALUE , so it's impossible for EIP-1271 conformant smartcontract to sign a transaction (viaexecTransaction
) on SCW smartaccountsignature by SCW smartaccount is not implemented: missing both some signature function (like
signMessage
in GnosisSafe) and EIP-1271ìsvalidSignature
implementationThese 2 lines ISignatureValidator.sol#L5-L6 are not EIP1271 conformant (interface and sighash) :
should be :
Tools Used
Manual review
Recommended Mitigation Steps
Current Biconomy signature validation is nethertheless compatible with GnosisSafe accounts, but as said by GnosisSafe themselves, they do not conform to standards :
The current version of the Safe contracts (1.3.0 8) is stable, but is not following all standards.
Anyway Biconomy could propose compatibility with both
GnosisSafe
andEIP-1271
, that can be done with :A1/ check of other smartcontracts, with EIP1271_MAGIC_VALUE
0x1626ba7e
and to be compatible with GnosisSafe also with other value0x20c13b0b
, something like that :A2/ with two interfaces functions in
ISignatureValidator.sol
:And Biconomy should also propose signature of message, like this :
B1/ Implementation of message signature, something like GnosisSafe for example :
B2/ implementation of EIP1271 isValidSignature (inside
SmartAccount.sol
) with the help of ECDSA OpenZeppelin library :The text was updated successfully, but these errors were encountered: