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

Curly Myrtle Elk - Bracket::execute(...) does not strictly apply the minimum received amount check leading to unwanted reverts #879

Open
sherlock-admin3 opened this issue Dec 9, 2024 · 0 comments

Comments

@sherlock-admin3
Copy link
Contributor

Curly Myrtle Elk

Medium

Bracket::execute(...) does not strictly apply the minimum received amount check leading to unwanted reverts

Summary

Whenever swaps are executed in the Bracket contract, it compares the amountOut to a minimum amount based on the oracle. However, currently it only checks that the amount is > than the getMinAmountReceived amount. In a fast paced market environment, this can lead to unwanted reverts, as the exact minimum will not be taken into account.

Root Cause

https://github.com/sherlock-audit/2024-11-oku/blob/ee3f781a73d65e33fb452c9a44eb1337c5cfdbd6/oku-custom-order-types/contracts/automatedTrigger/Bracket.sol#L551
Usage of > instead of > in Bracket::execute(...)

Internal pre-conditions

N/A

External pre-conditions

  1. Volatile market conditions

Attack Path

  1. User sets a specific bip for a minimum return value.
  2. That value is reached when Bracket::execute is invoked.
  3. The actual amount is = to the getMinAmountReceived
  4. The transaction reverts as the require is not satisfied.

Impact

Unwanted reverts leading to decreased user earnings.

PoC

N/A

Mitigation

Use the >= comparison in Bracket::execute, when comparing finalTokenOut - initialTokenOut and MASTER.getMinAmountReceived(amountIn, tokenIn, tokenOut, bips)

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

No branches or pull requests

1 participant