Era

ZKsync
FoundryLayer 2
500,000 USDC
View results
Submission Details
Severity: medium
Valid

`withdrawToken` fails to work

Summary

withdrawToken function of L2AssetRouter calls _ensureTokenRegisteredWithNTV to receive registered assetId, but it always return zero because of incorrect implementation, which makes the transaction revert always.

Vulnerability Details

function _ensureTokenRegisteredWithNTV(address _token) internal override returns (bytes32 assetId) {
IL2NativeTokenVault nativeTokenVault = IL2NativeTokenVault(L2_NATIVE_TOKEN_VAULT_ADDR);
nativeTokenVault.ensureTokenIsRegistered(_token);
}

The _ensureTokenRegisteredWithNTV is supposed to check if a token is registered with NTV and return assetId at the end so it can be used in withdrawToken function.

However, it does not assign any value to assetId which returns zero.

Impact

withdrawToken does not work.

Tools Used

Manual Review

Recommendations

_ensureTokenRegisteredWithNTV function should return registered assetId after validation.

Updates

Lead Judging Commences

inallhonesty Lead Judge 5 months ago
Submission Judgement Published
Validated
Assigned finding tags:

`L2AssetRouter._ensureTokenRegisteredWithNTV` `assetId` return value is never assigned, which will cause `withdrawToken` to fail

Appeal created

inallhonesty Lead Judge
5 months ago
inallhonesty Lead Judge 5 months ago
Submission Judgement Published
Validated
Assigned finding tags:

`L2AssetRouter._ensureTokenRegisteredWithNTV` `assetId` return value is never assigned, which will cause `withdrawToken` to fail

Support

FAQs

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