Unsafe handling of underlying tokens
The contract does not check the return value of ERC20 transferFrom calls, so a token that returns false instead of reverting can be used to initiate a trade without actually transferring the underlying tokens.
Submitted by 0xsanson, also found by 0xRajeev, cmichel, defsec, GalloDaSballo, JMukesh, leastwood, loop, nikitastupin, pants, and pauliax.
Impact
Not every ERC20 token follows OpenZeppelin’s recommendation. It’s possible (inside ERC20 standard) that a transferFrom doesn’t revert upon failure but returns false.
The code doesn’t check these return values. For example uToken.transferFrom(msg.sender, o.maker, a); in initiateVaultFillingZcTokenInitiate can be exploited by the msg.sender to initiate a trade without sending any underlying.
Proof of Concept
grep 'transfer' Swivel.sol
Tools Used
editor
Recommended Mitigation Steps
Consider using OpenZeppelin’s library with safe versions of transfer functions.
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
The contract calls ERC20 transferFrom without verifying its boolean return value, so a token that returns false on failure is treated as successful.
Impact
An attacker could initiate a trade without sending any underlying tokens, potentially obtaining the trade's benefits without paying.
What the attacker needed
A token that returns false on failed transferFrom; ability to call initiateVaultFillingZcTokenInitiate
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.
Some digital tokens (ERC20) can fail a transfer by returning 'false' instead of stopping with an error. If a smart contract does not check that return value, it may think the transfer succeeded when it did not. An attacker can then start a trade without actually sending the tokens they were supposed to.
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.