Skip to content
DoS Audit finding Advanced

Re-balancing the vault allocation may always revert when distributing profits: resulting of a massive system DOS

0xBeirao Follow with bin2chen

Originally disclosed on Code4rena

Submitted by 0xBeirao, also found by bin2chen

updateRewardSum function call _computeRewardsPerUnitStaked with _debtToOffset set to 0. Meaning that the assignment L531 will revert if lastLUSDLossError_Offset != 0 (which is likely the case) because we try to assign a negative value to an uint.

Impact

_rebalance() will be definitely DOS if the profit is greater than the yieldClainThreshold ⇒ vars.profit != 0.

Because they call _rebalance() all these functions will be DOS :

In BorrowerOperations 100% DOS

  • openTrove
  • closeTrove
  • _adjustTrove
  • addColl, withdrawColl
  • withdrawLUSD, repayLUSD

In TroveManager 80% DOS

  • liquidateTroves
  • batchLiquidateTroves
  • redeemCloseTrove

Proof of Concept

Context : the vault has compound enough profit to withdraw. (here)

Alice initiates a trove liquidation. offset() in StabilityPool is called to cancels out the trove debt against the LUSD contained in the Stability Pool.

A floor division errors occur so now lastLUSDLossError_Offset is not null.

Now, every time _rebalance() is called the transaction will revert.

Recommended Mitigation

In StabilityPool.sol#L504-L544, just skip the floor division errors calculation if _debtToOffset == 0

if(_debtToOffset != 0){
	[StabilityPool.sol#L526-L538](https://github.com/code-423n4/2023-02-ethos/blob/73687f32b934c9d697b97745356cdf8a1f264955/Ethos-Core/contracts/StabilityPool.sol#L526-L538)
}

tess3rac7 (Ethos Reserve) confirmed


The original report as published on Code4rena, by 0xBeirao. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

What is known

A high-severity doS bug in Ethos Reserve contest. Code4rena made it public on 2 May 2023. Found in the 2023-02-ethos audit contest (finding H-01), also found by 1 other warden.

About DoS

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More by 0xBeirao

View all

2 more disclosed reports, best first.

More from Ethos Reserve contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.