Unsafe ERC20 methods
The contract uses standard ERC20 transfer and transferFrom methods, which can revert for tokens that do not follow the standard interface or that require zero allowance before approving a new amount. This could cause the contract to malfunction for certain tokens.
Source: https://github.com/sherlock-audit/2022-11-telcoin-judging/issues/82
Found by
WATCHPUG, aphak5010, 0xAgro, rotcivegaf, eierina, Deivitto, yixxas, rvierdiiev, hickuphh3, Mukund, hyh, 0xheynacho, pashov, 0x4non, Bnke0x0
Summary
Using unsafe ERC20 methods can revert the transaction for certain tokens.
Vulnerability Detail
There are many Weird ERC20 Tokens that won't work correctly using the standard IERC20 interface.
For example, IERC20(token).transferFrom() and IERC20(token).transfer() will fail for some tokens as they may not conform to the standard IERC20 interface. And if _aggregator does not always consume all the allowance given at L72, the transaction will also revert on the next call, because there are certain tokens that do not allow approval of a non-zero number when the current allowance is not zero (eg, USDT).
Impact
The contract will malfunction for certain tokens.
Code Snippet
Tool used
Manual Review
Recommendation
Consider using SafeERC20 for transferFrom, transfer and approve.
Discussion
amshirif
https://github.com/telcoin/telcoin-staking/pull/6
jack-the-pug
Fix confirmed
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
Impact
The contract will malfunction for certain tokens, potentially causing transactions to revert.
What the attacker needed
Contract interacts with a non-standard ERC20 token
The fix
The recommendation is to use SafeERC20 for transferFrom, transfer, and approve, and the fix was confirmed.
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 behave differently from the usual standard. The contract assumes all tokens work the same way, so when it tries to move or approve tokens that behave unusually, the whole transaction fails. This means the contract stops working for those tokens.
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.