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

Missing Deadline Checks Allow Pending Transactions to be Maliciously Executed #137

Open
hats-bug-reporter bot opened this issue Jun 16, 2024 · 2 comments
Labels
bug Something isn't working low

Comments

@hats-bug-reporter
Copy link

Github username: @0xmahdirostami
Twitter username: 0xmahdirostami
Submission hash (on-chain): 0x6527a4a1918635e5e5bc8e452b168130541067cc339a7d72bd0abeb48174c691
Severity: high

Description:
Description:
There are multiple functions in the contract that lack deadline checks, potentially causing issues. For example, although the buyFor and sellFor functions implement _minAmountOut checks, the absence of a deadline check in these functions can result in a loss of funds for the user.

Scenario:

  1. A user calculates that for 1000 _depositAmount, they will receive 900 shares at time A.
  2. The user submits a buy order with 900 as _minAmountOut.
  3. The transaction is submitted to the mempool. However, the user chose a transaction fee that is too low for miners to prioritize, causing the transaction to stay pending in the mempool for extended periods (hours, days, weeks, or longer).
  4. When the average gas fee drops enough for the transaction to become interesting to miners, the price of each share has dropped. If recalculated, the user would see they could now get 950 shares.
  5. However, the transaction was submitted with 900 as _minAmountOut, resulting in an execution that may not reflect the user's current expectations.
  6. An even worse scenario involves MEV (Miner Extractable Value) exploitation, where malicious actors could deliberately execute the pending transaction at a time that benefits them.

Impact:
The lack of deadline checks can lead to loss of funds for users due to outdated slippage parameters, especially in volatile markets or during extended transaction delays.

Mitigation:
Introduce a deadline parameter to the buyFor and sellFor functions to ensure that transactions are executed within an acceptable time frame.

@hats-bug-reporter hats-bug-reporter bot added the bug Something isn't working label Jun 16, 2024
@FHieser
Copy link

FHieser commented Jun 26, 2024

This issue is essentially criticizing the mempool and fee structure that is inherent in the system.
The minAmount out basically allows the user to specify with what amount the user is content with. This includes state where he has to wait for the transaction to run through. Also if he already waits a week he could just teminate his transaction and readd a new one

I would agree that a deadline parameter would be a nice to have, but thats it, a nice to have and not an issue

@FHieser FHieser added the invalid This doesn't seem right label Jun 26, 2024
@0xmahdirostami
Copy link

@0xmahdirostami 0xmahdirostami removed the invalid This doesn't seem right label Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working low
Projects
None yet
Development

No branches or pull requests

3 participants