The TokenManager's tillIn()
function, which handles token transfers, relies on _safe_transfer
and _safe_transfer_from
. These functions use low-level calls to interact with token contracts but may incorrectly interpret failed transfers as successful for certain tokens, particularly those that don't conform strictly to the ERC20 standard (e.g., USDT).
The _safe_transfer
and _safe_transfer_from
functions in both TokenManager and Rescuable contracts use low-level call
to interact with token contracts.
They only check if the call was successful (bool success
), not if the actual transfer was completed.
Some tokens, like USDT, don't return a boolean value from their transfer functions, instead using return
without a value.
In such scenarios, when a transfer fails, success will still be true as the low-level call was completed successfully without reverting.
This vulnerability leads to a discrepancy between users' actual token balances and those recorded in userTokenBalanceMap
. This mismatch results in incorrect withdrawal amounts, which can affect the solvency of the protocol.
Manual Review
Use Safe Transfer Libraries:
One solution would be to use established libraries like OpenZeppelin's SafeERC20
which handle various token implementations safely.
I believe the issues and duplicates do not warrant low severity severity as even if the call to transfers returns false instead of reverting, there is no impact as it is arguably correct given there will be insufficient funds to perform a rescue/withdrawal. This will not affect `tillIn()` as there are explicit balance [checks that revert accordingly](https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/TokenManager.sol#L255-L260) to prevent allowing creation of offers without posting the necessary collateral
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.