Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There is no check against setting "minOut" to zero #68

Open
hats-bug-reporter bot opened this issue Jan 31, 2024 · 2 comments
Open

There is no check against setting "minOut" to zero #68

hats-bug-reporter bot opened this issue Jan 31, 2024 · 2 comments
Labels
duplicate This issue or pull request already exists wontfix This will not be worked on

Comments

@hats-bug-reporter
Copy link

Github username: --
Twitter username: 97Sabit
Submission hash (on-chain): 0x3d7281573f7522cc131a8e44606498a2f7738e86c5a0d81018b020878d40b42e
Severity: medium

Description:
Description
Users are at liberty to set minOut to any amount they want in the localSwap function.

But the rationale behind minOut is to serve as a protection against getting zero amount from a swap and frontrunning attack.

However, there is no check in place to ensure that minOut cannot be set to zero. Users can knowingly or mistakenly set minOut to zero. This exposes users to frontrunning attack and getting zero amount from a swap.

  1. Proof of Concept (PoC) File

https://github.com/catalystdao/catalyst/blob/27b4d0a2bca177aff00def8cd745623bfbf7cb6b/evm/src/CatalystVaultVolatile.sol#L565-L572

@hats-bug-reporter hats-bug-reporter bot added the bug Something isn't working label Jan 31, 2024
@reednaa
Copy link
Collaborator

reednaa commented Jan 31, 2024

Some users might want to set minout to zero.

If we didn't accept zero as a valid minout, they could easily circumvent the minout by setting it to 1. It is true that the explicit way is more verbose.

The latter recommendation is a dublicate of #13

@reednaa reednaa added duplicate This issue or pull request already exists wontfix This will not be worked on labels Jan 31, 2024
@ololade97
Copy link

Another weakness to mention is that a lot of users tend to not set minOut values, and swapping withing a vault via localSwap() and sending asset via sendAsset() and other vault actions does not check that the minOut value is actually zero.

The above is the relevant excerpt from issue #13. However, it's also not similar to this issue.

It's true some users may want to set minOut to zero. But they are at the risk of frontrunning.

@reednaa reednaa removed the bug Something isn't working label Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants