The Standard

The Standard
DeFiHardhat
20,000 USDC
View results
Submission Details
Severity: high
Valid

Loops over unbounded arrays can result in DoS that prevents all liquidations and position updates

Description

Due to loops over the unbounded holders and pendingStakes arrays, the following functions will be in a state of DoS:

For example, the following snippet shows the loop over the unbounded holders array in LiquidationPool::distributeFees:

function distributeFees(uint256 _amount) external onlyManager {
uint256 tstTotal = getTstTotal();
if (tstTotal > 0) {
IERC20(EUROs).safeTransferFrom(msg.sender, address(this), _amount);
// @audit potential DoS due to loop over unbounded array
for (uint256 i = 0; i < holders.length; i++) {
address _holder = holders[i];
positions[_holder].EUROs += _amount * positions[_holder].TST / tstTotal;
}
// @audit potential DoS due to loop over unbounded array
for (uint256 i = 0; i < pendingStakes.length; i++) {
pendingStakes[i].EUROs += _amount * pendingStakes[i].TST / tstTotal;
}
}
}

This will prevent all liquidations and prevent stakers from adding/removing to/from the liquidation pool.

Impact

Stakers will not be able to increase/decrease their positions. Liquidations are also blocked. Therefore, this is a high-severity finding.

Recommended Mitigation

Avoid looping over unbounded arrays.

Updates

Lead Judging Commences

hrishibhat Lead Judge over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

pendingstake-dos

0x27281m Auditor
over 1 year ago
0xrektified Auditor
over 1 year ago
georgishishkov Auditor
over 1 year ago
hrishibhat Lead Judge
over 1 year ago
hrishibhat Lead Judge over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

pendingstake-high

Support

FAQs

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