hats-finance / Velvet-Capital-0x0bb0c08fd9eeaf190064f4c66f11d18182961f77

Core smart contracts of Velvet Capital
Other
0 stars 1 forks source link

multiTokenSwapAndTransfer is not checking that the `balance` and `data._depositAmount` are same #37

Open hats-bug-reporter[bot] opened 1 week ago

hats-bug-reporter[bot] commented 1 week ago

Github username: @aktech297 Twitter username: kaka Submission hash (on-chain): 0x7c5f8813e51765bc895774914befb1723bbc2ca6fad615dee5f53ab04aecf61e Severity: high

Description: Description\ multiTokenSwapAndTransfer is not checking for the data._depositAmount and balance are same.

First the function tansfer token from user for balance of data._depositAmount.

Later, in for loop it decode the token balance and use this to mint.

  if (_token == _depositToken) {
    //Sending encoded balance instead of swap calldata
    balance = abi.decode(data._callData[i], (uint256));
  } 

The issue is , data._depositAmount is very less like 1 wei. but the decoded balance big value.

so by tranferring small amount, user can mint large value. Attachments

  1. Proof of Concept (PoC) File code link

  2. Revised Code File (Optional) Check both amount values are same.

langnavina97 commented 6 days ago

There is no need to check if data._depositAmount and balance are equal. The depositAmount is only used to transfer the token to the batch contract if the input token is not ETH (native). The balance is calculated afterward to reflect the current balance of the deposit handler. @aktech297