rageQuit() cannot transfer ERC1155 fungible tokens
The rageQuit function only supports ETH and ERC20 tokens, so users cannot withdraw their fair share of ERC1155 fungible tokens. This means a rage quitter loses their entitlement to those tokens.
Submitted by d3e4
Rage quitter loses his ERC1155 fungible tokens.
Proof of Concept
PartyGovernanceNFT is PartyGovernance which is an ERC1155Receiver. But rageQuit() only sends ETH, with call(), and ERC20-tokens, with transfer(). ERC1155-tokens are transferred by safeTransferFrom() and its balanceOf()also takes an uint256 _id parameter. This means that the rage quitter cannot withdraw any of his fair share of ERC1155 fungible tokens.
Recommended Mitigation Steps
Include support for ERC1155 in rageQuit().
0xble (Party) acknowledged and commented:
This is by design, feel like this should be a QA.
ERC1155 tokens are tricky because they sometimes behave like NFTs and other times like ERC20s. If they are not fungible, they shouldn’t be allowed to be taken out of the treasury during rage quit so that makes allowing them to be rage-quitted dependent on how the 1155 is implemented.
@0xble - If the ERC1155 is non-fungible, the contract will only own a single token. Any share less than the whole will be rounded down to zero tokens sent when rage quitting. The same calculation can be used for ERC1155 tokens as for ERC20 tokens, without having to explicitly consider whether they are fungible or not.
cccz (judge) increased severity to Medium and commented:
I would say this is an undocumented value leakage issue, the contract is designed to receive ERC1155, and the documentation says the user can withdraw fungible tokens on rage quit.
ERC1155s aren’t always fungible and we knew this when designing it. Sometimes they behave like ERC20s and other times as ERC721s. If it was the latter, it would lead to a loss of funds.
Agree with you, but a value leak does exist here that meets the C4 medium risk criteria. And the following suggestion I think is appropriate:
ERC1155 tokens are tricky because they sometimes behave like NFTs and other times like ERC20s. If they are not fungible, they shouldn’t be allowed to be taken out of the treasury during rage quit so that makes allowing them to be rage-quitted dependent on how the 1155 is implemented.
If the ERC1155 is non-fungible the contract will only own a single token, so any share less than the whole will be rounded down to zero tokens sent when rage quitting. So exactly the same calculation can be used for ERC1155 tokens as for ERC20 tokens, without having to explicitly consider whether they are fungible or not.
Note: for full discussion, see here.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the rageQuit function was not designed to handle ERC1155 tokens, only ETH and ERC20, so it lacks the necessary transfer logic.
Impact
A user who rage quits cannot withdraw their fair share of ERC1155 fungible tokens, resulting in a loss of funds for that user.
What the attacker needed
Contract holds ERC1155 tokens; user initiates rage quit
The fix
The contract should be updated to support ERC1155 token transfers in rageQuit, using the same proportional calculation as for ERC20 tokens.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A smart contract lets people leave a group and take their share of the group's money. The contract can hold a type of token called ERC1155, but the leaving function only pays out in two other kinds of money, so people leaving cannot get their share of the ERC1155 tokens. They lose that value.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.