The withdrawInheritedFunds
function in the InheritanceManager contract lacks any reentrancy protection. Without a nonReentrant modifier, an attacker may exploit this oversight to repeatedly reenter the function via a malicious fallback and drain more funds than intended.
The function calculates the per-beneficiary amount and loops over the beneficiary array to transfer ETH or ERC20 tokens. However, it does not include a reentrancy guard. In the ETH branch, the function uses low-level calls that allow external contracts to execute code on receiving funds. An attacker(one of beneficiary) might be a malicious contract with a fallback function that reenters withdrawInheritedFunds
, thereby withdrawing more funds than allocated.
Direct Impact: An attacker could drain significant amounts of ETH (or tokens, if extended) from the contract, leading to a direct loss or misallocation of funds.
Manual review
Foundry (Forge) for unit testing
Custom MaliciousWithdraw
contract deployed to simulate the reentrancy attack
Forge test confirming excessive fund withdrawals
Add the nonReentrant modifier (or a similar, e.g., OpenZeppelin’s ReentrancyGuard
) to the withdrawInheritedFunds
function to prevent reentrant calls.
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.