The TadleFactory contract contains a critical vulnerability in the way it deploys upgradeable proxies for system components. Specifically, when proxies are deployed or redeployed without proper initialization data, the ownership of the deployed proxy contracts can be hijacked by an attacker. This allows an attacker to take full control of the contract, including pausing the contract and draining its assets.
The vulnerability stems from the proxy deployment mechanism in the TadleFactory contract. The deployUpgradeableProxy function in TadleFactory creates an instance of UpgradeableProxy as follows:
This, in turn, calls the constructor of the UpgradeableProxy contract:
Initialization of Ownership:
The TadleFactory contract attempts to set the guardian address as the admin during proxy deployment.
However, since the proxy uses the _data parameter for initialization, if the _data is omitted or incorrect, the initializeOwnership function in the proxy logic contract is never called.
This leaves the owner state variable uninitialized (i.e., address(0)).
Ownership Hijacking:
If the owner remains as address(0), any address can call the initializeOwnership function to gain ownership of the contract.
The attacker gains full administrative control, including critical functions like pausing the contract or using the rescue function to drain assets.
The maximum possible impact of this vulnerability includes:
Ownership Hijacking:
An attacker can claim ownership of the proxy contract.
The attacker can take over all administrative functions intended for the legitimate owner.
Asset Theft:
Using the rescue function, the attacker can transfer all assets (tokens/ether) held by the proxy contract to their own address.
##POC
Foundry test.
Logs
Foundry
To mitigate the identified vulnerability, ensure that proper initialization data is always passed when deploying or redeploying proxies. Specifically, the ownership of the proxy contract should be set correctly during deployment to prevent unauthorized ownership and control.
The key step is to ensure that the initializeOwnership function is called with the correct owner address (guardian) during the proxy deployment. This can be achieved by modifying the deployUpgradeableProxy function in the TadleFactory contract to always include the ownership initialization data.
Valid high severity, since `initializeOwner` is not called for proxy contracts and the constructor for each `Rescuable.sol` contract will not be invoked during proxy deployment, this leaves the `owner` for each proxy unitialized allowing potential to withdraw fund from other proxy contracts inheriting `Rescuable.sol` respectively.
Valid high severity, since `initializeOwner` is not called for proxy contracts and the constructor for each `Rescuable.sol` contract will not be invoked during proxy deployment, this leaves the `owner` for each proxy unitialized allowing potential to withdraw fund from other proxy contracts inheriting `Rescuable.sol` respectively.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.