Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pendingOwner should be reset to address(0) after acceptOwner() is successfully called #83

Open
code423n4 opened this issue Jan 6, 2022 · 1 comment
Labels
1 (Low Risk) Assets are not at risk. State handling, function incorrect as to spec, issues with comments bug Something isn't working resolved Finding has been patched by sponsor (sponsor pls link to PR containing fix) sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")

Comments

@code423n4
Copy link
Contributor

Handle

Dravee

Vulnerability details

Impact

The acceptOwner() external function can be called indefinitely instead of only once.
The contract's state doesn't reflect reality.
The code doesn't follow the standard implementation of a 2-step ownership transfer.

Proof of Concept

Here's the current acceptOwner() external function, which lacks a reset of pendingOwner to address(0) :

    function acceptOwner() external override {
        require(msg.sender == pendingOwner, 'E102');
        owner = msg.sender;

        emit AcceptOwner(msg.sender);
    }

Tools Used

VS Code

Recommended Mitigation Steps

Change the code to:

    function acceptOwner() external override {
        require(msg.sender == pendingOwner, 'E102');
        owner = msg.sender;
        pendingOwner = address(0); // @audit : line to add

        emit AcceptOwner(msg.sender);
    }
@code423n4 code423n4 added 1 (Low Risk) Assets are not at risk. State handling, function incorrect as to spec, issues with comments bug Something isn't working labels Jan 6, 2022
code423n4 added a commit that referenced this issue Jan 6, 2022
@Mathepreneur Mathepreneur added the sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity") label Jan 15, 2022
@Mathepreneur
Copy link
Collaborator

@Mathepreneur Mathepreneur added the resolved Finding has been patched by sponsor (sponsor pls link to PR containing fix) label Jan 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 (Low Risk) Assets are not at risk. State handling, function incorrect as to spec, issues with comments bug Something isn't working resolved Finding has been patched by sponsor (sponsor pls link to PR containing fix) sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Projects
None yet
Development

No branches or pull requests

2 participants