Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

safeTransfer is recommended instead of transfer (1) #43

Closed
code423n4 opened this issue Apr 29, 2022 · 4 comments
Closed

safeTransfer is recommended instead of transfer (1) #43

code423n4 opened this issue Apr 29, 2022 · 4 comments
Labels
bug Something isn't working duplicate This issue or pull request already exists QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2022-04-mimo/blob/b18670f44d595483df2c0f76d1c57a7bfbfbc083/supervaults/contracts/SuperVault.sol#L233

Vulnerability details

Impact

ERC20 standard allows transfer function of some contracts to return bool or return nothing. Using safeTransfer of SafeERC20.sol is recommended instead.

Proof of Concept

https://github.com/OpenZeppelin/openzeppelin-contracts/blob/4a9cc8b4918ef3736229a5cc5a310bdc17bf759f/contracts/token/ERC20/utils/SafeERC20.sol

Tools Used

Recommended Mitigation Steps

Recommended code:
require(IERC20(a.stablex()).safeTransfer(msg.sender, IERC20(a.stablex()).balanceOf(address(this))));

@code423n4 code423n4 added 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 labels Apr 29, 2022
code423n4 added a commit that referenced this issue Apr 29, 2022
@m19 m19 added the duplicate This issue or pull request already exists label May 10, 2022
@m19
Copy link
Collaborator

m19 commented May 10, 2022

Duplicate of #124

@gzeoneth
Copy link
Member

gzeoneth commented Jun 5, 2022

Duplicate of #147

@gzeoneth gzeoneth marked this as a duplicate of #147 Jun 5, 2022
@gzeoneth gzeoneth reopened this Jun 5, 2022
@gzeoneth gzeoneth closed this as completed Jun 5, 2022
@gzeoneth gzeoneth added 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value and removed QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax labels Jun 5, 2022
@gzeoneth
Copy link
Member

gzeoneth commented Jun 5, 2022

Since the transfer should be one that accepted by the core protocol and according to https://github.com/code-423n4/2022-04-mimo/blob/b18670f44d595483df2c0f76d1c57a7bfbfbc083/core/config/deployment.ts#L65 it seems that all asset will revert upon failed transfer, this listing of new asset can be guarded by owner, downgrading to Low / QA.

@gzeoneth gzeoneth added QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax and removed 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value labels Jun 5, 2022
@gzeoneth
Copy link
Member

gzeoneth commented Jun 5, 2022

Consider with warden's' QA report #51

@gzeoneth gzeoneth marked this as a duplicate of #51 Jun 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
Projects
None yet
Development

No branches or pull requests

3 participants