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

QA Report #255

Closed
code423n4 opened this issue Jun 19, 2022 · 5 comments
Closed

QA Report #255

code423n4 opened this issue Jun 19, 2022 · 5 comments
Labels
bug Something isn't working invalid This doesn't seem right

Comments

@code423n4
Copy link
Contributor

code423n4 commented Jun 19, 2022

safeApprove() for may revert

Lines of code

https://github.com/code-423n4/2022-06-connext/blob/20f86d58444d7c8178735ada7e456a3112116e54/contracts/contracts/core/connext/libraries/AssetLogic.sol#L347

Vulnerability details

Impact

safeApprove function prevents changing an allowance between non-zero values to mitigate a possible front-running attack. It reverts if that is the case. Instead, the safeIncreaseAllowance and safeDecreaseAllowance functions should be used. Comment from the OZ library for this function: “// safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and ‘safeDecreaseAllowance'"

Proof of Concept

https://github.com/code-423n4/2022-06-connext/blob/20f86d58444d7c8178735ada7e456a3112116e54/contracts/contracts/core/connext/libraries/AssetLogic.sol#L347

https://github.com/OpenZeppelin/openzeppelin-contracts/blob/6842518b1b71fac9a21c7d94ec521992cff266b5/contracts/token/ERC20/utils/SafeERC20.sol#L44-L57

Tools Used

Manual Analysis

Recommended Mitigation Steps

Use safeIncreaseAllowance() function instead of safeApprove().

@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 Jun 19, 2022
code423n4 added a commit that referenced this issue Jun 19, 2022
@ecmendenhall
Copy link

Duplicate of #154

@jakekidd jakekidd added duplicate This issue or pull request already exists and removed duplicate This issue or pull request already exists labels Jun 24, 2022
@jakekidd
Copy link
Collaborator

Closed as duplicate of #154

@0xleastwood
Copy link
Collaborator

No mention of what impact this will have on the protocol's users and their respective funds. This isn't simply a revert issue, this legitimately breaks the flow of bridge transfers under certain token implementations.

@0xleastwood
Copy link
Collaborator

Downgrading to QA.

@0xleastwood 0xleastwood added QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax and removed duplicate This issue or pull request already exists 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value labels Aug 12, 2022
@0xleastwood 0xleastwood changed the title safeApprove() for may revert QA Report Aug 12, 2022
@0xleastwood 0xleastwood reopened this Aug 12, 2022
@0xleastwood
Copy link
Collaborator

However, the warden submitted multiple QA reports. As such, this will not be judged.

@0xleastwood 0xleastwood added invalid This doesn't seem right and removed QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax labels Aug 12, 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 invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

4 participants