_updateVirtualPrice would always revert for some curve pools
Proof of Concept
In EthSafeStableCurveOracle.sol, the _updateVirtualPrice function calls remove_liquidity with 0 as the amount to lock the curve pool and prevent reentrancy attacks. However, for certain Curve pools like the CRV/ETH pool (0x8301ae4fc9c624d1d396cbdaa1ed877821d7c511, https://curve.fi/#/ethereum/pools/crveth/) calling remove_liquidity(0, [0,0]) always reverts due to an underflow.
Tools Used
Manual review
Recommended Mitigation Steps
Use the claim_admin_fees function instead of remove_liquidity.
Lines of code
https://github.com/code-423n4/2023-07-amphora/blob/daae020331404647c661ab534d20093c875483e1/core/solidity/contracts/periphery/oracles/EthSafeStableCurveOracle.sol#L36-L44
Vulnerability details
Impact
_updateVirtualPrice
would always revert for some curve poolsProof of Concept
In
EthSafeStableCurveOracle.sol
, the_updateVirtualPrice
function callsremove_liquidity
with 0 as the amount to lock the curve pool and prevent reentrancy attacks. However, for certain Curve pools like the CRV/ETH pool (0x8301ae4fc9c624d1d396cbdaa1ed877821d7c511, https://curve.fi/#/ethereum/pools/crveth/) calling remove_liquidity(0, [0,0]) always reverts due to an underflow.Tools Used
Manual review
Recommended Mitigation Steps
Use the
claim_admin_fees
function instead ofremove_liquidity
.Assessed type
Under/Overflow