A fork from the Gains Network, a suite of DeFi products operating on Polygon and Arbitrum, was reportedly enabling traders to achieve 10X returns on each transaction, irrespective of the token prices involved, as per blockchain security specialists.
Gains Network Infinite Money Glitch
Gains Network, which is tracked by DeFi Llama, has a total value locked (TVL) of $20.29 million. Since launching in May 2023, it has facilitated $25 billion in derivatives trading volume.
A report from Zellic on April 19 noted a significant vulnerability in a fork of the protocol that allowed an attacker to set an extremely high buy limit order, ensuring a win in every transaction.
Here’s the mechanism: When a trade was initiated, the protocol stored the stop-loss price in a variable called “currentPrice,” used to compute profit and loss. Therefore, if a user set their stop/loss price higher than the opening price, they could profit from every trade with no risk involved.
For instance, imagine Bitcoin was priced at $60,000. If a trader set their opening price at $59,000 and their stop/loss at $61,000, the trade would activate once the price hit $59,000. However, the price would already be under the stop-loss threshold, triggering an automatic closure of the trade.
Typically, this scenario should yield no profit. But in this case, since the stop-loss price of $61,000 was used as the “current price” by the system, it recorded a $2,000 profit for the trader.
Fixing The Bugs
If an attacker conducted numerous trades with excessively high stop/loss values, they could potentially deplete the entire fund of the protocol. Although the protocol incorporated a safeguard to prevent setting the stop-loss higher than the opening price of a buy order, additional loopholes were discovered that allowed attackers to circumvent this check.
According to Zellic, using specific numbers, traders could secure a profit margin of 900%.
This flaw was identified only in a fork of the Gains Network, not in the main Gains protocol. However, Zellic also detected a bug in an earlier version of the Gains protocol itself, which allowed traders to achieve 900% profits on sell orders.
Zellic notified various teams managing forks of the Gains Network, including Gambit Trade, Holdstation Exchange, and Krav Trade, about these vulnerabilities. These teams have confirmed that the issues have been addressed and their protocols are now secure. However, Zellic warned that other forks might still be vulnerable to similar exploits.