create2WithStoredInitCode is used to deploy controllers and markets. If a controller deployment fails it is still recorded in the archController as a valid controller. The borrower won't be able to deploy a controller again and the initial one won't exist.
createEscrow is used to deploy escrows. If an escrow deployment fails. It will have to be deployed again.
Tools Used
Manual Analysis
Recommended Mitigation Steps
Add a check that checks the code deployed at the contract address and reverts if it is empty. The codehash or codesize can be checked.
Lines of code
https://github.com/code-423n4/2023-10-wildcat/blob/c5df665f0bc2ca5df6f06938d66494b11e7bdada/src/libraries/LibStoredInitCode.sol#L106-L117
Vulnerability details
Descripion
When a contract is deployed using Create2 the deployment can fail without causing a revert. The following conditions can cause it to not revert:
When any of the conditions above occur the CREATE2 opcode completes execution without reverting but the contract will not be deployed.
The
create2WithStoredInitCode
in LibStoredInitCode andcreateEscrow
in WildcatSanctionsSentinel don't have these checks.Impact
create2WithStoredInitCode
is used to deploy controllers and markets. If a controller deployment fails it is still recorded in the archController as a valid controller. The borrower won't be able to deploy a controller again and the initial one won't exist.createEscrow
is used to deploy escrows. If an escrow deployment fails. It will have to be deployed again.Tools Used
Manual Analysis
Recommended Mitigation Steps
Add a check that checks the code deployed at the contract address and reverts if it is empty. The codehash or codesize can be checked.
Assessed type
Other