02:53
SlowMist: The root cause of the yearn attack is that the Yearn yETH weighted stablecoin swap pool contract contains unsafe mathematical operations.
According to Jinse Finance, monitored by SlowMist, on December 1, the decentralized finance protocol Yearn suffered a hacker attack, resulting in a loss of approximately $9 million. The SlowMist security team analyzed the incident and confirmed the root cause as follows:
The vulnerability originated from the calcsupply function logic used to calculate supply in the Yearn yETH Weighted Stableswap Pool contract. Due to unsafe mathematical operations, the function allowed overflow and rounding errors during computation, resulting in a significant deviation in the product calculation between the new supply and the virtual balance. Attackers exploited this flaw to manipulate liquidity to specific values and excessively mint liquidity pool (LP) tokens, thereby profiting illegally.
It is recommended to enhance boundary scenario testing and adopt securely verified arithmetic mechanisms to prevent similar protocol vulnerabilities.
