Closed howlbot-integration[bot] closed 4 months ago
Similar to #60. Alice lost funds as her borrow APR is higher than her loan APR. User mistake.
hansfriese marked the issue as not a duplicate
hansfriese marked the issue as unsatisfactory: Invalid
Lines of code
https://github.com/code-423n4/2024-06-size/blob/8850e25fb088898e9cf86f9be1c401ad155bea86/src/libraries/AccountingLibrary.sol#L77-L82 https://github.com/code-423n4/2024-06-size/blob/8850e25fb088898e9cf86f9be1c401ad155bea86/src/libraries/AccountingLibrary.sol#L119
Vulnerability details
Impact
Creating a creditPosition directly with the flag:forSale=true may result in malicious user buying the creditPosition with buyCreditMarket() on a loanOffer that is not directed to the creditposition.
Lets see the following scenario
The likelyhood is medium but the impact is high as a vulnerable user could immediatly lose value.
Proof of Concept
POC: With the test below we can see the situation unfolds in real time.
The test is executed in the context of BuyCreditMarket.t.sol with the following command - forge test --match-test test_BuyCreditMarket_buyCreditMarket_stanchevPOC2 -vvvv
Logs shows us a vulnerability which results in Alice getting 167 usd for her 200 usd position so around 33usd immediate loss for her, while candy has gotten advantage over her credit buying it for around 168 usd.
Tools Used
Manual review
Recommended Mitigation Steps
Assessed type
Context