51802 sc low temporary freeze of rewards is possible if efficientsupply 0
Description
Brief/Intro
Vulnerability Details
function distributeYield(
uint256 amount
) external onlyRole(YIELD_DISTRIBUTOR_ROLE) nonReentrant {
ArcTokenStorage storage $ = _getArcTokenStorage();
....
ERC20Upgradeable yToken = ERC20Upgradeable(yieldTokenAddr);
yToken.safeTransferFrom(msg.sender, address(this), amount); // <- transfer yield tokens to contract
uint256 distributedSum = 0;
uint256 holderCount = $.holders.length();
if (holderCount == 0) {
emit YieldDistributed(0, yieldTokenAddr);
return;
}
uint256 effectiveTotalSupply = 0;
for (uint256 i = 0; i < holderCount; i++) {
address holder = $.holders.at(i);
if (_isYieldAllowed(holder)) {
effectiveTotalSupply += balanceOf(holder); // <- calculate effectiveTotalSupply
}
}
if (effectiveTotalSupply == 0) {
emit YieldDistributed(0, yieldTokenAddr);
return; // <- return from function if effectiveSupply == 0, but contract stores yield tokens.
}
...
}Impact Details
References
Proof of Concept
Previous49941 sc low permanent freezing of yield tokens due to flawed check in distribution logicNext50477 sc high validator loses all accrued commission when reward token is removed
Was this helpful?