`VaultImplementation._validateCommitment` may prevent liens that satisfy their terms of `maxPotentialDebt`
The potential debt calculation in VaultImplementation._validateCommitment incorrectly multiplies seniorDebt by duration, making the computed debt much higher than actual. This causes legitimate liens that would satisfy the maxPotentialDebt constraint to fail, resulting in a denial of service for borrowers.
obront Follow with tives, rvierdiiev and 4 others
Originally disclosed on Sherlock
Source: https://github.com/sherlock-audit/2022-10-astaria-judging/issues/182
Found by
obront, tives, rvierdiiev, Jeiwan, hansfriese, 0xRajeev, zzykxx
Summary
The calculation of potentialDebt in VaultImplementation._validateCommitment() is incorrect and will cause a DoS to legitimate borrowers.
Vulnerability Detail
The calculation of potentialDebt in VaultImplementation._validateCommitment() is incorrect because it computes uint256 potentialDebt = seniorDebt * (ld.rate + 1) * ld.duration; which incorrectly adds a factor of ld.duration to seniorDebt thus making the potential debt much higher by that factor than it will be. The use of INTEREST_DENOMINATOR and implied lien rate is also missing here.
Impact
Liens that would have otherwise satisfied the constraint of potentialDebt <= ld.maxPotentialDebt will fail because of this miscalculation and will cause a DoS to legitimate borrowers and likely all of them.
Code Snippet
- https://github.com/sherlock-audit/2022-10-astaria/blob/main/src/VaultImplementation.sol#L221-L225
- https://github.com/sherlock-audit/2022-10-astaria/blob/main/src/LienToken.sol#L256-L262
Tool used
Manual Review
Recommendation
Change the calculation to uint256 potentialDebt = seniorDebt * (ld.rate * ld.duration + 1).mulDivDown(1, INTEREST_DENOMINATOR);. This should also consider the implied rate of all the liens against the collateral instead of only this lien.
Discussion
secureum
Escalate for 2 USDC.
Given the potential impact to different flows/contexts, we still think this is a high-severity impact (not Medium as judged). A majority of the dups (4 of 6) also reported this as a High.
cc @berndartmueller @lucyoa
sherlock-admin
Escalate for 2 USDC.
Given the potential impact to different flows/contexts, we still think this is a high-severity impact (not Medium as judged). A majority of the dups (4 of 6) also reported this as a High.
cc @berndartmueller @lucyoa
You've created a valid escalation for 2 USDC!
To remove the escalation from consideration: Delete your comment. To change the amount you've staked on this escalation: Edit your comment (do not create a new comment).
You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final.
Evert0x
Escalation accepted.
sherlock-admin
Escalation accepted.
This issue's escalations have been accepted!
Contestants' payouts and scores will be updated according to the changes made on this issue.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely, the formula for potentialDebt incorrectly multiplies seniorDebt by the loan duration and omits the interest denominator and implied lien rate.
Impact
Liens that would otherwise satisfy the potentialDebt constraint will fail, causing a denial of service to legitimate borrowers and likely all of them.
What the attacker needed
None
The fix
The calculation should be changed to use the correct formula that includes the interest denominator and considers the implied rate of all liens against the collateral.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
In a smart contract, a function checks whether a borrower's debt is within a limit. The check uses a wrong formula that makes the debt look much larger than it really is. So even borrowers who should be allowed are rejected, and they cannot use the service.
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.