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

Lack of Safe calls #12

Closed
code423n4 opened this issue Dec 9, 2021 · 2 comments
Closed

Lack of Safe calls #12

code423n4 opened this issue Dec 9, 2021 · 2 comments
Labels
1 (Low Risk) Assets are not at risk. State handling, function incorrect as to spec, issues with comments bug Something isn't working duplicate This issue or pull request already exists sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue

Comments

@code423n4
Copy link
Contributor

Handle

0x1f8b

Vulnerability details

Impact

In some cases, they may not make the transfers or approvals.

Proof of Concept

The definition of the ERC-20 standard states that the transfer and transferFrom methods must return a boolean value that determines whether the result was successful or not.
Throughout the audited contracts there are calls to the transfer methods that do not verify this result, leaving the open possibility that the execution is not as expected by the developer.

We recommend that you check the returned value using the require clause or to unify these calls by using the safeTransfer and safeTransferFrom wrappers of OpenZeppelin.

Source reference:

  • SavingsAccountUtil.savingsAccountTransfer => L75 transfer, L77 transferFrom
  • CreditLine._transferCollateral => L976 transfer
  • CreditLine._depositCollateralFromSavingsAccount => L498 transferFrom
  • CreditLine._repayFromSavingsAccount => L754 transferFrom
  • CreditLine._depositCollateral => L647 approve
  • CreditLine._repay => L779 approve
  • AaveYield._depositERC20 => L297-298 approve
  • AaveYield._withdrawETH => L307 approve
  • CompoundYield._depositERC20 => L211-212 approve
  • YearnYield._depositERC20 => L210-211 approve

Tools Used

Manual review

Recommended Mitigation Steps

Use safeTransfer, safeApprove and safeTransferFrom

@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 Dec 9, 2021
code423n4 added a commit that referenced this issue Dec 9, 2021
@ritik99 ritik99 added sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue duplicate This issue or pull request already exists labels Dec 25, 2021
@ritik99
Copy link
Collaborator

ritik99 commented Dec 25, 2021

The transferFrom and transfer implementations are our own (here and here), the issue with approves we're following the recommendations and references provided in #2. Hence we're marking this as disputed and duplicate

@0xean
Copy link
Collaborator

0xean commented Jan 21, 2022

dupe of #2

@0xean 0xean added 1 (Low Risk) Assets are not at risk. State handling, function incorrect as to spec, issues with comments and removed 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value labels Jan 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 (Low Risk) Assets are not at risk. State handling, function incorrect as to spec, issues with comments bug Something isn't working duplicate This issue or pull request already exists sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue
Projects
None yet
Development

No branches or pull requests

4 participants