Cross-chain replay attacks are possible with deployLPToken
The deployLPToken function does not include the chain ID in the data it uses to create a new LP token, so if a user deploys on the wrong network, an attacker can replay the same action on the correct chain and steal the funds. The report references a similar attack on a Gnosis Safe.
Originally disclosed on Code4rena
Submitted by 0xSmartContract
Mistakes made on one chain can be re-applied to a new chain. There is no chain.id in the data.
If a user does deployLPToken using the wrong network, an attacker can replay the action on the correct chain, and steal the funds a-la the wintermute gnosis safe attack, where the attacker can create the same address that the user tried to, and steal the funds from there
https://mirror.xyz/0xbuidlerdao.eth/lOE5VN-BHI0olGOXe27F0auviIuoSlnou_9t3XRJseY
Proof of Concept
contracts/liquid-staking/LPTokenFactory.sol:
26 /// @param _tokenName Name of the LP token to be deployed
27: function deployLPToken(
28: address _deployer,
29: address _transferHookProcessor,
30: string calldata _tokenSymbol,
31: string calldata _tokenName
32: ) external returns (address) {
33: require(address(_deployer) != address(0), "Zero address");
34: require(bytes(_tokenSymbol).length != 0, "Symbol cannot be zero");
35: require(bytes(_tokenName).length != 0, "Name cannot be zero");
36:
37: address newInstance = Clones.clone(lpTokenImplementation);
38: ILPTokenInit(newInstance).init(
39: _deployer,
40: _transferHookProcessor,
41: _tokenSymbol,
42: _tokenName
43: );
44:
45: emit LPTokenDeployed(newInstance);
46:
47: return newInstance;
48: }
Recommended Mitigation Steps
Include the chain.id
vince0656 (Stakehouse) disputed and commented:
LSD is a protocol deployed on ETH only.
Understood, but ETH can and has forked. It is also possible that you or a team that succeeds you changes your mind about multiple network deployments.
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 deployLPToken function does not include the chain ID in the data used to compute the new token address, allowing the same deployment to be replayed on a different chain.
Impact
An attacker could replay a deployment on the correct chain and steal funds, similar to the Wintermute Gnosis Safe attack.
What the attacker needed
User deploys on wrong network; attacker can replay on correct chain
The fix
The contract should include the chain ID in the deployment data to prevent cross-chain replay.
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.
When a smart contract creates a new token, it uses a deterministic method that can produce the same address on different blockchains. If the contract does not include the chain ID, an attacker can copy the transaction from one chain and submit it on another chain, potentially taking control of the token and any funds sent to it. This is called a replay attack.
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.