Dussehra
contract can be drained through the withdraw
function due to reentracy.
In Dussehra::withdraw
function is susceptible to reentrancy attack, potentially draining all contract's funds.
Attacker.sol
in test
folder:
Import this file into test/Dussehra.t.sol
test file and add the following test:
Run the command forge test --mt test_reentrancy
to run this test. All funds will be drained.
Complete drain of funds
Manual review, Foundry
Follow the checks-effects-interactions pattern:
The `withdraw` function sends the given amount to Ram. If the attacker calls the `withdraw` function again before the state variable is changed, the function will revert because there are no more funds in the contract. This reentrancy has no impact for the protocol. It is recommended to follow the CEI pattern, but this is informational.
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.