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

acceptOwner should reset pendingOwner #105

Closed
code423n4 opened this issue Jan 8, 2022 · 1 comment
Closed

acceptOwner should reset pendingOwner #105

code423n4 opened this issue Jan 8, 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 duplicate This issue or pull request already exists

Comments

@code423n4
Copy link
Contributor

Handle

p4st13r4

Vulnerability details

Impact

TimeswapFactory allows to transfer ownership of the contract, however pendingOwner is never reset upon accepting the ownership. Since it’s a public state var, it’s a good practice to reset it to 0 after the operation

Proof of Concept

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

    emit AcceptOwner(msg.sender);
}

Tools Used

Editor

Recommended Mitigation Steps

Add

pendingOwner = address(0)
@code423n4 code423n4 added 0 (Non-critical) Code style, clarity, syntax, versioning, off-chain monitoring (events etc), exclude gas optimisation bug Something isn't working labels Jan 8, 2022
code423n4 added a commit that referenced this issue Jan 8, 2022
@amateur-dev
Copy link
Collaborator

Similar issue reported over here #83 ; hence closing this

@amateur-dev amateur-dev added the duplicate This issue or pull request already exists label Jan 15, 2022
@0xean 0xean added 1 (Low Risk) Assets are not at risk. State handling, function incorrect as to spec, issues with comments and removed 0 (Non-critical) Code style, clarity, syntax, versioning, off-chain monitoring (events etc), exclude gas optimisation labels Jan 26, 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 duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants