MinTradingLimit
check can be bypassed in do_add_liquidity_shares()
#138
Labels
bug
Something isn't working
disagree with severity
Sponsor confirms validity, but disagrees with warden’s risk assessment (sponsor explain in comments)
downgraded by judge
Judge downgraded the risk level of this issue
grade-a
primary issue
Highest quality submission among a set of duplicates
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
🤖_23_group
AI based duplicate group recommendation
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/code-423n4/2024-02-hydradx/blob/main/HydraDX-node/pallets/stableswap/src/lib.rs#L1082-L1135
https://github.com/code-423n4/2024-02-hydradx/blob/main/HydraDX-node/pallets/stableswap/src/lib.rs#L1008-L1011
https://github.com/code-423n4/2024-02-hydradx/blob/main/HydraDX-node/pallets/stableswap/src/lib.rs#L155-L157
Vulnerability details
Impact
An important check(
MinTradingLimit
) can be bypassed.Proof of Concept
The function
do_add_liquidity_shares()
allow a liquidity provider to add liquidity to a selected pool and receive a precise amount of shares in return. The difference between this function anddo_add_liquidity()
is thatdo_add_liquidity_shares()
user can specify exact amount of shares to receive.But
do_add_liquidity_shares()
missingMinTradingLimit
check:We can see that this check has it in
do_add_liquidity()
:But this check completely misses in
do_add_liquidity_shares()
. This allows a user to bypass this important check and add liquidity below the minimum asset amount allowed by the protocol.Tools Used
Visual Studio Code
Recommended Mitigation Steps
Add a check for
MinTradingLimit
as you do indo_add_liquidity()
.Assessed type
Invalid Validation
The text was updated successfully, but these errors were encountered: