_sendBadgerToTree will send BADGER twice and therefore fail.
It is sending it to the BADGER_TREE in _sendBadgerToTree, and then continues to send the same amount to the vault in _processExtraToken.
Impact
BADGER rewards cannot be claimed.
The contract is trying to send same amount twice - therefore the second transfer will fail.
(Unless there is extra BADGER in the contract, in which case there will be accounting errors.)
As we can see in the safeTransfer lines of the two functions, the BADGER amount is being sent in _sendBadgerToTree to BADGER_TREE and then it is being sent in _processExtraToken to the vault.
Recommended Mitigation Steps
I am not sure, but to my understanding you don't need to call _processExtraToken in _sendBadgerToTree, but only call IVault(vault).reportAdditionalToken(_token).
Lines of code
https://github.com/Badger-Finance/vested-aura/blob/v0.0.2/contracts/MyStrategy.sol#L428
Vulnerability details
_sendBadgerToTree
will send BADGER twice and therefore fail. It is sending it to theBADGER_TREE
in_sendBadgerToTree
, and then continues to send the same amount to the vault in_processExtraToken
.Impact
BADGER rewards cannot be claimed. The contract is trying to send same amount twice - therefore the second transfer will fail. (Unless there is extra BADGER in the contract, in which case there will be accounting errors.)
Proof of Concept
This is
_sendBadgerToTree
:And this is BaseStrategy's
_processExtraToken
:As we can see in the
safeTransfer
lines of the two functions, the BADGERamount
is being sent in_sendBadgerToTree
toBADGER_TREE
and then it is being sent in_processExtraToken
to the vault.Recommended Mitigation Steps
I am not sure, but to my understanding you don't need to call
_processExtraToken
in_sendBadgerToTree
, but only callIVault(vault).reportAdditionalToken(_token)
.