It is good to add a require() statement that checks the return value of token transfers or to use something like OpenZeppelin’s safeTransfer/safeTransferFrom unless one is sure the given token reverts in case of a failure. Failure to do so will cause silent failures of transfers and affect token accounting in contract.
Lines of code
https://github.com/code-423n4/2022-04-dualityfocus/blob/main/contracts/compound_rari_fork/CErc20.sol#L141-L145
Vulnerability details
Impact
It is good to add a require() statement that checks the return value of token transfers or to use something like OpenZeppelin’s safeTransfer/safeTransferFrom unless one is sure the given token reverts in case of a failure. Failure to do so will cause silent failures of transfers and affect token accounting in contract.
Proof of Concept
https://github.com/code-423n4/2022-04-dualityfocus/blob/main/contracts/compound_rari_fork/CErc20.sol#L141-L145 https://github.com/code-423n4/2022-04-dualityfocus/blob/main/contracts/vault_and_oracles/FlashLoan.sol#L57
Tools Used
None
Recommended Mitigation Steps
Consider using safeTransfer/safeTransferFrom or require() consistently.