code-423n4 / 2023-05-venus-findings

2 stars 1 forks source link

Every time borrow, the interest is treated as a loan to calculate the interest #442

Closed code423n4 closed 1 year ago

code423n4 commented 1 year ago

Lines of code

https://github.com/code-423n4/2023-05-venus/blob/main/contracts/VToken.sol#L896-L897

Vulnerability details

Impact

File: VToken.sol
 896         uint256 accountBorrowsPrev = _borrowBalanceStored(borrower);
 897         uint256 accountBorrowsNew = accountBorrowsPrev + borrowAmount;

After each loan, the original interest will be converted into the loan amount. This can cause interest to increase more than expected, especially if the rate is very large.

Proof of Concept

Assuming an interest rate of 1% per day. The user borrows 100 USD first, and then borrows 100 USD after 50 days.

Total debt is 450 - 350 = 100 higher

Tools Used

manual

Recommended Mitigation Steps

Don't turn interest into a loan

Assessed type

Other

c4-judge commented 1 year ago

0xean marked the issue as unsatisfactory: Insufficient quality