Undercollateralized loans possible
The _setPoolCollateralFactors function did not check that the collateral factor is below 100%, so it could be set to 200% and allow borrowing more than the collateral is worth, stealing from the pool.
Submitted by cmichel
The _setPoolCollateralFactors function does not check that the collateral factor is < 100%.
It’s possible that it’s set to 200% and then borrows more than the collateral is worth, stealing from the pool.
Recommended Mitigation Steps
Disable the possibility of ever having a collateral factor > 100% by checking:
for (uint256 i = 0; i < pools.length; i++) {
+ require(collateralFactorsMantissa[i] <= 1e18, "CF > 100%");
poolCollateralFactors[pools[i]] = collateralFactorsMantissa[i];
}
0xdramaone (Duality Focus) confirmed, but disagreed with Medium severity and commented:
We agree, we should have a max setting for collateral factor of pools to provide confidence to users. That said, this would only be abusable by admins, and so we consider low risk (since controlled by multisig).
Jack the Pug (judge) commented:
Good catch!
Unbounded
collateralFactorconfiguration made it possible for malicious/compromised privileged roles to rug the users, which I consider a real and very practical threat that should be addressed from the smart contract level.
0xdramaone (Duality Focus) resolved
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
The _setPoolCollateralFactors function lacked a check that the collateral factor is at most 100%.
Impact
A privileged admin could set a collateral factor above 100% and borrow more than the collateral is worth, stealing from the pool; the project considered this low risk because it requires a compromised multisig.
What the attacker needed
Compromised or malicious admin multisig
The fix
The function should be fixed by adding a check that each collateral factor is at most 100% before storing it.
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 collateral factor is the maximum percentage of a deposit you can borrow against. If it is set above 100%, you can borrow more than you put in, which lets you take other people's money from the pool. The code that sets this value did not stop values above 100%.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.