This repository has been archived by the owner on Mar 3, 2024. It is now read-only.
p0wd3r - Destination Vault rewards are not added to idleIncrease when info.totalAssetsPulled > info.totalAssetsToPull #5
Labels
Has Duplicates
A valid issue with 1+ other issues describing the same vulnerability
High
A valid High severity issue
Reward
A payout will be made for this issue
Sponsor Confirmed
The sponsor acknowledged this issue is valid
p0wd3r
high
Destination Vault rewards are not added to idleIncrease when info.totalAssetsPulled > info.totalAssetsToPull
Summary
Destination Vault rewards are not added to
idleIncrease
wheninfo.totalAssetsPulled > info.totalAssetsToPull
in_withdraw
ofLMPVault
.This result in rewards not being recorded by
LMPVault
and ultimately frozen in the contract.Vulnerability Detail
In the
_withdraw
function, Destination Vault rewards will be first recorded ininfo.IdleIncrease
byinfo.idleIncrease += _baseAsset.balanceOf(address(this)) - assetPreBal - assetPulled;
.But when
info.totalAssetsPulled > info.totalAssetsToPull
,info.idleIncrease
is directly assigned asinfo.totalAssetsPulled - info.totalAssetsToPull
, andinfo.totalAssetsPulled
isassetPulled
without considering Destination Vault rewards.https://github.com/sherlock-audit/2023-06-tokemak/blob/main/v2-core-audit-2023-07-14/src/vault/LMPVault.sol#L482-L497
For example,
The final
info.idleIncrease
does not record the reward, and these assets are not ultimately recorded by the Vault.Impact
The final
info.idleIncrease
does not record the reward, and these assets are not ultimately recorded by the Vault.Meanwhile, due to the
recover
function's inability to extract thebaseAsset
, this will result in no operations being able to handle these Destination Vault rewards, ultimately causing these assets to be frozen within the contract.Code Snippet
https://github.com/sherlock-audit/2023-06-tokemak/blob/main/v2-core-audit-2023-07-14/src/vault/LMPVault.sol#L482-L497
Tool used
Manual Review
Recommendation
info.idleIncrease = info.totalAssetsPulled - info.totalAssetsToPull;
->info.idleIncrease += info.totalAssetsPulled - info.totalAssetsToPull;
The text was updated successfully, but these errors were encountered: