Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: high
Valid

Missing validation of the `IAccount.validateTransaction.selector` value in `MondrianWallet2::executeTransactionFromOutside` allows an attacker to make an unauthorized transfer of funds.

Description

The executeTransactionFromOutside function allows external entities to initiate transactions from the wallet owner's account. For this to happen, the owner's signature must be validated. Signature validation is handled by the internal _validateTransaction function. The _validateTransaction function returns a 4 byte IAccount.validateTransaction.selector value if the owner has signed the transaction, otherwise 0. However, the current implementation of the executeTransactionFromOutside function does not check if the valid selector is returned (meaning the transaction signer is the owner), and as a result, in case the transaction signer is NOT the owner, it does not revert the transaction before the actual transfer of the funds takes place.

Impact

The described vulnerability would allow an attacker to easily transfer funds from the owner's wallet, effectively draining the smart contract's wallet.

Tools Used

Manual review, vscode

Recommended Mitigation:

Consider making the following change to the executeTransactionFromOutside function:

function executeTransactionFromOutside(Transaction memory _transaction) external payable {
+ bytes4 magic = _validateTransaction(_transaction);
+ if (magic != ACCOUNT_VALIDATION_SUCCESS_MAGIC) {
+ revert MondrianWallet2__InvalidSignature();
+ }
- _validateTransaction(_transaction);
_executeTransaction(_transaction);
}
Updates

Lead Judging Commences

bube Lead Judge 12 months ago
Submission Judgement Published
Validated
Assigned finding tags:

Missing validation in executeTransactionFromOutside

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.