SmartAccount authorization can be bypassed using a contract signature #449
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
duplicate-175
satisfactory
satisfies C4 submission criteria; eligible for awards
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Lines of code
https://github.com/code-423n4/2023-01-biconomy/blob/main/scw-contracts/contracts/smart-contract-wallet/SmartAccount.sol#L314-L343
Vulnerability details
SmartAccount authorization can be bypassed using a contract signature
The
SmartAccount
wallet supports contract signatures defined by EIP1271, similar to how Gnosis Safe does. Transactions to the wallet can be authorized by a contract that implements theISignatureValidator
interface. This feature is implemented in thecheckSignatures
function, around lines 314-343:https://github.com/code-423n4/2023-01-biconomy/blob/main/scw-contracts/contracts/smart-contract-wallet/SmartAccount.sol#L314-L343
The issue here is that, even though the signature is validated against the contract, there's no relation or enforcement between the signer contract and the owner of the wallet. This means that signature checks can be easily bypassed using a contract signature.
Impact
This represents a critical issue since the authorization of any wallet can be easily bypassed using a dummy contract that acts as the signer.
This would let an attacker access and execute anything on any SmartAccount wallet. By calling the
execTransaction
function on theSmartAccount
contract, an attacker can trigger acall
ordelegatecall
in the context of the wallet and essentially execute any arbitrary code.PoC
In the following test, Bob creates a wallet and loads it with some balance. The attacker then uses a dummy contract that acts as the signature validator (
DummySignatureValidator
) and callsexecTransaction
to delegatecall a contract (StealBalance
) that steals the funds from the wallet.Recommendation
The
checkSignatures
function should verify that the contract validator is the owner of the wallet.The text was updated successfully, but these errors were encountered: