Skip to content

Comments

restrict depositFor to initiator#233

Merged
adhusson merged 10 commits intomainfrom
fix/restrict-receiver-on-deposit
Feb 3, 2025
Merged

restrict depositFor to initiator#233
adhusson merged 10 commits intomainfrom
fix/restrict-receiver-on-deposit

Conversation

@adhusson
Copy link
Contributor

No description provided.

@adhusson adhusson requested a review from Rubilmax January 28, 2025 11:00
Signed-off-by: MathisGD <74971347+MathisGD@users.noreply.github.com>
QGarchery
QGarchery previously approved these changes Jan 29, 2025
adhusson and others added 2 commits January 29, 2025 22:05
Co-authored-by: Quentin Garchery <garchery.quentin@gmail.com>
Signed-off-by: Adrien Husson <adhusson@gmail.com>
Co-authored-by: Quentin Garchery <garchery.quentin@gmail.com>
Signed-off-by: Adrien Husson <adhusson@gmail.com>
Signed-off-by: Adrien Husson <adhusson@gmail.com>
Copy link

@Rubilmax Rubilmax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we don't also enforce initiator to the withdrawal, the following scenario could happen:

  1. whitelisted user wraps USDC to verUSDC, deposits verUSDC to vault
  2. Transfer vault shares to non-whitelisted user
  3. non-whitelisted user redeems vault shares then unwraps verUSDC to USDC to the bundler (hypothetically whitelisted)
  4. non-whitelisted user transfers USDC to themselves

@MathisGD
Copy link
Contributor

MathisGD commented Feb 3, 2025

Interesting case. Note that in any case (even if we prevent this) this scenario could happen:

  1. non-whitelisted transfers underlying to whitelisted
  2. whitelisted user wraps and supply
  3. transfer vault shares to non-whitelisted
  4. transfer back vault shares to whiltelisted
  5. whitelisted withdraws and sends back underlying

What I mean is that due to the fact that it's impossible to whitelist vault shares transfers, a malicious whiltelisted person could always make people profit from a vault with an whiltelisted underlying asset.

I'm not sure if we need to make a change to withdrawTo. @adhusson wdyt

EDIT: hardcoding the receiver wouldn't even fix this case

@adhusson
Copy link
Contributor Author

adhusson commented Feb 3, 2025

I may be missing something. withdrawTo unwraps, so the unwrapped token will always be transferable to the initiator, whether he is whitelisted or not. ie the following can happen:

  1. whitelisted user wraps USDC to verUSDC, deposits verUSDC to vault
  2. Transfer vault shares to non-whitelisted user
  3. non-whitelisted user redeems vault shares then unwraps verUSDC to USDC to himself (hypothetically whitelisted)
  4. non-whitelisted user transfers USDC to themselves

The only way to prevent this would be to also force morphoWithdraw's receiver to be initiator.

@MathisGD
Copy link
Contributor

MathisGD commented Feb 3, 2025

you're right, it wouldn't fix anything for classic implementations of permissioned wrappers

@adhusson adhusson requested a review from Rubilmax February 3, 2025 10:08
@adhusson adhusson merged commit 3f47c41 into main Feb 3, 2025
9 checks passed
@adhusson adhusson deleted the fix/restrict-receiver-on-deposit branch February 3, 2025 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants