Description:
The internal _swap
function contains logic that rewards users every 10 transactions. This mechanism can be exploited by performing numerous "dust" swaps—transactions involving very small amounts—to deplete the liquidity of the contract. This exploitation not only breaks the fundamental invariant of automated market makers (AMMs), where the product of the quantities of the two assets (X*Y = K
), but also facilitates the theft of liquidity provider (LP) funds.
Impact:
The primary consequence of this vulnerability is the violation of the core AMM invariant, leading to significant disruptions in the functioning of the liquidity pool. Moreover, malicious actors can drain the contract of its liquidity, effectively stealing funds from unsuspecting LPs. This breach of trust can severely damage the reputation of the platform and deter future participation.
Proof of Concept:
Although formal verification or stateful fuzz testing could rigorously prove this vulnerability, a simpler demonstration involves executing a series of minimal transactions to accumulate rewards disproportionately to the value contributed to the pool. Here's a conceptual test illustrating the exploit:
Recommended Mitigation:
To safeguard against this vulnerability, the incentive mechanism tied to transaction counts should be removed. Instead, consider alternative methods to incentivize users to perform swaps within your AMM. These could include tiered fee structures based on volume, loyalty programs, or other mechanisms that do not reward based solely on the frequency of transactions. Such alternatives can ensure that incentives align with the health and sustainability of the liquidity pool, discouraging exploitative behavior while still encouraging participation.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.