Wrong comment in getFee
The comment in the getFee function states that the total plus input must be less than the cap, but the code only checks if the input is less than the cap. An attacker could potentially exceed the intended cap by providing a large total input, though the exact impact is not detailed.
Submitted by cmichel
The ThreePieceWiseLinearPriceCurve.getFee comment states that the total + the input must be less than the cap:
If dollarCap == 0, then it is not capped. Otherwise, then the total + the total input must be less than the cap.
The code only checks if the input is less than the cap:
// @param _collateralVCInput is how much collateral is being input by the user into the system
if (dollarCap != 0) {
require(_collateralVCInput <= dollarCap, "Collateral input exceeds cap");
}
Recommended Mitigation Steps
Clarify the desired behavior and reconcile the code with the comments.
kingyetifinance (Yeti finance) confirmed and disagreed with severity:
@LilYeti: This was an issue also found by one of our independent economic auditors. Good find. Is actually more like a medium (severity 2) issue.
0xtruco (Yeti finance) commented:
Fixed in line 92
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
Impact
The discrepancy could allow users to exceed the intended cap, potentially affecting the system's economics, though the severity was considered medium by the project.
What the attacker needed
None
The fix
The issue was fixed by updating the code to match the comment's intended behaviour.
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.
A comment in the code says one thing, but the actual check does something else. The comment says the sum of two values must be under a limit, but the code only checks one value. This mismatch could let someone bypass the intended limit.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.