The FirelightVault contract is an ERC4626Upgradeable vault and has an initialize function, but doesn't have a constructor that calls the _disableInitializers function. This omission allows the implementation contract to be initialized by malicious user without using a proxy.
Vulnerability Details
The FirelightVault contract doesn't call the _disableInitializers function in its constructor.
It has an initialize function that is intended to be called by the owner through proxy, but this omission allows the implementation contract to be initialized by malicious user without using a proxy.
Impact Details
Malicious user gains the control over the protocol. The admin should redeploy the protocol.
Add a constructor that calls the _disableInitializers function.
Proof of Concept
Proof of Concept
Add a Foundry setup to the Hardhat project, using the steps in this link: https://getfoundry.sh/config/hardhat/#adding-foundry-to-a-hardhat-project Then you can execute the following test with command: forge test --mt "testInitializeVault" -vvvvv
The test shows that anyone can initialize the FirelightVault contract and gain the admin rights: