code-423n4 / 2024-03-dittoeth-findings

0 stars 0 forks source link

Reverting on Liquidation Error can cause a the system to underflow #177

Closed c4-bot-7 closed 6 months ago

c4-bot-7 commented 7 months ago

Lines of code

https://github.com/code-423n4/2024-03-dittoeth/blob/91faf46078bb6fe8ce9f55bcb717e5d2d302d22e/contracts/facets/PrimaryLiquidationFacet.sol#L109

Vulnerability details

Impact

Revertion of the liquidation function means even when most conditions are good, will make the system enter into error when the dethcollateral - eth will give a negative value thus underflowing.

Proof of Concept

If there are no sell in the market. For any reason at all the system should balance up and ensure that the liquidation function works. If the liquidation function fails and the contract enters a negative balance, it indicates a critical problem. Negative balances are typically not permissible in financial systems as they can lead to various issues such as incorrect accounting, inability to execute transactions, or even potential exploitation by malicious actors. Note the function also reverts for other reasons.

Tools Used

manual code analysis

Recommended Mitigation Steps

review all potential point of reversion and provide a temporary solution.

  1. for the no sell reversion the contract can use the fees collected by tapp or hold ercamounts to be used as an alternative instead of reverting the entire function.

Assessed type

Error

c4-pre-sort commented 7 months ago

raymondfam marked the issue as insufficient quality report

c4-pre-sort commented 7 months ago

raymondfam marked the issue as primary issue

c4-judge commented 6 months ago

hansfriese marked the issue as unsatisfactory: Insufficient proof