fCash of the wrong maturity and asset can be sent to wrapper address before wrapper is deployed
A wrapper contract's address can be precomputed because it is deployed with create2. An attacker can send fCash of the wrong maturity or asset to that address before deployment, so the ERC1155 receiver hook is not called. After deployment, the contract's balance check sees more than one asset and always reverts, making minting impossible.
Submitted by 0x52, also found by jonah1005 and unforgiven
Minting becomes impossible
Proof of Concept
onERC1155Received is only called when the size of the code deployed at the address contains code. Since create2 is used to deploy the contract, the address can be calculated before the contract is deployed. A malicious actor could send the address fCash of a different maturity or asset before the contract is deployed and since nothing has been deployed, onERC1155Received will not be called and the address will accept the fCash. After the contract is deployed and correct fCash is sent to the address, onERC1155Received will check the length of the assets held by the address and it will be more than 1 (fCash of correct asset and maturity and fCash with wrong maturity or asset sent before deployment). This will cause the contract to always revert essentially breaking the mint completely.
Recommended Mitigation Steps
When the contract is created create a function that reads how many fCash assets are at the address and send them away if they aren’t of the correct asset and maturity
jeffywu (Notional) confirmed, but disagreed with severity and commented:
I will need to write a PoC to confirm that this is the case but it seems plausible to me.
Based on the Judging Criteria, this does not result in loss of funds. This will result in a loss of availability (available funds actually increase).
My opinion is medium severity.
gzeoneth (judge) decreased severity to Medium and commented:
Judging this as Med Risk due to no loss of funds and only possible before contract deployment.
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 contract assumes it will only ever hold one fCash asset and reverts if its balance contains more than one, but it does not clean up tokens sent before deployment.
Impact
Minting becomes impossible, causing a loss of availability but no loss of funds; the issue is only possible before contract deployment.
What the attacker needed
Attacker can precompute the wrapper address; attacker can send fCash before deployment; no special privileges needed
The fix
When the contract is created, it should check how many fCash assets it holds and send away any that are not of the correct asset and maturity.
How it was found
- Calculate the wrapper contract address before deployment using create2.
- Send fCash of a different maturity or asset to that address before the contract is deployed.
- Deploy the wrapper contract.
- Send the correct fCash to the address; the receiver hook sees more than one asset and reverts.
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 can be deployed at a predictable address before it exists. If someone sends tokens to that address early, the contract's normal safety check does not run because there is no code yet. Later, the contract sees unexpected tokens and refuses to work, so users cannot mint.
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.