Submitted by ladboy233, also found by rvierdiiev
In the current implementation, after user deposits funds into lending pool and mint lending pool shares, user can call collateralize function to add collateral:
There is a validation:
Let us consider the case:
The mode supports three pools, USDC lending pool, WETH lending pool and a token A lending pool.
The token A is subject to high volatility, the admin decides to disalllow token A lending pool added as collateral.
But then the token A is hacked.
The attacker can mint the token A infinitely.
There is a relevant hack in the past:
Attacker exploited logical and math error to mint token infinitely.
Attacker exploited cryptographical logic to mint token infinitely.
But even when admin disallow a mode from further collaterize or disallow the lending pool from further collaterize, the hacker can donate the token to the lending pool and inflate the share worth to borrow all fund out.
This would trigger the function syncCash, which update the cash amount in the lending pool to make sure the donated token count into the token worth
Sync cash is called
Basically by using the flash function and then trigger syncCash, user can always donate the token to the pool to inflate share worth.
Then in the collateral credit calculation, we are converting shares worth to amount worth
Which calls the function toAmt
Assume shares do not change.
Assume total shares does not change.
Clearly inflating the total asset (which is _cash + debt) inflates share worth.
Again, in the case of infinite token minting, hacker can donate the token to the lending pool to inflate the collateral credit and borrow all fund out and create large bad debt.
Use internal balance to track the cash amount and do not allow user to indirectly access the sync cash function via flash loan.
fez-init (INIT) confirmed
For this audit, 3 reports were submitted by wardens detailing low risk and non-critical issues. The report highlighted below by 0x73696d616f received the top score from the judge.
The following wardens also submitted reports: sashik_eth and ladboy233.
