The executeTransaction
function in Multisig.sol transfers ETH to an external address (payable(txn.to).call{value: txn.value}("");
) without using a reentrancy guard.
A malicious recipient could exploit reentrancy by calling back into the contract during the transfer, potentially draining funds or causing unexpected behavior.
install OpenZeppelin Contracts library
forge install OpenZeppelin/openzeppelin-contracts --no-commit
Mark executeTransaction
as non-reentrant using ReentrancyGuard
from OpenZeppelin's library.
How to do this:
add this in foundry.toml:
remappings = ['@openzeppelin/contracts=lib/openzeppelin-contracts/contracts']
import this at top of your MultiSig.sol
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
Update the contract declaration to inherit from ReentrancyGuard
:
contract MultiSigWallet is ReentrancyGuard {
Use OpenZeppelin's ReentrancyGuard
to protect the executeTransaction
function:
function executeTransaction(uint256 _txId) external onlyOwners nonReentrant {
// Existing logic
}
matchRewards: Contract is created just before and is the one called. No impact. executeTransaction: CEI is followed. Emitting an event in disorder is informational in that context. withdraw: CEI is followed.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.