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

[WP-H3] MINTER_ROLE of VUSD can rug users with unlimited mint() #98

Closed
code423n4 opened this issue Feb 23, 2022 · 2 comments
Closed

[WP-H3] MINTER_ROLE of VUSD can rug users with unlimited mint() #98

code423n4 opened this issue Feb 23, 2022 · 2 comments
Labels
bug Something isn't working 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

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2022-02-hubble/blob/ed1d885d5dbc2eae24e43c3ecbf291a0f5a52765/contracts/VUSD.sol#L11-L11

Vulnerability details

https://github.com/code-423n4/2022-02-hubble/blob/ed1d885d5dbc2eae24e43c3ecbf291a0f5a52765/contracts/VUSD.sol#L11-L11

contract VUSD is VanillaGovernable, ERC20PresetMinterPauserUpgradeable {

https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/blob/v4.3.2/contracts/token/ERC20/presets/ERC20PresetMinterPauserUpgradeable.sol#L67-L70

    function mint(address to, uint256 amount) public virtual {
        require(hasRole(MINTER_ROLE, _msgSender()), "ERC20PresetMinterPauser: must have minter role to mint");
        _mint(to, amount);
    }

The address that initialize() the VUSD contract, usually, the deployer of the contract will have MINTER_ROLE by default, furthermore, the deployer and any other address with the DEFAULT_ADMIN_ROLE can grant MINTER_ROLE to anyone with no reactions.

We believe this can introduce a severe centralization risk, which can cause users to be rugged by the malicious/compromised deployer or other addresses with MINTER_ROLE.

https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/blob/v4.3.2/contracts/token/ERC20/presets/ERC20PresetMinterPauserUpgradeable.sol#L51-L56

    function __ERC20PresetMinterPauser_init_unchained(string memory name, string memory symbol) internal initializer {
        _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());

        _setupRole(MINTER_ROLE, _msgSender());
        _setupRole(PAUSER_ROLE, _msgSender());
    }

Recommendation

Consider limiting power of the deployer, including:

  1. the MINTER_ROLE should only be held by contracts but not EOAs;
  2. the MINTER_ROLE should not be granted in one step by an EOA, but in 2 steps and it should be granted by a multi-sig or DAO gov contract only.
@code423n4 code423n4 added 3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working labels Feb 23, 2022
code423n4 added a commit that referenced this issue Feb 23, 2022
@atvanguard atvanguard added disagree with severity Sponsor confirms validity, but disagrees with warden’s risk assessment (sponsor explain in comments) sponsor acknowledged Technically the issue is correct, but we're not going to resolve it for XYZ reasons labels Feb 24, 2022
@atvanguard atvanguard mentioned this issue Feb 24, 2022
@atvanguard
Copy link
Collaborator

Duplicate of #40

@atvanguard atvanguard marked this as a duplicate of #40 Feb 24, 2022
@atvanguard atvanguard added duplicate This issue or pull request already exists and removed disagree with severity Sponsor confirms validity, but disagrees with warden’s risk assessment (sponsor explain in comments) sponsor acknowledged Technically the issue is correct, but we're not going to resolve it for XYZ reasons labels Feb 24, 2022
@moose-code moose-code added QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax and removed 3 (High Risk) Assets can be stolen/lost/compromised directly labels Mar 6, 2022
@JeeberC4
Copy link

Grouping with warden's QA Report #96

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 QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
Projects
None yet
Development

No branches or pull requests

4 participants