Fee-on-transfer tokens support must be forbidden or allowed with amount update #18
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
duplicate
This issue or pull request already exists
sponsor disputed
Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue
Lines of code
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289//contracts/AuraBalRewardPool.sol#L126
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289//contracts/AuraBalRewardPool.sol#L146
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289//contracts/AuraBalRewardPool.sol#L162
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289//contracts/AuraBalRewardPool.sol#L185
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289//contracts/AuraBalRewardPool.sol#L198
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289//contracts/AuraClaimZap.sol#L202
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289//contracts/AuraClaimZap.sol#L223
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289//contracts/AuraLocker.sol#L234
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289//contracts/AuraLocker.sol#L251
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289//contracts/AuraLocker.sol#L314
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289//contracts/AuraLocker.sol#L367
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289//contracts/AuraLocker.sol#L448
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289//contracts/AuraLocker.sol#L456
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289//contracts/AuraLocker.sol#L826
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289//contracts/AuraLocker.sol#L857
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289/contracts/AuraMerkleDrop.sol#L100
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289/contracts/AuraMerkleDrop.sol#L138
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289/contracts/AuraMerkleDrop.sol#L153
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289/contracts/AuraStakingProxy.sol#L162
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289/contracts/AuraStakingProxy.sol#L190
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289/contracts/AuraStakingProxy.sol#L212
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289/contracts/AuraVestedEscrow.sol#L108
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289/contracts/AuraVestedEscrow.sol#L123
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289/contracts/AuraVestedEscrow.sol#L189
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289/contracts/BalLiquidityProvider.sol#L91
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289/contracts/CrvDepositorWrapper.sol#L79
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289/contracts/ExtraRewardsDistributor.sol#L93
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289/contracts/ExtraRewardsDistributor.sol#L154
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289//convex-platform/contracts/contracts/ArbitartorVault.sol#L57
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289//convex-platform/contracts/contracts/BaseRewardPool.sol#L179
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289//convex-platform/contracts/contracts/BaseRewardPool.sol#L198
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289//convex-platform/contracts/contracts/BaseRewardPool.sol#L237
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289//convex-platform/contracts/contracts/BaseRewardPool.sol#L289
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289//convex-platform/contracts/contracts/BaseRewardPool.sol#L315
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289//convex-platform/contracts/contracts/BaseRewardPool4626.sol#L56
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289//convex-platform/contracts/contracts/Booster.sol#L404
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289//convex-platform/contracts/contracts/Booster.sol#L476
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289//convex-platform/contracts/contracts/Booster.sol#L606
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289//convex-platform/contracts/contracts/Booster.sol#L613
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289//convex-platform/contracts/contracts/Booster.sol#L617
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289//convex-platform/contracts/contracts/Booster.sol#L621
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289//convex-platform/contracts/contracts/Booster.sol#L625
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289//convex-platform/contracts/contracts/Booster.sol#L658
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289//convex-platform/contracts/contracts/ConvexMasterChef.sol#L221
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289//convex-platform/contracts/contracts/ConvexMasterChef.sol#L250
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289//convex-platform/contracts/contracts/ConvexMasterChef.sol#L286
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289//convex-platform/contracts/contracts/ConvexMasterChef.sol#L302
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289//convex-platform/contracts/contracts/ConvexMasterChef.sol#L304
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289//convex-platform/contracts/contracts/CrvDepositor.sol#L114
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289//convex-platform/contracts/contracts/CrvDepositor.sol#L173
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289//convex-platform/contracts/contracts/CrvDepositor.sol#L182
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289//convex-platform/contracts/contracts/ExtraRewardStashV3.sol#L209
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289//convex-platform/contracts/contracts/ExtraRewardStashV3.sol#L215
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289//convex-platform/contracts/contracts/RewardHook.sol#L49
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289//convex-platform/contracts/contracts/VirtualBalanceRewardPool.sol#L198
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289//convex-platform/contracts/contracts/VirtualBalanceRewardPool.sol#L208
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289//convex-platform/contracts/contracts/VoterProxy.sol#L213
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289//convex-platform/contracts/contracts/VoterProxy.sol#L311
https://github.com/code-423n4/2022-05-aura/blob/085f573756b132b2a5992c5aa5d7b907cd11c289//convex-platform/contracts/contracts/VoterProxy.sol#L337
Vulnerability details
Impact
Every time transferFrom or transfer function in ERC20 standard is called there is a possibility that underlying smart contract did not transfer the exact amount entered.
It is required to find out contract balance increase/decrease after the transfer to allow fee-on-transfer tokens or forbid non-standard tokens.
This pattern also prevents from re-entrancy attack vector.
Proof of Concept
POC (re-entrancy for fee-on-transfer tokens):
Attacker could run re-entrancy and boosting deposits in the storage while transferring nothing.
At the end drain tokenOut (if it is DEX) or withdraw something else based on large deposit.
Tools Used
Recommended Mitigation Steps
There are several possible scenarios to prevent that.
If there is fee-on-transfer you can throw a require not allowing to use such token in the system while still saving lots of gas checking it only once.
Or if you still want to allow fee-on-transfer tokens, amount variable must be updated to the balance difference after and before transfer.
Recommended example code:
The text was updated successfully, but these errors were encountered: