Open code423n4 opened 3 years ago
cmichel
The DAO.handleTransferIn function approves the Router with a value of iBEP20(_token).totalSupply(), but only needs _amount.
DAO.handleTransferIn
Router
iBEP20(_token).totalSupply()
_amount
For safety, the approval should only be set to the lowest amount required.
Only approve _amount instead of the total token supply.
This is by design to reduce gas price. Router is apart of the protocol and thus can be approved max
Best practice, non-critical.
Handle
cmichel
Vulnerability details
Vulnerability Details
The
DAO.handleTransferIn
function approves theRouter
with a value ofiBEP20(_token).totalSupply()
, but only needs_amount
.Impact
For safety, the approval should only be set to the lowest amount required.
Recommended Mitigation Steps
Only approve
_amount
instead of the total token supply.