code-423n4 / 2021-12-amun-findings

0 stars 0 forks source link

Wrapped native token is assumed as the `INTERMEDIATE_TOKEN` #190

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

Handle

cmichel

Vulnerability details

The EthSingleTokenJoin contract (and the other similar join contracts) allow any _INTERMEDIATE_TOKEN to be set by the constructor but the code only works if it's the wrapped native token (WETH or equivalent for other chains) due to the calls to .withdraw and the fallback function which is assumed to deposit.

Impact

The contract will not fail early if a wrong INTERMEDIATE_TOKEN is set, it'll only be noticeable later when the actual joinTokenEth function is called.

Recommended Mitigation Steps

Hardcode the wrapped native token address based on the chain id.