Closed howlbot-integration[bot] closed 4 months ago
This is incorrect. maxAPR
can be set by the taker to protect against MEV
The new position's APR has no relation to the original borrower. It's just to calculate a cash amount from the position's credit. (That cash should be charged from the new lender)
hansfriese marked the issue as unsatisfactory: Insufficient proof
hansfriese changed the severity to 2 (Med Risk)
Lines of code
https://github.com/code-423n4/2024-06-size/blob/8850e25fb088898e9cf86f9be1c401ad155bea86/src/libraries/actions/SellCreditMarket.sol#L127-L204
Vulnerability details
Impact
When the borrower accepts the loan offer and uses the sellCreditMarket function, the apr is calculated in the validateSellCreditMarket function and if the calculated apr is greater than the borrower's acceptable apr, the function will revert to protect the borrower.
The problem occurs when the lender wants to sell his credit position to another lender. When the lender sells his credit position to another lender, the current borrowing rate can be different than before, and this can harm borrowers because the APR validation won't protect the borrower because the lender can use any params.maxAPR.
Proof of Concept
Added marketRateMultipliers to the YieldCurveHelper.PointCurve() to see the effects of the borrowing rate.
SellCreditMarket.t.sol
When Bob borrows from Alice, Bob's ratePerTenor is equal to 9.863e14. (I emitted an event in the executeSellCreditMarket function to see the ratePerTenor)
Alice decides to sell his credit position to Candy, but Bob's APR will be higher than his first borrow due to the borrow rate change.
Tools Used
Manual Review
Recommended Mitigation Steps
When a lender sells his credit position, the new position's APR shouldn't be greater than the previous one, so the borrower won't be in a bad position.
Assessed type
Invalid Validation