The transferErcTokens function calls IERC20(tokenInfo.erc20Address).transferFrom to transfer ERC20 tokens but does not provide a descriptive revert error if the transfer fails. This can lead to silent failures, making it difficult to diagnose issues and potentially leaving the contract in an inconsistent state.
The transferErcTokens
function updates the sender's and recipient's balances before calling transferFrom
. If the transferFrom
call fails (e.g., due to insufficient allowance or a non-compliant ERC20 token), the function reverts with a generic error message, making it difficult to diagnose the issue. This can result in silent failures, where the contract state (e.g., balances) is updated even though the token transfer was unsuccessful.
Exploit Scenario:
A user calls transferErcTokens
to transfer ERC20 tokens. 2. The transferFrom
call fails (e.g., due to insufficient allowance or a non-compliant token).
The function reverts with a generic error message, making it difficult to diagnose the issue.
The balances may already be updated, leading to inconsistencies and potential fund loss.
Medium Impact: Funds are indirectly at risk if the transfer fails silently. The contract's state (balances) may become inconsistent if the transfer fails but the balances are already updated.
State Inconsistency: Users may lose funds if the transfer fails without a clear error message, and the contract state may not reflect the actual token balances.
Diagnostic Challenges: Silent failures make it difficult to diagnose issues, leading to poor user experience and potential financial losses.
Manual Review, Foundry
Medium Impact: Funds are indirectly at risk if the transfer fails silently. The contract's state (balances) may become inconsistent if the transfer fails but the balances are already updated.
State Inconsistency: Users may lose funds if the transfer fails without a clear error message, and the contract state may not reflect the actual token balances.
Diagnostic Challenges: Silent failures make it difficult to diagnose issues, leading to poor user experience and potential financial losses.
Additional Considerations:
Use OpenZeppelin's SafeERC20 library to handle non-compliant ERC20 tokens and ensure safe transfers.
Emit an event for failed transfers to improve transparency and debugging:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.