58313 sc medium incorrect allocation accounting and dust handling in stargateethpoolstrategy causes systematic loss cap mis accounting and deallocation reverts
Description
Brief/Intro
Vulnerability Details
47:58:src/strategies/optimism/StargateEthPoolStrategy.sol
function _allocate(uint256 amount) internal override returns (uint256) {
require(TokenUtils.safeBalanceOf(address(weth), address(this)) >= amount, "not enough WETH");
// unwrap to native ETH for Pool Native
weth.withdraw(amount);
uint256 amountToDeposit = (amount / 1e12) * 1e12;
uint256 dust = amount - amountToDeposit;
if (dust > 0) {
emit StrategyAllocationLoss("Strategy allocation loss due to rounding.", amount, amountToDeposit);
}
pool.deposit{value: amountToDeposit}(address(this), amountToDeposit);
return amount;
}Impact Details
References
Link to Proof of Concept
Proof of Concept
Proof of Concept
Previous57954 sc high lackf of tracking of excess cover in earmark function leads to permanent loss of cover value and stuck user positions Next57476 sc high forcerepay fails to decrement global cumulativeearmarked
Was this helpful?