An illustrative incident occurred on the BNB Smart Chain blockchain, once again reminding the community of the critical importance of smart contract auditing. The attacker managed to withdraw approximately $578,000 from the liquidity pool of the LULA token without even hacking the decentralized exchange PancakeSwap itself. The attack was made possible solely due to an error in the token's own code.
Attack Mechanics: Reserve Manipulation via recycle()
The exploit was based on the recycle() function embedded in the LULA contract. This function granted the Rental contract two dangerous permissions:
- Directly withdraw LULA tokens from the PancakeSwap V2 liquidity pool.
- Call the sync() function, which forcibly synchronizes the pool's internal accounting reserves with its actual, already distorted state.
Imagine the pool as a scale with two pans: one with USDT, the other with LULA. The price is determined by their ratio. An ordinary trader can only exchange coins between the pans. recycle() allowed removing tokens from one pan from the side, while sync() forced the scale to recognize the new, depleted position as fair.
Step-by-Step Manipulation Scheme
Transaction analysis reveals a clear sequence:
- Inflating the USDT reserve: The hacker made a large exchange of USDT for LULA, artificially increasing the stablecoin's share in the pool.
- Cyclical depletion: Repeated calls to recycle() systematically reduced the LULA reserve, making the remaining tokens increasingly scarce.
- Theft at an inflated price: The attacker then exchanged a small amount of LULA back for USDT. Due to the artificially created scarcity of LULA, each token was sold at a fictitiously inflated rate, which generated the main profit.
Preparation: 12 Days of Planning
This attack was not spontaneous. 12 days before the main strike, the hacker deployed auxiliary contracts to accumulate referral and team rewards in the protocol. The right to these payouts became the entry point: the claimReward() → recycle() chain allowed maximizing the deflationary effect—reducing the number of tokens in circulation.
For the final stage, a flash loan of approximately $237 million was used. This tool, requiring no own capital, allowed amplifying the withdrawal of LULA from the pool, significantly increasing the efficiency of the recycle() calls.
Cryptalist Expert Opinion: This incident is a classic example of how a vulnerability at the token level jeopardizes the entire DeFi ecosystem. Projects launching tokens with non-standard functions, such as recycle(), should undergo not just an audit, but stress testing for liquidity pool manipulation. Investors should remember: even the most reliable DEX will not protect against errors in the asset's own code.