borrow function will borrow max cf when trying to borrow > cf
The borrow function in MochiVault does not revert when a user tries to borrow more than the maximum collateral factor allows; instead it borrows up to the maximum. This could lead a user to borrow at a dangerous collateral level and receive less than requested.
Submitted by gzeon
Impact
Borrow function in MochiVault will borrow to max cf when trying to borrow > cf instead of revert with “>cf” as specified in the supplied test. The difference in behavior may cause user to borrow at dangerous collateral level, and receive less than the amount requested.
Proof of Concept
Recommended Mitigation Steps
Revert if details\[\_id].debt + \_amount > maxMinted with “>cf”
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 borrow function caps the borrowed amount at the maximum collateral factor instead of reverting when the requested amount exceeds that limit.
Impact
A user could borrow at a dangerous collateral level and receive less than the amount requested.
What the attacker needed
None
The fix
The borrow function should revert with '>cf' if the new debt would exceed the maximum allowed by the collateral factor.
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 smart contract lets people borrow funds against collateral. The contract is supposed to stop you if you try to borrow more than your collateral allows, but instead it quietly gives you the maximum allowed amount. This means you might end up with a riskier loan than you intended and get less money than you asked for.
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.