QA Report #30
Labels
bug
Something isn't working
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
sponsor disputed
Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue
Lines of code
https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/InsuranceFund.sol#L34-L35
Vulnerability details
Impact
InsuranceFund's initialize doesn't seem to be able to run in the setup provided without initializer modifier, so the contract's ERC20 cannot be initialized, VUSD, marginAccount and governace cannot be set, the contract is inoperable
Proof of Concept
InsuranceFund's initialize calls ERC20Upgradeable's __ERC20_init, stating that it has initializer modifier:
https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/InsuranceFund.sol#L34-L35
While actually __ERC20_init only has onlyInitializing modifier:
https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/blob/master/contracts/token/ERC20/ERC20Upgradeable.sol#L55-L62
That checks that initialization is taking place:
https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/blob/master/contracts/proxy/utils/Initializable.sol#L72-L75
But it hasn't started and this way InsuranceFund's initialize have to fail all the times
Recommended Mitigation Steps
Consider adding initializer modifier (inherited from ERC20Upgradeable) to InsuranceFund's initialize:
Now:
To be:
The text was updated successfully, but these errors were encountered: