Submitted by WatchPug, also found by gellej, Czar102, hyh, harleythedog, pauliax, cmichel, 0x1f8b, hickuphh3, cccz, and sirhashalot
In TokenSaleUpgradeable.sol#buy(), tokenIn will be transferred from the buyer directly to the saleRecipient without requiring/locking/releasing the corresponding amount of tokenOut.
This allows the saleRecipient to rug the users simply by not transferring tokenOut and finalizing the sale.
Given:
A malicious saleRecipient can just not transfer any CTDL to the contract and finalize() and keep 300e8 WBTC received.
As a result, Alice and Bob can not get the expected amount of tokensOut, and there is no way to retrieve the WBTC paid, in essence, lose all the funds.
Instead of transferring the tokenIn directing to the saleRecipient in buy(), consider transferring the tokenIn into the contract (address(this)), and require a sufficient amount of tokenOut to be transferred into the contract first before the amount of tokenIn can be released to the saleRecipient.
shuklaayush (BadgerDAO) disagreed with severity
0xleastwood (judge) decreased severity to Medium and commented:
0xleastwood (judge) commented:
