Skip to content

Latest commit

 

History

History
39 lines (20 loc) · 1.58 KB

052.md

File metadata and controls

39 lines (20 loc) · 1.58 KB

Small Shamrock Rook

Medium

NumaVault.withdrawToken() does not update interest rate first, causing incorrect interest accrual

Summary

In any lending protocol, all actions which affect the interest rate should be performed AFTER accruing interest so far. This is to ensure that interest is accrued fairly.

For example, if the protocol was untouched for 1 day, and a user was hypothetically able to atomically max out the utilisation ratio before accruing interest for the 1 day, it would cause the borrowers to pay a much high interest rate for the entire day, which does not reflect the actual util ratio over that time period. This is why it's important to accrue interest BEFORE any actions that can change the util ratio / interest rate.

NumaVault.withdrawToken() withdraws tokens from the vault. If the token is the LST, it lowers the available funds in the vault, increasing the utilisation rate. However interest is not accrued before this action, causing incorrect (higher) interest accrual when it is accrued next.

Root Cause

NumaVault.withdrawToken() transfers out tokens without accruing interest first.

Internal pre-conditions

Admin uses the withdrawToken() function to withdraw some amount of LST from the vault

External pre-conditions

No response

Attack Path

Impact

Borrowers pay more interest unfairly

PoC

No response

Mitigation

Call cLst.accrueInterest() within NumaVault.withdrawTokens().