Closed c4-bot-2 closed 4 months ago
raymondfam marked the issue as insufficient quality report
raymondfam marked the issue as sufficient quality report
raymondfam marked the issue as primary issue
Could have had more elaborate POC.
ditto-eth (sponsor) disputed
exit short reverts when cr doesn't improves. see: https://github.com/code-423n4/2024-03-dittoeth/blob/91faf46078bb6fe8ce9f55bcb717e5d2d302d22e/contracts/facets/ExitShortFacet.sol#L204
hansfriese marked the issue as unsatisfactory: Invalid
Lines of code
https://github.com/code-423n4/2024-03-dittoeth/blob/91faf46078bb6fe8ce9f55bcb717e5d2d302d22e/contracts/facets/ExitShortFacet.sol#L198-L200
Vulnerability details
Description
the bug is in the exitShort function this functio is lies in the static adjustment of collateral without reevaluating the collateral ratio after the market bid's outcome. and this is fails to account for real-time fluctuations in market conditions, as price slippage or partial fulfillment of the exit order, leading to potentially under-collateralized positions. Specifically, the subtraction of e.ethFilled from short.collateral is performed without ensuring that the remaining collateral is adequate to maintain a safe collateral ratio, given the new reduced ERC debt (short.ercDebt -= e.ercFilled).
Impact
the bug is lead to potentially under-collateralized positions and attackers can exploit this by creating conditions for under-collateralization
Proof of Concept
i fuzz with this scenario
Buyback Amount: 82 ERC Price: 2 ETH per ERC Collateral: 56 ETH ERC Debt: 95 ERC
as result The ETH required for the buyback would be 82 * 2 = 164 ETH. and the available collateral is only 56 ETH the available collateral is only 56 ETH the check correctly identifies that the required 164 ETH exceeds the available 56 ETH of collateral, and as per the simulated condition
the logic for handling partial exits does not accurately adjust the collateral leading to potential inconsistencies in state.
Tools Used
manual review
Recommended Mitigation Steps
check after the bid is executed to compare the new collateral ratio against the initial ratio
Assessed type
Other