Re-org attack in factory
The createClone function deploys a clone contract using create, so the address depends only on the PositionFactory nonce. An attacker could exploit a chain re-org to deploy a clone at the same address where a victim had already sent funds, potentially stealing those funds.
Submitted by 0xWeiss, also found by V_B, Breeje, and Proxy
The createClone function deploys a clone contract using the create, where the address derivation depends only on the PositionFactory nonce.
Re-orgs can happen in all EVM chains. In ethereum, where currently Frankencoin is deployed, it is not “super common” but it still happens, being the last one less than a year ago:
https://decrypt.co/101390/ethereum-beacon-chain-blockchain-reorg
The issue increases the changes of happening because frankencoin is thinking about deploying also in L2’s/ rollups, proof:
https://discord.com/channels/810916927919620096/1095308824354758696/1096693817450692658
where re-orgs have been much more active:
https://protos.com/polygon-hit-by-157-block-reorg-despite-hard-fork-to-reduce-reorgs/
being the last one, less than a year ago.
The issue would happen when users rely on the address derivation in advance or try to deploy the position clone with the same address on different EVM chains, any funds sent to the new clone could potentially be withdrawn by anyone else. All in all, it could lead to the theft of user funds.
As you can see in a previous report, the issue should be marked and judged as a medium:
Proof of Concept
Imagine that Alice deploys a position clone, and then sends funds to it. Bob sees that the network block reorg happens and calls clonePosition. Thus, it creates a position clone with an address to which Alice sends funds. Then Alice’s transactions are executed and Alice transfers funds to Bob’s position contract.
Recommended Mitigation Steps
The recommendation is basically the same as:
Deploy the cloned Position via create2 with a specific salt that includes msg.sender and address _existing
luziusmeisser (Frankencoin) confirmed
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 clone address is derived only from the factory nonce via create, so it is not bound to the caller or the intended position, allowing a re-org to change which contract occupies that address.
Impact
It could lead to the theft of user funds, though the text notes re-orgs are not super common on Ethereum and the risk increases if deployed on L2s/rollups where re-orgs are more active.
What the attacker needed
A chain re-org occurs; victim sends funds to a clone address; attacker can call clonePosition
The fix
The cloned Position should be deployed via create2 with a specific salt that includes msg.sender and the address _existing.
How it was found
- Alice deploys a position clone and sends funds to it.
- A network block re-org happens.
- Bob calls clonePosition to create a position clone at the address Alice sent funds to.
- Alice's transactions execute and she transfers funds to Bob's position contract.
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 blockchain re-org is when recent blocks are replaced, so some transactions may end up in a different order or be dropped. Here, a contract is created at an address that depends only on a counter, so after a re-org an attacker can create a different contract at the same address and take funds sent there.
What is Race condition?
Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.