Open hats-bug-reporter[bot] opened 1 month ago
ERC1155 standard
In onERC1155Received function, attacker can call personalMint() like "personalMint() reentrancy attack #8". So re-entrancy attack is available and attacker can mint without gas. It's good to consider to check tx.origin == msg.sender.
it is generally unadvised to rely on tx.origin
. But even then, not an issue. Don't send tokens to an attacker contract.
It is not bad to check tx.origin == msg.sender. I know that and I don't recommend to rely on tx.origin. I think user can trust attacker. Attacker doesn't destroy user's account or steal tokens. If user trust attacker, attacker can mint without consuming gas and interacting with contract.
I think it can be low risk at least. Attacker can deceive user and he can mint without interacting with system.
Attacker can mint without interacting with system. This behavior differs from the intended behavior. So I think it can be low risk. And it can be solved by using one modifier(check tx.origin == msg.sender) in personal mint function(and other important functions).
Github username: -- Twitter username: -- Submission hash (on-chain): 0x3ca345215bbf885a0ea3fded4f4ff9376d376cf07673e830734fad89d452b4d7 Severity: medium
Description: Description\ Because of IERC1155Receiver(to).onERC1155Received function, recevier can do its own operations. If user calls operateFlowMatrix and sends circle through attacker, attacker can do it without gas.
Attack Scenario\ User call operateFlowMatrix and send circles through attacker.\ operateFlowMatrix()=>_callAcceptanceChecks()=>_acceptanceCheck()=>_doSafeTransferAcceptanceCheck()=>IERC1155Receiver(to).onERC1155Received(operator, from, id, value, data)\ In this function attacker can do operations but he doesn't consume gas. All gas fee will be paid by user. For example, he can call personalmint() In the future, it can cause very dangerous problems like re-entrancy attacks.
Consider to check tx.origin == msg.sender in important public/external functions.
Attachments
Proof of Concept (PoC) File
Revised Code File (Optional)