Potential Re-entrancy Attack via ETH or ERC777 Token Transfer #260
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
duplicate
This issue or pull request already exists
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Lines of code
https://github.com/code-423n4/2022-02-concur/blob/main/contracts/ConcurRewardPool.sol#L34-L39
Vulnerability details
Impact
The CEI pattern is not being implemented properly in the
claimRewards
function of theConcurRewardPool.sol
.https://github.com/code-423n4/2022-02-concur/blob/main/contracts/ConcurRewardPool.sol#L37
On line 37, the
safeTransfer
method is called on the ERC20 token (note,safeTransfer
does not protect against re-entrancy attacks) and THEN the reward value is set to 0. If this token is question is an ERC777 token with callbacks (this is possible as ERC777 is backward compatible and both Convex'sVirtualBalanceRewardPool.sol
and Concur'sConvexStakingWrapper.sol
utilize IERC20 to interact with the token) then the attacker can utilize the callback to re-enter the function and drain the contract of rewards before the reward is set to 0.This attack vector would also be present if future updates to the code enabled rewards to be automatically swapped to ETH and the same pattern was followed.
Tools Used
Manual review
Recommended Mitigation Steps
Follow the CEI pattern.
The text was updated successfully, but these errors were encountered: