Submitted by max10afternoon
The withdraw function of the LybraEUSDVaultBase vaults, uses a time softlock to prevent users from hopping in and out of the protocol; to gain access to the yield generated by other users and then leave right away (by charging a small percentage from the withdrawn amount).
The same measure isnt applied to rigidRedemptions, which enable a user to withdraw most of the underlying assets at any time after deposit. This enables a user to deposit into the pool right before a rebase is about to happen, get access to the yield generated by other users and leave by calling rigidRedemption and withdraw on the tokens left by rigidRedemption (the amount charged on the leftovers assets, can be outbalanced by the yield).
Therefore, a malicious user to get access to yield that they didnt generate, effectively stealing it from others. The amount that the user will get access to will vary based on the deposited amounts.
This issue involves 3 functions:
Here is an hardhat script that shows the scenario above in javascript (each step is highlighted in the comments and it will print all the balances to the console).
Before running it youll have to install the '@openzeppelin/test-helpers' package:
The same timelock logic that is applied to the withdraw function could be applied to rigidRedemption, making this type of interaction unprofitable.
Timing
LybraFinance disputed and commented:
0xean (judge) commented:
LybraFinance confirmed and commented:
0xean (judge) decreased severity to Medium
