Closed 0xRizwan closed 9 months ago
I understand that you want to provide value with a research, a bit in-depth analysis to the codebase and accomplish rewards + take part on the repo, this is great, but it's better job to please take time to asses the codebase a bit further.
We already implement most of this standard security compliants by OpenZeppelin on the repo
# Issue was not closed as completed. Skipping.
@molecula451 @pavlovcik
I have checked it. transfer() should be replaced with safeTransfer()
which is from already imported safeERC20.sol.
@rndquu rfc
I have checked it. transfer() should be replaced with
safeTransfer()
which is from already imported safeERC20.sol.
There is no need to do when we globally use SafeERC20 for all IERC20 interfaces solidity automatically enables this to the state interface e.g IERC20, so all .transfer()
are basically .safeTransfer()
transfer()
call results should be checkedI would close the current issue as "not planned"
Title
Transfer returned value is not checked in
LibStaking.crvPriceReset()
Severity
Medium
Vulnerability details
LibStaking.crvPriceReset()
is used to remove 3CRV unilaterally (ts.token1) from the curve LP share sitting inside the staking contract and send the 3CRV received to the treasury address.The issue here is with the use of unsafe
transfer()
function. Curve tri-pool supports DAI, USDC, USDT stablecoins and this issue is about non-standard behavior of USDT.The ERC20.transfer() function return a boolean value indicating success. This parameter needs to be checked for success. Per EIP20.
transfer()
function is given below,and USDT
transfer()
function looks as below,Therefore, tokens (like USDT) don't correctly implement the EIP20 standard and their transfer() function return void instead of a success boolean. Calling these functions with the correct EIP20 function signatures will always revert. as USDT transfer do not revert if the transfer failed.
Tokens that don't actually perform the transfer and return false are still counted as a correct transfer and tokens that don't correctly implement the latest EIP20 spec, like USDT, will be unusable in the protocol as they revert the transaction because of the missing return value.
Impact
Tokens that don't actually perform the transfer and return false are still counted as a correct transfer and tokens that don't correctly implement the latest EIP20 spec will be unusable in the protocol as they revert the transaction because of the missing return value.
Recommendation
Recommend using
safeTransfer()
function from already imported OpenZeppelin's SafeERC20.sol that handle the return value check as well as non-standard-compliant tokens.cc- @pavlovcik @molecula451