The setProfitMaxUnlockTime function in TokenizedStrategy.sol allows manipulation of share prices through front-running, enabling users to profit from predictable changes in share value during report calls. This attack would be very easy to execute since the change to profitMaxUnlockTime is applied once report is called. Meaning that once setProfitMaxUnlockTime is called, the attcker just needs to wait for report to be called and then deposit or withdraw to profit from the predictable share price change.
The vulnerability exists in the profit unlocking mechanism of the TokenizedStrategy contract. Here's how it works:
The setProfitMaxUnlockTime function changes the time period over which profits are unlocked
This directly affects the profitUnlockingRate calculation in the report function
The unlocking rate impacts the total supply of shares, which is used to calculate:
Share price for deposits
Share price for withdrawals
The issue arises because changes to profitMaxUnlockTime create predictable step-wise changes in share prices. This can be exploited by:
Monitoring for setProfitMaxUnlockTime transactions
Front-running the subsequent report call by:
Depositing if share price will increase
Withdrawing if share price will decrease
Profiting from the predictable price movement
Users can extract value from the protocol by front-running share price changes
Other users suffer losses as front-runners capture the profits
The predictability of price changes undermines fair value distribution
Manual Review
Add a timelock mechanism for deposits and withdrawals after to prevent front running and race conditions related to the report function. This prevents exploitation of step-wise price changes by ensuring users cannot front-run the price impact of profitMaxUnlockTime changes.
Alternatively remove the setProfitMaxUnlockTime function to remove any risk of this exploit. If this path is chosen, ensure that the profitMaxUnlockTime is carefully considered so that no change is needed.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.