-
Notifications
You must be signed in to change notification settings - Fork 91
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
Missing slippage protection in _swapDollarsForGovernance()
#901
Comments
@rndquu rfc |
I would close the current issue as "not planned" but I do agree that the slippage protection is not implemented (which is a medium severity issue) |
I guess @0xRizwan can redo the issue spec to focus on slippage protection and then we can fund it using our existing system so that they can receive credit? |
It doesn't make sense to work on the contract that we might delete in the next big refactor |
I have the same opinion. On one hand the severity was detected, and applies here but the audit scope was mentioned multiple times in the Discord channel. I consider the finding useful, though. |
The contract is a part of developement branch and was not in deprecated folder. Since sherlock audit is completed and i had high level overview of other out of scope contracts during audit so my intention was to report it before the team deploy on mainnet. Well, i was not aware the contract is obscelate. On severity, This is an high severity issues. If it was found at sherlock it would be 100% a high severity according to their strict rules, even other platforms like code4rena, spearbit consider slippage issues as high severity issue. @pavlovcik Thanks for the credit thought and appreciate your response. @gitcoindev Thanks for acknowledging the issue. I am sure the team would fix this slippage issues in revised contract. |
A few notes on the current project stage. The contracts that were part of the audit scope were carefully created/refactored by the core team with as much attention as possible hence we got a pretty solid result with 4 medium issues in the final audit report (although 0 issues result is way better). All other contracts (related to staking, The That is why I think we'd better concentrate on the contracts that were part of the audit scope because everything else should be refactored. The next big feature we want to implement is to revise staking which includes a research of how all our obsolete staking contracts work and (ideally) migrating to a new staking contract. @0xRizwan Thank you being proactive. There are other issues (one, two) that you might be interested to solve but touching the old contracts is like beating a dead horse. |
Thank you. I have scheduled audits from here onwards. All the best for upcoming mainnet launch. |
Thank you. By the way what nickname did you use for the audit https://github.com/sherlock-audit/2023-12-ubiquity-judging/issues ? Can't find |
# Issue was not closed as completed. Skipping. |
Title
Missing slippage protection in
_swapDollarsForGovernance()
Severity
High
Vulnerability details
LibDollarMintExcess._swapDollarsForGovernance()
is used to swap dollars for Governance tokens via uniswap router.In above code,
amountOutMin
is hardcoded to 0 means means _swapDollarsForGovernance() has missing slippage protection.The above code for swap explicitely tells that the user will accept a minimum amount of 0 output tokens from the swap, opening up the user to a catastrophic loss of funds via MEV bot sandwich attacks.
swapExactTokensForTokens()
from uniswap is given below where it make sure, amount out is greater and equal toamountOutMin
Therefore, setting
amountOutMin
to 0 does not make sense as it may lead to loss of funds due to MEV sandwich attacks.Impact
A user will get back fewer tokens than they expect, if there was a large price impact. Trades can happen at a manipulated price and end up receiving fewer tokens than current market price dictates.
Recommendations
Consider using
amountOutMin
as paramter instead of hardcoding to 0The text was updated successfully, but these errors were encountered: