Lowering amplification allows attackers to steal funds #14
Labels
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
duplicate-96
grade-a
Q-18
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
🤖_14_group
AI based duplicate group recommendation
Lines of code
https://github.com/code-423n4/2024-02-hydradx/blob/603187123a20e0cb8a7ea85c6a6d718429caad8d/HydraDX-node/pallets/stableswap/src/lib.rs#L433-L438
Vulnerability details
Impact
Attackers can steal funds by performing two swaps before and after the AMP is reduced. For more information, please see https://medium.com/@peter_4205/curve-vulnerability-report-a1d7630140ec.
Proof of Concept
HydraDX-node/pallets/stableswap/src/tests/trades.rs
.Run
cargo test --package pallet-stableswap --lib -- tests::trades::test_steal_funds_amp --exact --nocapture
.Output
Tools Used
Manual review.
Recommended Mitigation Steps
Consider applying the following recommendations:
current_amplification
andfinal_amplification
is within an allowed range.Example: https://github.com/curvefi/curve-contract/blob/b0bbf77f8f93c9c5f4e415bce9cd71f0cdee960e/contracts/pool-templates/a/SwapTemplateA.vy#L979-L982
https://github.com/curvefi/curve-contract/blob/b0bbf77f8f93c9c5f4e415bce9cd71f0cdee960e/contracts/pool-templates/a/SwapTemplateA.vy#L972-L973
Assessed type
Other
The text was updated successfully, but these errors were encountered: