Skip to content
Access control Audit finding Intermediate

COLLATERAL_MINTER_ROLE can be granted by the deployer of QuantConfig and mint arbitrary amount of tokens

The CollateralToken contract allows any address with the COLLATERAL_MINTER_ROLE to mint an arbitrary amount of collateral tokens. If the deployer's private key or an address with that role is compromised, an attacker could mint unlimited tokens.

cccz Follow

Originally disclosed on Code4rena

Submitted by cccz, also found by danb, and WatchPug

    function mintCollateralToken(
        address recipient,
        uint256 collateralTokenId,
        uint256 amount
    ) external override {
        require(
            quantConfig.hasRole(
                quantConfig.quantRoles("COLLATERAL_MINTER_ROLE"),
                msg.sender
            ),
            "CollateralToken: Only a collateral minter can mint CollateralTokens"
        );

        emit CollateralTokenMinted(recipient, collateralTokenId, amount);

        _mint(recipient, collateralTokenId, amount, "");
    }

Using the mintCollateralToken() function of CollateralToken, an address with COLLATERALMINTERROLE can mint an arbitrary amount of tokens.

If the private key of the deployer or an address with the COLLATERALMINTERROLE is compromised, the attacker will be able to mint an unlimited amount of collateral tokens.

We believe this is unnecessary and poses a serious centralization risk.

Proof of Concept

CollateralToken.sol#L101-L117 CollateralToken.sol#L138-L160

Recommended Mitigation Steps

Consider removing the COLLATERALMINTERROLE, make the CollateralToken only mintable by the owner, and make the Controller contract to be the owner and therefore the only minter.

0xca11 (Rolla) confirmed

alcueca (judge) commented:

Per sponsor comment on #47:

“The roles are renounced as per our deployment config covered in the docs. But this bug is still valid as the role OPTIONSMINTERROLE can be reassigned”.

Taking this one as main, with the vulnerability being that several of the MINTER and BURNER roles can be reassigned and have unnecessary powers that can be used to rug users.

0xca11 (Rolla) resolved and commented:

All roles were removed from the protocol, and now only the Controller contract can mint QTokens and CollateralTokens.

RollaProject/quant-protocol#90


The original report as published on Code4rena, by cccz. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the contract grants a minting role to addresses beyond the intended controller, and that role can be reassigned, creating a centralisation risk.

Impact

If the deployer's private key or an address with the COLLATERAL_MINTER_ROLE is compromised, an attacker could mint an unlimited amount of collateral tokens.

What the attacker needed

Compromised deployer private key; or address with COLLATERAL_MINTER_ROLE

The fix

The roles were removed, and now only the Controller contract can mint QTokens and CollateralTokens.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A smart contract has a special role that lets certain addresses create new tokens out of thin air. If someone gets control of such an address, they can make unlimited tokens, which can ruin the token's value for everyone else.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More by cccz

View all

104 more disclosed reports, best first.

More from Rolla contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.