-
Notifications
You must be signed in to change notification settings - Fork 80
No Validation Of create2 Return Value #18
Copy link
Copy link
Open
Description
Impact
The BoringFactory.deploy() function is used to deploy lightweight proxy contracts . The function does not revert properly if there is a failed contract deployment or revert from the create2 opcode as it does not properly check the returned address for bytecode. The create2 opcode returns the expected address which will never be the zero address.
Proof of Concept
https://github.com/boringcrypto/BoringSolidity/blob/master/contracts/BoringFactory.sol#L32-L68
Recommended Mitigation Steps
The recommended mitigation is to check returned address by create2 that is cloneAddress variable for non zero adddress and non zero code size .
// pass along failure message from failed contract deployment and revert.
iszero(extcodesize(cloneAddress )) {
returndatacopy(0, 0, returndatasize())
revert(0, returndatasize())
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels