-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not set owners of pre-initialized wallets to address(0)
#90
Comments
raymondfam marked the issue as insufficient quality report |
raymondfam marked the issue as primary issue |
SCW is proxy-deployed whose initialization logic is different than what you have described here. |
3docSec changed the severity to QA (Quality Assurance) |
Interesting finding. If we exclude user errors, it is safe to assume that wallets created by the factory are initialized with non-zero addresses because the factory creates and initializes wallets in the same call. The only exception to the above is the implementation contract, that has its storage initialized in the constructor. For this one, the only consequence I can imagine is that the implementation wallet can accept The similar finding (this and this) pointed by #90 as having previously been judged valid are much more impactful because they open a viable path for destructing the implementation - this is not true for this codebase. Leaving this as QA because having |
3docSec marked the issue as grade-a |
Lines of code
https://github.com/code-423n4/2024-03-coinbase/blob/e0573369b865d47fed778de00a7b6df65ab1744e/src/SmartWallet/CoinbaseSmartWallet.sol#L102-L107
Vulnerability details
Impact
Function
_validSignature()
inConibaseSmartWallet.sol
utilizesisValidSignatureNow()
from Solady implementation. If the signature is invalid, function returnsaddress(0)
. For not-yet initialised implementation ofCoinbaseSmartWallet
the owner will be zero, thus every invalid signature generated by the attacker will be evaluated as valid ones (invalid signature returnsaddress(0)
, the owner of uninitializedConibaseSmartWallet
isaddresss(0)
, thus the address returned byisValidSignatureNow()
will match the owner).The very similar issue had been reported during the previous Code4rena contest and evaluated as High. Please review below links for further Impact reference and more detailed explaination:
the implementation can be killed bricking all the smart wallets that use it as an implementation 2023-01-biconomy-findings#14
Destruction of the
SmartAccount
implementation 2023-01-biconomy-findings#496 (comment)Proof of Concept
File: ConibaseSmartWallet.sol
abi.encode(address(0))
isValidSignatureNow()
from Solady will returnaddress(0)
when signature is not validadddress(0)
) is the same as the returned value fromisValidSignatureNow()
-address(0)
- signature will be evaluated as validCoinbaseSmartWallet
.Tools Used
Manual code review
Recommended Mitigation Steps
The owner of non-yet initialized
CoinbaseSmartWallet
should not beaddress(0)
. Set it toaddress(1)
instead.File: src/SmartWallet/CoinbaseSmartWallet.sol
line 105, should be changed to:
owners[0] = abi.encode(address(1));
Assessed type
Access Control
The text was updated successfully, but these errors were encountered: