Use safeTransfer / safeTransferFrom consistently instead of transfer / transferFrom
The contract uses transfer/transferFrom without checking return values in three places, which can cause silent failures of token transfers and affect token accounting. An attacker could exploit this to cause incorrect accounting or loss of funds.
NFTX contest
Originally disclosed on Code4rena
It is good to add a require() statement that checks the return value of token transfers, or to use something like OpenZeppelin’s safeTransfer/safeTransferFrom unless one is sure the given token reverts in case of a failure. Failure to do so will cause silent failures of transfers and affect token accounting in contract.
While most places use a require or safeTransfer/safeTransferFrom, there are three missing cases in the withdrawal of staking token and rescue of arbitrary tokens sent to the FeeDistributor contract.
Reference this similar medium-severity finding from Consensys Diligence Audit of Fei Protocol.
Recommend using safeTransfer/safeTransferFrom or require() consistently.
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 contract uses transfer/transferFrom without checking the return value in three specific functions.
What the attacker needed
None
The fix
The contract should use safeTransfer/safeTransferFrom or require() consistently to check return values.
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 tokens don't revert on failure; they just return false. If the contract ignores that return value, it may think a transfer succeeded when it didn't, leading to wrong balances. Using safeTransfer or checking the return value prevents this.
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.