56961 sc low incorrect balance snapshot check in deallocate logs false deallocation loss in morphoyearnogweth strategy
Description
Summary:
Vulnerability Details:
function _deallocate(uint256 amount) internal override returns (uint256) {
vault.withdraw(amount, address(this), address(this));
// @audit-insight incorrect logic: should check balance before and after withdraw
// The wethRedeemed will always be 0, thus incorrect deallocation log is emitted.
uint256 wethBalanceBefore = TokenUtils.safeBalanceOf(address(weth), address(this));
uint256 wethBalanceAfter = TokenUtils.safeBalanceOf(address(weth), address(this));
uint256 wethRedeemed = wethBalanceAfter - wethBalanceBefore;
console.log("WETH Redeemed:", wethRedeemed);
if (wethRedeemed < amount) {
emit StrategyDeallocationLoss("Strategy deallocation loss.", amount, wethRedeemed);
}
require(wethRedeemed + wethBalanceBefore >= amount, "Strategy balance is less than the amount needed");
require(
TokenUtils.safeBalanceOf(address(weth), address(this)) >= amount,
"Strategy balance is less than the amount needed"
);
TokenUtils.safeApprove(address(weth), msg.sender, amount);
return amount;
}Impact
Proof of Concept
Proof of Concept:
Recommended Mitigation:
Previous56732 sc critical incorrect boundary condition in querygraph leads to systematic under earmarking and transmuter redemption fund lossNext57791 sc insight receipt token misconfiguration in aave strategies
Was this helpful?