-
Notifications
You must be signed in to change notification settings - Fork 0
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
Direct WETH swap fails due to incompatibility with ZetaTokenConsumerUniV3
& ZetaTokenConsumerPancakeV3
#422
Comments
DadeKuma marked the issue as insufficient quality report |
0xean marked the issue as unsatisfactory: |
This seems false:
And the poc is insufficient as it's just a list of code references. |
This is not false, all references stated in the POC section are lines of code in the codebase within scope that require a WETH/WETH pool. When the Input token is WETH, it attempts to first swap to WETH, then to ZETA. This was explained above with all the points that this happened listed in the POC section . As at the time of this submission, there was no requirement for a compulsory coded POC but this can be provided. Still, I leave this to the judge. Thanks |
more evidence would certainly have been welcomed, but I do follow the wardens belief that this would cause an issue when attempting to call getZetaFromToken() and the input is WETH. Reaching out to sponsor for comment (@lumtis ) |
0xean removed the grade |
0xean marked the issue as satisfactory |
lumtis (sponsor) confirmed |
0xean marked the issue as selected for report |
Lines of code
https://github.com/code-423n4/2023-11-zetachain/blob/b237708ed5e86f12c4bddabddfd42f001e81941a/repos/protocol-contracts/contracts/evm/tools/ZetaTokenConsumerUniV3.strategy.sol#L98-L122
https://github.com/code-423n4/2023-11-zetachain/blob/b237708ed5e86f12c4bddabddfd42f001e81941a/repos/protocol-contracts/contracts/evm/tools/ZetaTokenConsumerUniV3.strategy.sol#L158-L182
Vulnerability details
Impact
User use the
ZetaTokenConsumerUniV3.sol
to get the zeta tokens. Either through ETH or through other ERC20 tokens.One of the most important tokens in Defi today is the WETH token, all swaps in the codebase to/from ZETA are routed through the ZETA/WETH pool. However this contact, as well as the
ZetaTokenConsumerPancakeV3
and theZetaTokenConsumerTrident
do not permit users to swap WETH directly to ZETA.This is because of an oversight in the swap function that require the existence of a WETH/WETH pool.
As seen below, when the input/output token is WETH, the function will revert:
Proof of Concept
From the Pancake V3 factory and Uni V3 factory contracts, it is evident that pools cannot be created for a token with itself. Therefore users cannot swap WETH to WETH thereby breaking the path needed to swap WETH to Zeta or vice versa.
In the code base, the issue is present:
Tools Used
Manual Review
Recommended Mitigation Steps
Implement a check to see if the input/output token is WETH, if so, perform the swap directly between WETH and ZETA without a second swap.
Assessed type
Other
The text was updated successfully, but these errors were encountered: