You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 12, 2025. It is now read-only.
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA Medium severity issue.RewardA payout will be made for this issue
MasterChef doesn't fully support fee on transfer tokens which could lead to potential loss of funds.
Vulnerability Detail
MasterChef supports all kinds of ERC20 tokens - including Fee On Transfer tokens, but in code it's not fully supported. Because provided amounts are written inside farm.amounts field based on amount parameter provided by user and not by real amount received by the contract - it would create difference between token amounts accounted by contract and real tokens amount inside the contract. More context here - https://github.com/d-xo/weird-erc20#fee-on-transfer.
Impact
User assets can stuck inside a protocol because of the difference between real amount of tokens inside contract and amount of tokens accounted by protocol.
Calculate difference between balance of the contract before safeTransfer and after it - the difference would be actual amount of tokens that MasterChef received.
sherlock-admin4
changed the title
Damp Basil Wolverine - Fee on transfer tokens are not supported
typicalHuman - Fee on transfer tokens are not supported
Jul 29, 2024
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA Medium severity issue.RewardA payout will be made for this issue
typicalHuman
Medium
Fee on transfer tokens are not supported
Summary
MasterChef doesn't fully support fee on transfer tokens which could lead to potential loss of funds.
Vulnerability Detail
MasterChef supports all kinds of ERC20 tokens - including Fee On Transfer tokens, but in code it's not fully supported. Because provided amounts are written inside farm.amounts field based on amount parameter provided by user and not by real amount received by the contract - it would create difference between token amounts accounted by contract and real tokens amount inside the contract. More context here - https://github.com/d-xo/weird-erc20#fee-on-transfer.
Impact
User assets can stuck inside a protocol because of the difference between real amount of tokens inside contract and amount of tokens accounted by protocol.
Code Snippet
https://github.com/sherlock-audit/2024-06-magicsea/blob/main/magicsea-staking/src/MasterchefV2.sol#L544
PoC
Add mock fee on transfer token to test/mocks:
Add new file to test folder:
Tool used
Foundry.
Recommendation
Calculate difference between balance of the contract before safeTransfer and after it - the difference would be actual amount of tokens that MasterChef received.
Duplicate of #545
The text was updated successfully, but these errors were encountered: