You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The broker's swapIn or swapOut functions cannot be used.
Summary
An attacker can make it impossible to pass the Limits by continuously swapping a small number of tokens, thus making the swapIn or swapOut functions unusable.
Root Cause
When tradingLimitState is updated, if _deltaFlow is very small, the calculation of _deltaFlowUnits will be 0 due to the trade-off problem. At this time, deltaFlowUnits will be counted as 1 (tokenIn), so an attacker can use 1 tokenIn to increase netflow.
Continuously call the swapIn function with amountIn = 1 to make netflow0, netflow1, or netflowGlobal reach the limit
Impact
The netflow increases due to low-quality swapIn transactions (amountIn == 1), which will cause swapIn transactions to be unable to proceed due to restrictions for a certain period of time, or swapIn transactions to be affected. Even if swapOut transactions reduce netflow, attackers can still increase netflow again through low-quality swapIn transactions (amountIn == 1).
The text was updated successfully, but these errors were encountered:
sherlock-admin3
changed the title
Passive Aquamarine Beetle - The broker's swapIn or swapOut functions cannot be used.
steadyman - The broker's swapIn or swapOut functions cannot be used.
Nov 5, 2024
steadyman
Medium
The broker's swapIn or swapOut functions cannot be used.
Summary
An attacker can make it impossible to pass the Limits by continuously swapping a small number of tokens, thus making the swapIn or swapOut functions unusable.
Root Cause
When tradingLimitState is updated, if _deltaFlow is very small, the calculation of _deltaFlowUnits will be 0 due to the trade-off problem. At this time, deltaFlowUnits will be counted as 1 (tokenIn), so an attacker can use 1 tokenIn to increase netflow.
https://github.com/sherlock-audit/2024-10-mento-update/blob/main/mento-core/contracts/libraries/TradingLimits.sol#L124
Internal pre-conditions
No response
External pre-conditions
Gas price is very low
Attack Path
Continuously call the swapIn function with amountIn = 1 to make netflow0, netflow1, or netflowGlobal reach the limit
Impact
The netflow increases due to low-quality swapIn transactions (amountIn == 1), which will cause swapIn transactions to be unable to proceed due to restrictions for a certain period of time, or swapIn transactions to be affected. Even if swapOut transactions reduce netflow, attackers can still increase netflow again through low-quality swapIn transactions (amountIn == 1).
PoC
No response
Mitigation
Set the AMOUNT_MIN variable
The text was updated successfully, but these errors were encountered: