Calls to get_virtual_price()
are vulnerable to read-only reentrancy
#215
Labels
get_virtual_price()
are vulnerable to read-only reentrancy
#215
Lines of code
117
Vulnerability details
get_virtual_price()
was originally considered to be a manipulation-resistant price - suitable as a price oracle, but it was later found to be vulnerable to a read-only reentrancy attack, where the Curve contract could be put into a partially-modified state, and an attacker could gain control via the raw external callremove_liquidity()
makes. The attacker could use this to artificially inflate the price of the LP token/its balance, and use the inflated balance to take out loans which become undercollateralized at the end of the transaction, or to buy assets at exchange rates not actually available on the open market. In order to protect against the attack, many protocols calluint256[2] calldata amts; ICurvePool(token).remove_liquidity(0, amts);
prior to callingget_virtual_price()
since callingremove_liquidity()
will ensure, via a reentrancy guard, that the user isn't currently manipulating the value, and since amounts are zero, it has no other effect. Another alternative is to call v1pool.claim_admin_fees()
or to call v2ICurveOwner(pool.owner()).withdraw_admin_fees(address(pool))
.Assessed type
other
The text was updated successfully, but these errors were encountered: