Usage of an incorrect version of Ownable library can potentially malfunction all onlyOwner functions
The contracts used the standard non-upgradeable Ownable library inside proxy-based upgradeable contracts, so the constructor that sets the owner never runs and no owner is assigned. As a result, every function restricted to the owner would be unusable after deployment.
Submitted by robee
The current implementaion is using a non-upgradeable version of the Ownable library. Instead of the upgradeable version: @openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol.
A regular, non-upgradeable Ownable library will make the deployer the default owner in the constructor. Due to a requirement of the proxy-based upgradeability system, no constructors can be used in upgradeable contracts. Therefore, there will be no owner when the contract is deployed as a proxy contract
Recommended Mitigation Steps
Use @openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol and @openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol instead.
And add _Ownableinit(); at the beginning of the initializer.
Oracle.sol AMM.sol
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The contracts inherited the non-upgradeable Ownable, whose constructor-based owner assignment does not execute in a proxy deployment, instead of the upgradeable variant initialised explicitly.
What the attacker needed
Contracts deployed behind a proxy
The fix
Switch to the upgradeable Ownable and Initializable libraries and call the Ownable initialiser at the start of the initializer function.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Upgradeable contracts are deployed behind a proxy, a contract that forwards calls to the real logic contract. Because of this, constructors do not run, so any setup done in a constructor is lost. The Ownable library normally sets the owner in its constructor, so here nobody ends up as owner and owner-only actions cannot be performed.
What is Smart contracts?
Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.