A malicious user can block remove_token
function in Omnipool by holding a tiny amount of shares
#144
Labels
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
duplicate-180
grade-a
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
🤖_26_group
AI based duplicate group recommendation
Lines of code
https://github.com/code-423n4/2024-02-hydradx/blob/main/HydraDX-node/pallets/omnipool/src/lib.rs#L1545-L1550
Vulnerability details
Impact
A malicious user can easily block the
remove_token()
function.Proof of Concept
In Omnipool we have
remove_token()
function which is used by the admin to remove a token:The asset or token to be removed must have its tradability status set to
FROZEN
and all remaining shares of the asset must belong to the protocol:This function can be potentially blocked if a malicious user holds a very small unit value of the shares. Since the function checks for exact equality between
asset_state.shares
andasset_state.protocol_shares
, even a minuscule amount of shares held outside the protocol can prevent the asset's removal. This situation could be exploited by malicious user.Tools Used
Visual Studio Code
Recommended Mitigation Steps
Allow a small tolerance in the shares comparison or introduce a mechanism to buy out or forcibly redeem the remaining shares under specific, strictly governed conditions.
Assessed type
Other
The text was updated successfully, but these errors were encountered: