Skip to content
This repository has been archived by the owner on Mar 3, 2024. It is now read-only.

0xComfyCat - LMPVaultRouterBase incorrectly handle WETH transfer #918

Closed
sherlock-admin opened this issue Aug 30, 2023 · 0 comments
Closed
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label High A valid High severity issue Reward A payout will be made for this issue

Comments

@sherlock-admin
Copy link
Contributor

sherlock-admin commented Aug 30, 2023

0xComfyCat

medium

LMPVaultRouterBase incorrectly handle WETH transfer

Summary

Vulnerability Detail

Supplying ETH via msg.value doesn't work since native ETH gets wrapped by internal function _processEthIn then it will attempt to transfer WETH from user via pullToken which result in the assets being transfer twice (both ETH and WETH)

Impact

Incorrect implementation causes contract to not function properly and initial ETH sent will be stuck in router contract

Code Snippet

        // handle possible eth
        _processEthIn(vault);  // @audit - ETH being wrapped

        IERC20 vaultAsset = IERC20(vault.asset());
        uint256 assets = vault.previewMint(shares);
        pullToken(vaultAsset, assets, address(this));  // @audit - WETH being transferred in

https://github.com/Tokemak/v2-core-audit-2023-07-14/blob/main/src/vault/LMPVaultRouterBase.sol#L29-L35

Tool used

Manual Review

Recommendation

skip pull WETH if WETH balance in contract as a result of wrapping is enough for assets amount

Duplicate of #1

@github-actions github-actions bot added High A valid High severity issue Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label labels Sep 11, 2023
@sherlock-admin2 sherlock-admin2 changed the title Sunny Blonde Dragon - LMPVaultRouterBase incorrectly handle WETH transfer 0xComfyCat - LMPVaultRouterBase incorrectly handle WETH transfer Oct 3, 2023
@sherlock-admin2 sherlock-admin2 added the Reward A payout will be made for this issue label Oct 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label High A valid High severity issue Reward A payout will be made for this issue
Projects
None yet
Development

No branches or pull requests

2 participants