Borrow rate calculation can cause VToken.accrueInterest() to revert, DoSing all major functionality
Submitted by dacian, also found by nadin, Co0nan and SaeedAlipoor01988.
Borrow rates are calculated dynamically and VToken.accrueInterest() reverts if the calculated rate is greater than a hard-coded maximum. As accrueInterest() is called by most VToken functions, this state causes a major DoS.
Proof of Concept
VToken hard-codes the maximum borrow rate and accrueInterest() reverts if the dynamically calculated rate is greater than the hard-coded value.
The actual calculation is dynamic [1, 2] and takes no notice of the hard-coded cap, so it is very possible that this state will manifest, causing a major DoS due to most VToken functions calling accrueInterest() and accrueInterest() reverting.
Recommended Mitigation Steps
Change VToken.accrueInterest() to not revert in this case, but simply to set borrowRateMantissa = borrowRateMaxMantissa if the dynamically calculated value would be greater than the hard-coded max. This would:
- Allow execution to continue operating with the system-allowed maximum borrow rate, allowing all functionality that depends upon
accrueInterest()to continue as normal. - Allow
borrowRateMantissato be naturally set to the dynamically calculated rate as soon as that rate becomes less than the hard-coded max.
Assessed type
DoS
chechu (Venus) disagreed with severity and commented:
We could deploy a new implementation of the VToken contract, with a higher maximum, and fix the lock. Via VIP, with the votes from the community.
chechu (Venus) confirmed via duplicate issue #110
Upgrading a contract does not mitigate that there would be an impact to the protocol, so I think this does qualify as Medium.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
What is known
A medium-severity doS bug in Venus Prime. Code4rena made it public on 9 August 2023. Found in the 2023-05-venus audit contest (finding M-15), also found by 3 other wardens.
About DoS
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.