}`
Creating a contract using IFactory a custom proposal can be passed to the initialize function overwriting the state variables of the Basket contract.
Recommended Mitigation Steps
Use initialized boolean similar to initialize function in Auction:
function initialize(address basket_, address factory_) public override { require(!initialized); basket = IBasket(basket_); factory = IFactory(factory_); initialized = true; }
Handle
loop
Vulnerability details
The initialize function in Basket has no safeguard for getting invoked again after Basket has been initialized from Factory.
Impact
State variables of the basket can be overwritten.
Proof of Concept
The inititalize function sets most of the state variables: `function initialize(IFactory.Proposal memory proposal, IAuction auction) public override { publisher = proposal.proposer; licenseFee = proposal.licenseFee; factory = IFactory(msg.sender); auction = auction; ibRatio = BASE; tokens = proposal.tokens; weights = proposal.weights; approveUnderlying(address(auction));
}` Creating a contract using IFactory a custom proposal can be passed to the initialize function overwriting the state variables of the Basket contract.
Recommended Mitigation Steps
Use
initialized
boolean similar toinitialize
function in Auction:function initialize(address basket_, address factory_) public override { require(!initialized); basket = IBasket(basket_); factory = IFactory(factory_); initialized = true; }