Certain ERC20 tokens, such as STA
and PAXG
, and potentially USDT
and USDC
in the future, implement fee-on-transfer mechanisms. When a user attempts to withdraw these tokens, the transaction fails.
The vulnerability occurs in the TokenManager::tillIn
function, which is responsible for transferring tokens from the msg.sender
to the Capital Pool:
When handling ERC20 tokens, the function uses _transfer
, but it fails for fee-on-transfer tokens. The issue arises because the balances before and after the transfer do not match as expected:
The transaction wil revert because the toBalanceAft < toBalanceBef + _amount
.
The TokenManager.tillIn()
function will revert in the _transfer
when transferring a fee-on-transfer token as it assumes the entire amount was received.
Manual code review
To support fee-on-transfer tokens, measure the asset change right before and after the asset-transferring calls and use the difference as the actual bonded amount.
Valid medium, there are disruptions to the ability to take market actions. The following functions will be disrupted without the possibiliy of reaching settlement, since the respective offers cannot be created/listed regardless of mode when transferring collateral token required to the CapitalPool contract or when refunding token from user to capital pool during relisting. So withdrawal is not an issue - `createOffer()` - reverts [here](https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/PreMarkets.sol#L96-L102) - `listOffer()` - reverts [here](https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/PreMarkets.sol#L355-L362) - `relistOffer()` - reverts [here](https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/PreMarkets.sol#L515-L521) - `createTaker()` - reverts [here](https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/PreMarkets.sol#L831-L836) I believe medium severity is appropriate although the likelihood is high and impact is medium (only some level of disruption i.e. FOT tokens not supported and no funds at risk)
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.