57057 sc low wrong order of balance checks in morphoyearnogwethstrategy
Description
Brief/Intro
Vulnerability Details
function _deallocate(uint256 amount) internal override returns (uint256) {
vault.withdraw(amount, address(this), address(this)); // Withdrawal happens FIRST
---> uint256 wethBalanceBefore = TokenUtils.safeBalanceOf(address(weth), address(this)); // "Before" balance recorded AFTER withdrawal
---> uint256 wethBalanceAfter = TokenUtils.safeBalanceOf(address(weth), address(this)); // "After" balance recorded AFTER withdrawal
uint256 wethRedeemed = wethBalanceAfter - wethBalanceBefore; // Always equals 0
if (wethRedeemed < amount) { // Always true (0 < amount)
emit StrategyDeallocationLoss("Strategy deallocation loss.", amount, wethRedeemed); // Always emitted
}
// ... rest of function
}Impact Details
References
Proof of Concept
Proof of Concept
Previous57662 sc critical portion of users alasset amount that staked in transmuter can be lost forever when amount cumulativeearmarked Next58093 sc medium morpho reward in morphoyearnogweth will be lost or stuck
Was this helpful?