20,000 USDC
View results
Submission Details
Severity: high

Reentrancy in Claim() at Staking.sol

Vulnerability Details

It was found that claim() function of Staking.sol doesn't implement checks-effects-interactions pattern therefore leaving the function vulnerable to reentrancy attacks.

function claim() external {
updateFor(msg.sender);
WETH.transfer(msg.sender, claimable[msg.sender]);
claimable[msg.sender] = 0;
balance = WETH.balanceOf(address(this));
}

the function transfers the claimable balance to the msg.sender first and then in the next line updates the state with claimable[msg.sender] = 0;

Impact

An attacker could exploit the contract to re-enter the claim() function several times leading to drain it from funds.

Tools Used

Manual Review.

Recommendations

It is advisable to use checks-effects-interactions pattern and to use nonReentrant() modifier as an added layer of security.

Support

FAQs

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