Open code423n4 opened 1 year ago
kirk-baird changed the severity to QA (Quality Assurance)
waynehoover marked the issue as sponsor acknowledged
This previously downgraded issue has been upgraded by kirk-baird
This previously downgraded issue has been upgraded by kirk-baird
kirk-baird marked the issue as primary issue
kirk-baird marked the issue as satisfactory
kirk-baird marked issue #454 as primary and marked this issue as a duplicate of 454
kirk-baird changed the severity to QA (Quality Assurance)
Lines of code
https://github.com/rabbitholegg/quest-protocol/blob/8c4c1f71221570b14a0479c216583342bd652d8d/contracts/Erc20Quest.sol#L67 https://github.com/rabbitholegg/quest-protocol/blob/8c4c1f71221570b14a0479c216583342bd652d8d/contracts/Erc20Quest.sol#L86 https://github.com/rabbitholegg/quest-protocol/blob/8c4c1f71221570b14a0479c216583342bd652d8d/contracts/Erc20Quest.sol#L103
Vulnerability details
Some tokens take a transfer fee (e.g.
STA
,PAXG
), some do not currently charge a fee but may do so in the future (e.g.USDT
,USDC
). Though the Rabbithole protocol first checks if the ERC20 token is added torewardAllowlist
however it is very likely that fee on transfer tokens get added. USDT/USDC are very popular options to be added and in future when they start charging fee on transfer, the rabbithole protocol will behave unexpectedly at several points.The Rabbithole protocol does not appear to support rebasing/deflationary/inflationary tokens whose balance changes during transfers or over time. The necessary checks include at least verifying the amount of tokens transferred to contracts before and after the actual transfer to infer any fees/interest.
Proof of Concept
https://github.com/rabbitholegg/quest-protocol/blob/8c4c1f71221570b14a0479c216583342bd652d8d/contracts/Erc20Quest.sol#L67 https://github.com/rabbitholegg/quest-protocol/blob/8c4c1f71221570b14a0479c216583342bd652d8d/contracts/Erc20Quest.sol#L86 https://github.com/rabbitholegg/quest-protocol/blob/8c4c1f71221570b14a0479c216583342bd652d8d/contracts/Erc20Quest.sol#L103
Recommended Mitigation Steps
Example code to mitigate :