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 check in few functions #147

Open
c4-bot-9 opened this issue Feb 29, 2024 · 3 comments
Open

Missing deadline check in few functions #147

c4-bot-9 opened this issue Feb 29, 2024 · 3 comments
Labels
bug Something isn't working downgraded by judge Judge downgraded the risk level of this issue duplicate-139 grade-a Q-07 QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax 🤖_63_group AI based duplicate group recommendation

Comments

@c4-bot-9
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2024-02-hydradx/blob/main/HydraDX-node/pallets/stableswap/src/lib.rs#L551-L842

Vulnerability details

Impact

Missing deadline check

Proof of Concept

Few functions don't have deadline parameter. This parameter can provide the user an option to limit the execution of their pending transaction.
Without a deadline parameter, users can execute their transactions at unexpected times when market conditions are unfavorable.

Function like do_add_liquidity(), do_add_liquidity_shares(), remove_liquidity_one_asset, withdraw_asset_amount(), sell() or buy() need to have deadline check.
However, this is not a big problem in this case because the functions have slippage protection. Even though the users will get at least as much as they set, they may still be missing out on positive slippage if the exchange rate becomes favorable when the transaction is included in a block.

Similar report in code4rena and the explanation why this is medium even though it has slippage protection: code-423n4/2023-08-pooltogether-findings#126 (comment)

Tools Used

Visual Studio Code

Recommended Mitigation Steps

Introduce a deadline parameter in these functions.

Assessed type

MEV

@c4-bot-9 c4-bot-9 added 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working labels Feb 29, 2024
c4-bot-9 added a commit that referenced this issue Feb 29, 2024
@c4-bot-11 c4-bot-11 added the 🤖_63_group AI based duplicate group recommendation label Mar 1, 2024
@c4-pre-sort
Copy link

0xRobocop marked the issue as duplicate of #139

@c4-judge c4-judge added downgraded by judge Judge downgraded the risk level of this issue QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax and removed 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value labels Mar 8, 2024
@c4-judge
Copy link

c4-judge commented Mar 8, 2024

OpenCoreCH changed the severity to QA (Quality Assurance)

@c4-judge
Copy link

c4-judge commented Mar 9, 2024

OpenCoreCH marked the issue as grade-b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working downgraded by judge Judge downgraded the risk level of this issue duplicate-139 grade-a Q-07 QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax 🤖_63_group AI based duplicate group recommendation
Projects
None yet
Development

No branches or pull requests

5 participants