Tadle

Tadle
DeFiFoundry
27,750 USDC
View results
Submission Details
Severity: high
Invalid

Users will not be able to withdraw their ETH on zksync

Line Of Code*

https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/TokenManager.sol#L169

https://github.com/Cyfrin/2024-08-tadle#compatibilities

Summary

Use of .transfer, while not advisable, still works on almost all EVMs. However, since the protocol plans on deploying on any EVM compatible chain, and that includes zksync, users will not be able to withdraw their ETH there as the .transfer opcode doesn't work there.

Vulnerability Details

For context, the codebase is going to be deployed on any EVM and and also works with ETH.

TokenManager.sol uses the .transfer opcode to handle ETH transfer when withdrawing ETH, which according to the bot report is not advisable, due to the gas being sent is not enough. However, on most chains, this will still work, especially if the recipients are EOAs or don't require as much gas.

function withdraw(
address _tokenAddress,
TokenBalanceType _tokenBalanceType
) external whenNotPaused {
//...
IWrappedNativeToken(wrappedNativeToken).withdraw(claimAbleAmount);
payable(msg.sender).transfer(claimAbleAmount);
//...

On zksync however, due to its gas dynamic meterring, .transfer does not work at all. More information about this can be found here. Note that this is not due to a future increase in opcodes costs.

Impact

Since withdraw is the way for users to get their tokens out of the protcol, on zksync, users will not be able to withdraw their ETH leading to loss of funds.

Tools Used

Manual Review

Recommendations

Use .call instead or allow transfer of wrapped native token.

Updates

Lead Judging Commences

0xnevi Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Known issue

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.