BuyCreditMarket operation will revert in the cases when the cashAmountIn - fees amount due to a borrower is available in the underlying pool, while cashAmountIn returned is not.
Proof of Concept
executeBuyCreditMarket() to return amountIn - fees similarly to other liqudity validation functions (SellCreditMarket and LiquidateWithReplacement):
Lines of code
https://github.com/code-423n4/2024-06-size/blob/8850e25fb088898e9cf86f9be1c401ad155bea86/src/libraries/actions/BuyCreditMarket.sol#L121-L124
Vulnerability details
Impact
BuyCreditMarket
operation will revert in the cases when thecashAmountIn - fees
amount due to a borrower is available in the underlying pool, whilecashAmountIn
returned is not.Proof of Concept
executeBuyCreditMarket()
to returnamountIn - fees
similarly to other liqudity validation functions (SellCreditMarket
andLiquidateWithReplacement
):Size.sol#L178-L185
Now it will revert in the cases when the
cashAmountIn - fees
due to a borrower is available, whilecashAmountIn
is not:BuyCreditMarket.sol#L121-L124
BuyCreditMarket.sol#L195-L197
Tools Used
Manual Review
Recommended Mitigation Steps
Consider returning
cashAmountIn - fees
fromexecuteBuyCreditMarket()
.Assessed type
Other