Report ID
#43089
Report Type
Smart Contract
Has PoC
Yes
Target
https://arbiscan.io/address/0xba150052e11591D0648b17A0E608511874921CBC
Impacts
Griefing (e.g. no profit motive for an attacker, but damage to the users or the protocol)
Details
The Stable2 contract contains an integer overflow vulnerability where the amplification parameter calculation Ann = a * N * N can overflow if the value of a is sufficiently large. If triggered, this would cause core contract functions to fail, rendering the protocol unusable for liquidity provision and swaps, and also pricing operations.
Vulnerability Details
In the Stable2 contract, a critical value Ann is calculated as a * N * N, where N is a constant set to 2 and a is an amplification parameter retrieved from a lookup table during contract initialization:
The vulnerability exists because there's no validation that a is small enough to prevent overflow when multiplied by N * N = 4. If the lookup table returns a value of a โฅ 2^254, then a * 4 would overflow a uint256. While Solidity 0.8.20 includes built-in overflow protection that causes the transaction to revert rather than silently overflow, this doesn't solve the issues.
Impact Details
If this vulnerability is exploited:
- Smart Contract Inability to Operate: Core functions like
calcLpTokenSupply and calcReserve would revert on every call, preventing users from adding/removing liquidity or performing swaps. - Griefing Potential: An attacker with influence over the lookup table could set an excessive
a value to cause persistent contract failures without direct financial gain. - Service Denial: The Well would become completely unusable for liquidity provision and trading.
It doesn't directly lead to theft of funds but could effectively freeze protocol operations through denial of service.
References
- https://arbiscan.io/address/0xba150052e11591D0648b17A0E608511874921CBC?utm_source=immunefi#code#F1#L60
- https://arbiscan.io/address/0xba150052e11591D0648b17A0E608511874921CBC?utm_source=immunefi#code#F1#L76
Proof of Concept
Test Results