The withdrawCollateral function executes an unsafe transfer function on an ERC20 token. This does not take into account ERC20 tokens that return false instead of reverting on token transfer error. An example of this is USDT, it will return false instead of reverting on error.
Vulnerability Detail
Impact
Collateral could be lost and unable to be withdrawn
ArbitraryExecution
high
ERC20 token transfer can fail
Summary
The
withdrawCollateral
function executes an unsafetransfer
function on an ERC20 token. This does not take into account ERC20 tokens that returnfalse
instead of reverting on token transfer error. An example of this is USDT, it will returnfalse
instead of reverting on error.Vulnerability Detail
Impact
Collateral could be lost and unable to be withdrawn
Code Snippet
Tool used
Manual Review
Recommendation
Consider using the OpenZeppelin
safeTransferFrom
function when transferring ERC20 assetsDuplicate of #220