Closed code423n4 closed 2 years ago
Completely disagree as the warden contradicts themselves in the finding,
As they shown prepareWithdrawAll
doesn't check for pausing allowing to unlock tokens
Notice additionally that the entire pause and withdrawAll debate is needles
We need to be able to pause, but to unpause and unlock can be done via a multicall
or a smart contract to automate operations, as such I fully disagree with the finding
Lines of code
https://github.com/Badger-Finance/vested-aura/blob/d504684e4f9b56660a9e6c6dfb839dcebac3c174/contracts/MyStrategy.sol#L182-L190 https://github.com/Badger-Finance/vested-aura/blob/d504684e4f9b56660a9e6c6dfb839dcebac3c174/contracts/MyStrategy.sol#L177-L179 https://github.com/Badger-Finance/vested-aura/blob/d504684e4f9b56660a9e6c6dfb839dcebac3c174/contracts/MyStrategy.sol#L372-L375
Vulnerability details
Impact
Usually, in emergency situations, contracts will be
paused
by the owner to prevent further damage.To withdraw all funds, the
MyStrategy.prepareWithdrawAll
function has to be manually called right beforeBaseStrategy.withdrawToVault
can be called (see comment).This will fail as
MyStrategy.manualProcessExpiredLocks
(called withinMyStrategy.prepareWithdrawAll
) has the modifierwhenNotPaused
, hence, due to the contract beingpaused
, will revert.Additionally, the
BaseStrategy.withdrawToVault
function call is initiated byvault
, butvault
can notunpause
the contract, only authorizedpausers
(guardian and governance) are able to pause/unpause.Unpausing in emergency situations is also not recommended, as this could lead to further damage.
Proof of Concept
MyStrategy._withdrawAll
MyStrategy.prepareWithdrawAll
MyStrategy.manualProcessExpiredLocks
Tools Used
Manual review
Recommended mitigation steps
Call
LOCKER.processExpiredLocks(false);
inMyStrategy._withdrawAll
directly.