Open hats-bug-reporter[bot] opened 2 months ago
Thank you for your report on the onERC1155Received call for groups in terminal path flows. After review, we've determined this is not an issue.
Your observation about the acceptance call being made with collateral tokens rather than the total amount of auto-minted group tokens is correct. This behavior is intentional, though we acknowledge the need for clearer documentation on this point.
We appreciate your careful examination of our ERC1155 implementation in the context of path transfers. Your input helps us improve our documentation and clarify system behaviors for developers. Thank you for your valuable contribution to this security review.
To provide more context on this behavior:
Our interpretation of the ERC1155 acceptance call in the context of path transfers aims to align with developer expectations with the concept of path transfers.
It's worth noting that we don't typically expect groups to be the end-receiver or terminal flow in a path. In fact, we anticipate that many group implementations may explicitly refuse the ERC1155 acceptance call to prevent direct token reception, as groups are primarily designed to define community rules.
However, we leave the final implementation decisions to developers building on top of our system. We will update our documentation to clearly explain this behavior and its implications for different use cases.
Thank you again for bringing this to our attention. Your insights help us improve the clarity and completeness of our documentation.
Github username: @MehdiKarimi81 Twitter username: -- Submission hash (on-chain): 0x4b9e542ceaaf5bad3d98a378c86f23387ce75fa1867f516981bb5a643d3007f9 Severity: medium
Description:
Description
During the
operateFlowMatrix
operation, when the receiver of a stream is a group, the tokens are transferred to the treasury, and group tokens (circles) are minted for the group.However, the _callAcceptanceChecks function calls
onERC1155Received
on the receiver (which is the group in this case) with the data of the transferred tokens. The issue is that the tokens are not actually transferred to the receiver but to the treasury, yetonERC1155Received
of the receiver is still called, even though the tokens have gone to the treasury.Note: The group tokens minted for the receiver have a different token ID.
Attack Scenario
Alice calls
operateFlowMatrix
to stream circle tokens (with token IDs 1 and 2, each 10 in quantity) to a receiver that is a group. Since the receiver is a group, the hub transfers the tokens to the treasury and mints group tokens for the receiver. For example, let’s assume the group token has a token ID of 3, so 20 circle tokens (with token ID 3) are minted for the receiver.Next,
_callAcceptanceChecks
calls onERC1155Received on the receiver with the data of the transferred tokens (in this case, token IDs 1 and 2, with 10 tokens each). Even though the tokens are transferred to the treasury, the receiver'sonERC1155Received
function is still called with the original token data.