20,000 USDC
View results
Submission Details
Severity: low
Valid

A Malicious lender can use his Mining capabilities to manipulate `block.timestamp` to his advantage to increase debt of borrowers

Summary

Inside getDebt() function , the protocol uses block.timestamp at it's core to calculate the debt of borrower that borrower has to pay.

Unfortunately , block.timestamp can easily be manipulated by Miners or Malicious Lenders who are also the miners to
make borrower pay more debt than they originally owe

Vulnerability Details

function getLoanDebt(uint256 loanId) external view returns (uint256 debt) {
Loan memory loan = loans[loanId];
// calculate the accrued interest
(uint256 interest, uint256 fees) = _calculateInterest(loan);
debt = loan.debt + interest + fees;
}
function _calculateInterest(
Loan memory l
) internal view returns (uint256 interest, uint256 fees) {
-> uint256 timeElapsed = block.timestamp - l.startTimestamp; // block.timestamp
interest = (l.interestRate * l.debt * timeElapsed) / 10000 / 365 days;
fees = (lenderFee * interest) / 10000;
interest -= fees;
}

inside _calculateInterest we can see that block.timestamp is being used which can be manipulated by miners.
which can increase/decrease the debt.

A Malicious lender ( who is also a miner ) can use this vulnerability to his advantage.

Impact

Huge loss of funds for users.

Tools Used

Manual Review

Recommendations

Try to have some credible mechanism of fetching the time or using the block.timestamp in a filtered way that also serves the purpose as well as not manipulatable.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.