A user can artificially increase the chi accrual (after maturity) by flash borrow on Compound, which affects the exchange rate used by the chi oracle. As a result, the user redeems more underlying tokens with the same amount of fyTokens since the accrual is larger than before.
The exchangeRateStored used by chi oracle is calculated based on the totalBorrows of CToken, which can be artificially increased by a large amount of borrow operated on Compound. Consider a user performing the following steps in a single transaction (assuming that the fyToken is matured):
The user only needs to pay for the gas fees of borrowing and repaying (since they happen in the same transaction) but can redeem more underlying tokens than a regular redeem.
Referenced code:
CompoundMultiOracle.sol#L46
FYToken.sol#L125
FYToken.sol#L132-L143
Recommend making the chi accrual time-weighted to mitigate the manipulation caused by flash borrow and repay.
albertocuestacanada (Yield) acknowledged:
