Closed code423n4 closed 2 years ago
The warden is correct to say that tokens with transfer fees will revert during _mintInternal, however, the execution path that causes the method to revert is actually here: https://github.com/notional-finance/contracts-v2/pull/99/files#diff-7a142e7e5b1d3b1189701a019061fe0eb4b24187fbf1380d9a8b19977a13a3aeR161-R162
Notional would never be able to pull the correct amount of underlying tokens because it is unaware of the fee.
_burn
would not revert in either case for because it does use balance before and balance after checks in order to transfer.
I'm going to mark this as confirmed for pointing out a potential edge case but the issue description is not correct. The consequence of this is that users would not be able to use any of the ERC4626 methods, they would only be able to mint via fCash transfers and mintViaAsset. Redemptions would work correctly.
Don't think it is very likely for Notional to integrate with fee-on-transfer token, downgrading to Low / QA.
Consider with #140
Lines of code
https://github.com/code-423n4/2022-06-notional-coop/blob/main/notional-wrapped-fcash/contracts/wfCashLogic.sol#L36-L102 https://github.com/code-423n4/2022-06-notional-coop/blob/main/notional-wrapped-fcash/contracts/wfCashLogic.sol#L200-L214
Vulnerability details
Impact
Some ERC20 tokens deduct fee on every transfer. mintViaUnderlying() function is called with a depositAmountExternal. Then mintViaUnderlying() calls _mintInternal() which transfers depositAmountExternal. The amount received by the contract would be less than the amount sent by the caller on FOT tokens. Hence, when user calls _burn() later on with the same amount, line 214 would revert.
Proof of Concept
https://github.com/code-423n4/2022-06-notional-coop/blob/main/notional-wrapped-fcash/contracts/wfCashLogic.sol#L36-L102
https://github.com/code-423n4/2022-06-notional-coop/blob/main/notional-wrapped-fcash/contracts/wfCashLogic.sol#L200-L214
Tools Used
Manual review
Recommended Mitigation Steps
I suggest to to compare the balance before and after to get the actual amount transferred after fee deduction.