If token == BADGER
, the _handleRewardTransfer
function does not work
#142
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
duplicate
This issue or pull request already exists
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
valid
Lines of code
MyStrategy.sol#L405-L413
BaseStrategy.sol#L346-L353
Vault.sol#L396-L415
Vulnerability details
Impact
In
MyStrategy.sol
, when claiming bribes or sweeping reward tokens, the_handleRewardTransfer
function is called which calls_sendToBadgerTree
to send theamount
ofBADGER
in the contract to theBADGER_TREE
. However, the_processExtraToken
(inBaseStrategy.sol
) called after the transfer toBADGER_TREE
will attempt to transfer the same amount ofBADGER
to the vault.This leads to the
sweepRewardToken
,sweepRewards
andclaimBribesFromHiddenHand
functions not working properly ifBADGER
is claimed.Proof of Concept
The tests do not consider when the contract contains
BADGER
tokens, so theBADGER
token should be added in theconftest.py
test file.Test code added to
conftest.py
:BADGER
tokens should then be sent to the strategy contract and an attempt to sweep theBADGER
should fail.Test code added to
test_custom.py
:Recommended Mitigation Steps
The purpose of the
_processExtraToken
function inBaseStrategy.sol
seems to be to forward the extra token (BADGER) to theBADGER_TREE
and to process fees. This should mean that the transfer to BADGER_TREE in _sendBadgerToTree is not necessary and can be removed.The text was updated successfully, but these errors were encountered: