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

Zero Address at Constructor #60

Closed
code423n4 opened this issue Sep 16, 2022 · 2 comments
Closed

Zero Address at Constructor #60

code423n4 opened this issue Sep 16, 2022 · 2 comments
Labels
bug Something isn't working duplicate This issue or pull request already exists edited-by-warden QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax sponsor acknowledged Technically the issue is correct, but we're not going to resolve it for XYZ reasons

Comments

@code423n4
Copy link
Contributor

code423n4 commented Sep 16, 2022

Lines of code

https://github.com/PartyDAO/party-contracts-c4/blob/main/contracts/party/PartyFactory.sol#L21-L22
https://github.com/PartyDAO/party-contracts-c4/blob/main/contracts/party/PartyGovernanceNFT.sol#L44-L46
https://github.com/PartyDAO/party-contracts-c4/blob/main/contracts/party/PartyGovernance.sol#L266-L268
https://github.com/PartyDAO/party-contracts-c4/blob/main/contracts/proposals/FractionalizeProposal.sol#L34-L36

Vulnerability details

Impact

Zero address check for globals and vaultFactory should be implemented when deploying the contract. This is because there is no setter functions catered for the associated immutable variables. In the event a mistake was done, not only that all calls associated with them would be non-functional, the contract(s) would also have to be redeployed.

Proof of Concept

A zero address could accidentally be assigned to globals or vaultFactory, rendering the deployed contract obsolete.

Recommended Mitigation Steps

The constructor should typically be refactored as follows:

error AddressZeroEncountered();

constructor(IGlobals globals) {
        if (globals == address(0)) revert AddressZeroEncountered();
        GLOBALS = globals;
    }
@code423n4 code423n4 added 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working labels Sep 16, 2022
code423n4 added a commit that referenced this issue Sep 16, 2022
@merklejerk merklejerk added the sponsor acknowledged Technically the issue is correct, but we're not going to resolve it for XYZ reasons label Sep 21, 2022
@merklejerk
Copy link
Collaborator

Acceptable risk. Even with the check, it doesn't prevent us from configuring the wrong (nonzero) address. We verify deployments and migrations to mitigate the issue.

@HardlyDifficult
Copy link
Collaborator

Lowering risk and merging with the warden's QA report #59

@HardlyDifficult HardlyDifficult added duplicate This issue or pull request already exists QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax and removed 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value labels Oct 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists edited-by-warden QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax sponsor acknowledged Technically the issue is correct, but we're not going to resolve it for XYZ reasons
Projects
None yet
Development

No branches or pull requests

3 participants