Skip to content

Latest commit

 

History

History
39 lines (26 loc) · 1.38 KB

009.md

File metadata and controls

39 lines (26 loc) · 1.38 KB

Jumpy Linen Swan

Medium

changeOwner() does nothing

Summary

The changeOwner() functions in AuctionFactory.sol, DebitaV3Aggregator.sol, and buyOrderFactory.sol do not change the owner state variable when called.

Root Cause

    function changeOwner(address owner) public {
        require(msg.sender == owner, "Only owner");
        require(deployedTime + 6 hours > block.timestamp, "6 hours passed");
        owner = owner;
    }

This function checks msg.sender against its argument instead of the owner state variable. It will always revert if used as intended, within the intended constraints.

Impact

Instead of the deployer having a 6 hour window after deployment to call changeOwner() on AuctionFactory.sol, DebitaV3Aggregator.sol, and buyOrderFactory.sol, the function will not work at all.

If the circumstances of the deployment of these contracts necessitate a change of ownership, the contracts will have to be fixed and redeployed, and any fees spent on the original deployment will be lost.

Mitigation

Ensure that the address passed to the function is different from the contract's state variable, like so:

    function changeOwner(address newOwner) public {
        require(msg.sender == owner, "Only owner");
        require(deployedTime + 6 hours > block.timestamp, "6 hours passed");
        owner = newOwner;
    }