Funds cannot be withdrawn in CoreCollection.withdraw
The withdraw function of the CoreCollection contract moved tokens using transferFrom from the contract to its owner, but many ERC20 tokens require an allowance for that call, which the contract never grants to itself. As a result the withdrawal reverts and the funds stay locked in the contract.
Submitted by ych18, also found by hickuphh3 and WatchPug
The CoreCollection.withdraw function uses payableToken.transferFrom(address(this), msg.sender, amount) to transfer tokens from the CoreCollection contract to the msg.sender ( who is the owner of the contract). The usage of transferFrom can result in serious issues. In fact, many ERC20 always require that in transferFrom allowance[from][msg.sender] >= amount, so in this case the call to the withdraw function will revert as the allowance[CoreCollection][CoreCollection] == 0 and therefore the funds cannot ben withdrawn and will be locked forever in the contract.
Recommendation
Replace transferFrom with transfer
sofianeOuafir (Joyn) confirmed and commented:
duplicate of #52
deluca-mike (judge) commented:
This is not a duplicate, as it pertains to the wrong use of transfer vs transferFrom, which can have implications regarding required allowances.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the developer used transferFrom instead of transfer when sending tokens out of the contract, so the call depends on an allowance that does not exist.
Impact
Withdrawals revert for tokens that enforce allowances, so the funds could be locked in the contract permanently.
What the attacker needed
Contract holds ERC20 tokens; token enforces allowance in transferFrom
The fix
The withdrawal should use transfer instead of transferFrom.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A smart contract can hold tokens, and its owner should be able to take them out. The code used a token function meant for moving someone else's tokens, which needs that someone to have given permission first. The contract never gave itself permission, so the transfer fails and the money is stuck.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.