Call to safeApprove without checking previous allowance in burnFees could result in locked funds #137
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
invalid
This doesn't seem right
Lines of code
https://github.com/code-423n4/2022-05-backd/blob/main/protocol/contracts/RewardHandler.sol#L52
Vulnerability details
Impact
Using this deprecated function can lead to unintended reverts and potentially the locking of funds. A deeper discussion on the deprecation of this function is in OZ issue #2219 (OpenZeppelin/openzeppelin-contracts#2219).
Proof Of Concept
Refer to the
burnFees
function on line 35 of theRewardHandler
contract (https://github.com/code-423n4/2022-05-backd/blob/main/protocol/contracts/RewardHandler.sol#L35-L55).Pool underlying tokens do correctly call the internal
_approve
function present in theRewardHandler
contract that performs an allowance check before callingsafeApprove
(https://github.com/code-423n4/2022-05-backd/blob/main/protocol/contracts/RewardHandler.sol#L46 & https://github.com/code-423n4/2022-05-backd/blob/main/protocol/contracts/RewardHandler.sol#L57-L65).Tools Used
vim
Recommended Mitigation Steps
One potential mitigation would be to replace usage of
safeApprove()
withsafeIncreaseAllowance()
orsafeDecreaseAllowance()
instead. However, in the context of theRewardHandler.sol
contract, it would be enough to use the internal_approve()
function that has the additional check to ensure no previous allowance is outstanding, therefore preventing the locking of funds.The text was updated successfully, but these errors were encountered: