Hook deployment is vulnerable to reorg situations #36
Labels
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
grade-b
primary issue
Highest quality submission among a set of duplicates
Q-19
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
🤖_40_group
AI based duplicate group recommendation
sponsor acknowledged
Technically the issue is correct, but we're not going to resolve it for XYZ reasons
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/code-423n4/2024-08-wildcat/blob/fe746cc0fbedc4447a981a50e6ba4c95f98b9fe1/src/HooksFactory.sol#L317-L319
Vulnerability details
Impact
Hook deployment is not protected from reorg situations, even though protocol plans on deployment to chains that are very vulnerable to block reorgs. This will cause markets to be deployed with the wrong hooks, messing up users' potential hook configurations.
Proof of Concept
The protocol plans to deploy on Ethereum, Base, Arbitrum, Polygon. Re-orgs can happen in all EVM chains. Not super common on Ethereum, but still happens. The same also occurs on Poylgon, which has experienced large re-orgs in the past. and on Optimistic and Arbitrum rollups.
_deployHooksInstance
uses the ordinary "create" to deploy the hooks,therefore during multiple hook/market deployments through the
deployMarketAndHooks
anddeployMarket
functions, a reorg situation will lead to a "swap" of address instances, in which the reorganization of chain blocks will lead to a different address instance being attached to another hook, other than the one it would have gotten in case of a normal deployment. In short, hook deployment A gets address instance B, rather than address instance A that it would have gotten in case of a normal deployment.in case of multiple deployments with the
deployMarketAndHooks
function will cause the wrong hooksinstance to be attached to the wrong markets, which could tamper with various expected market configurations and lead to unexpected behaviour. Also, if the deployer uses the initially derived address and sends funds to the address, the switch in address instance will make the funds open to the other deployment, leading to loss of funds.Tools Used
Manual code review
Recommended Mitigation Steps
Recommend using CREATE2 instead which uses salt that contains msg.sender to deploy hooks instead.
Assessed type
Other
The text was updated successfully, but these errors were encountered: