trustline-inc / probity

A transparent asset-based lending protocol implemented for the EVM.
https://docs.trustline.co
Other
3 stars 1 forks source link

Potential exploit in delegatable #310

Closed shine2lay closed 2 years ago

shine2lay commented 2 years ago

After every reward epoch, user is entitled to get the reward from FTSO delegator based on VP token balance in vault - recentDeposit (since epoch uses snap shots, user will not get the reward for the epoch in which they deposited, they get it starting the next one). We keep track of which reward epoch a particular user has withdrawn reward for but there is no limit on how far they can go back.

Exploit: User A has VP token balance X that they received reward for up to Epoch Y (latest) User A's vault is liquidated due to undercollateralization - note that for reward for VP token balance X is already claimed User B bought User A's balance X but User B has only claimed reward from delegator for up to Epoch Y - N. Now User B can claim reward for User A's balance X from Epoch (Y - N ) to Epoch Y.

Potential solution: