_verifySigner
check can be bypassed
#199
Labels
bug
Something isn't working
duplicate
This issue or pull request already exists
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
Lines of code
https://github.com/code-423n4/2022-10-holograph/blob/main/contracts/HolographFactory.sol#L320-L335
https://github.com/code-423n4/2022-10-holograph/blob/main/contracts/HolographFactory.sol#L220
Vulnerability details
Description
The current implementation of the
_verifySigner
function is insufficient and can be bypassed.When
_verifySigner
function is called,ecrecover
will return address(0) if the signature is invalid.As a result, the requirement of
_verifySigner
call inHolographFactory.deployHolographableContract()
can bypassed by sending an invalid signature and assigning signer = 0x0There is no immediate issue currently that I've noticed as this will result in the hash being different and resulting in a different
holographerAddress
, an attacker wouldn't be able to take over a holographer deployed address.However, future implementation that would utilize the
_verifySigner
check can potentially be vulnerable if not implemented correctly.Proof of Concept
https://github.com/code-423n4/2022-10-holograph/blob/main/contracts/HolographFactory.sol#L320-L335
https://github.com/code-423n4/2022-10-holograph/blob/main/contracts/HolographFactory.sol#L220
Recommended Mitigation Steps
I advise an additional check to be imposed within
_verifySigner
that ensures thesigner
or the results ofecrecover
is not the zero-address which will alleviate this check. For more details, consult the EIP721 implementation by OpenZeppelin ( https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.4.0/contracts/cryptography/ECDSA.sol#L53-L71).The text was updated successfully, but these errors were encountered: