Description:Description\
the minter.sol implements/uses the somate's safeTransferLib library for ETH and Erc20 transfer.but solmate has well known vulnerability i.e the safetransfer and safetransferfrom don't check the existence of code at the token address.
Hence this may lead to miscalculation of funds and may lead to loss of funds, because if safetransfer() and safetransferfrom() are called on a token address that doesn't have a contract in it, it will always return success, bypassing the return value check. Due to this protocol will think that funds have been transferred successfully, and records will be accordingly calculated, but in reality, funds were never transferred. So this will lead to miscalculation and possibly loss of funds
below are links to the Same issue which was discovered during contest
Github username: -- Twitter username: -- Submission hash (on-chain): 0x5e3a6ad894ae8b390b43a269685160a4bc2f4a5262b06d213c8706113c13b74b Severity: medium
Description: Description\ the
minter.sol
implements/uses the somate'ssafeTransferLib
library for ETH and Erc20 transfer.but solmate has well known vulnerability i.e thesafetransfer
andsafetransferfrom
don't check the existence of code at the token address.Hence this may lead to miscalculation of funds and may lead to loss of funds, because if
safetransfer()
andsafetransferfrom()
are called on a token address that doesn't have a contract in it, it will always return success, bypassing the return value check. Due to this protocol will think that funds have been transferred successfully, and records will be accordingly calculated, but in reality, funds were never transferred. So this will lead to miscalculation and possibly loss of fundsbelow are links to the Same issue which was discovered during contest
https://github.com/sherlock-audit/2022-11-bond-judging/issues/8
https://github.com/code-423n4/2022-08-olympus-findings/issues/117
Attack Scenario\ Describe how the vulnerability can be exploited.
Attachments
https://github.com/hats-finance/Accumulated-finance-0x75278bcc0fa7c9e3af98654bce195eaf3bb6a784/blob/fea3cdcd7693e95c7ddcfa4c79df9b5fa715aafc/contracts/Minter.sol#L2032C5-L2050C6
https://github.com/hats-finance/Accumulated-finance-0x75278bcc0fa7c9e3af98654bce195eaf3bb6a784/blob/fea3cdcd7693e95c7ddcfa4c79df9b5fa715aafc/contracts/Minter.sol#L1940C5-L1947C14
https://github.com/hats-finance/Accumulated-finance-0x75278bcc0fa7c9e3af98654bce195eaf3bb6a784/blob/fea3cdcd7693e95c7ddcfa4c79df9b5fa715aafc/contracts/Minter.sol#L1920C4-L1929C1
https://github.com/hats-finance/Accumulated-finance-0x75278bcc0fa7c9e3af98654bce195eaf3bb6a784/blob/fea3cdcd7693e95c7ddcfa4c79df9b5fa715aafc/contracts/Minter.sol#L1880C5-L1885C6
https://github.com/hats-finance/Accumulated-finance-0x75278bcc0fa7c9e3af98654bce195eaf3bb6a784/blob/fea3cdcd7693e95c7ddcfa4c79df9b5fa715aafc/contracts/Minter.sol#L1871C5-L1878C6
and more functions implement the safe functions