The claimFees
function interacts with external contracts (e.g., IERC20) without implementing a reentrancy guard, exposing the contract to reentrancy attacks. This issue is critical because Zaros relies on secure fee distribution to maintain trust and maximize LP yields.
The function calls IERC20(weth).safeTransfer
, which could be exploited by a malicious token contract to re-enter the function.
Example Scenario:
A malicious contract calls claimFees
.
During the fee transfer, the malicious contract re-enters claimFees
before the state is updated, claiming fees multiple times.
This could drain the contract's WETH balance, leading to significant financial losses.
A reentrancy attack could drain the contract's funds, harming both the protocol and its users.
Such an attack would undermine trust in Zaros and disrupt its operations.
Insecure fee distribution would harm LPs' yield generation, contradicting Zaros's core goal.
**High **: This vulnerability allows attackers to potentially drain the contract's funds, posing a severe financial and operational risk to the protocol.
**Foundry **: Created test cases to simulate reentrancy attacks on the affected functions.
**Slither **: Identified unprotected external calls and flagged potential reentrancy risks.
**Echidna **: Fuzzed the contract to detect recursive call vulnerabilities.
**Mithril Security **: Conducted formal verification to ensure reentrancy guards were properly implemented.
**Use OpenZeppelin's ReentrancyGuard **:
Add a reentrancy guard to prevent recursive calls:
**Follow Checks-Effects-Interactions Pattern **:
Ensure all state changes occur before interacting with external contracts:
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.