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

Arbitrary Call Vulnerability

Description: This vulnerability which is shown in the _executeTransaction function that allows any transaction signer (including a compromised owner) to execute arbitrary calls to any address with any data and value. This can be exploited to drain the wallet's funds or interact with other contracts in unintended ways.

Impact:

  1. An attacker gains access to the owner's private key through phishing or other means.

  2. The attacker creates a transaction that transfers all funds to their address.

  3. The attacker signs this transaction with the compromised key.

  4. The attacker calls executeTransactionFromOutside with the malicious transaction.

  5. The wallet executes the transaction, transferring all funds to the attacker.

Recommended Mitigation:

Implement a whitelist of allowed addresses and function signatures that can be called.
This could be done by adding a mapping of approved addresses and functions.

+ mapping(address => mapping(bytes4 => bool)) public approvedCalls;
+ function approveCall(address target, bytes4 functionSig) external onlyOwner {
+ approveCalls[target][functionSig] = true;
+ }
function _executeTransaction(Transaction memory _transaction) internal {
address to = address(uint160(_transaction.to));
uint128 value = Utils.safeCastToU128(_transaction.value);
bytes memory data = _transaction.data;
+ bytes4 functionSig = bytes4(data);
+ require(approvedCalls[to][functionSig], "Unapproved call");
if (to == address(DEPLOYER_SYSTEM_CONTRACT)) {
uint32 gas = Utils.safeCastToU32(gasleft());
SystemContractsCaller.systemCallWithPropagatedRevert(gas, to, value, data);
} else {
bool success;
(success,) = to.call{value: value}(data);
if (!success) {
revert MondrianWallet2__ExecutionFailed();
}
}
}
Updates

Lead Judging Commences

bube Lead Judge 12 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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