Skip to content
Access control Audit finding Intermediate

Centralisation RIsk: Owner Of RoyaltyVault Can Take All Funds

The owner of the RoyaltyVault contract could set the platform fee to any arbitrary value, including 100%, so that the whole balance and future balances went to an owner-controlled recipient instead of the splitter. This let the owner take all funds and, if the splitter is called during NFT transfers, could block those transfers.

kirk-baird Follow

Originally disclosed on Code4rena

Submitted by kirk-baird, also found by 0xDjango, defsec, Dravee, hubble, hyh, leastwood, minhquanym, Ruhum, TomFrenchBlockchain, and WatchPug

The owner of RoyaltyVault can set _platformFee to any arbitrary value (e.g. 100% = 10000) and that share of the contracts balance and future balances will be set to the platformFeeRecipient (which is in the owners control) rather than the splitter contract.

As a result the owner can steal the entire contract balance and any future balances avoiding the splitter.

Proof of Concept

    function setPlatformFee(uint256 _platformFee) external override onlyOwner {
        platformFee = _platformFee;
        emit NewRoyaltyVaultPlatformFee(_platformFee);
    }

Recommended Mitigation Steps

This issue may be mitigated by add a maximum value for the _platformFee say 5% (or some reasonable value based on the needs of the platform).

Also consider calling sendToSplitter() before adjusting the platformFee. This will only allow the owner to change the fee for future value excluding the current contract balance.

Consider the following code.

    function setPlatformFee(uint256 _platformFee) external override onlyOwner {
        require(_platformFee < MAX_FEE);
        sendToSplitter(); // @audit this will need to be public rather than external
        platformFee = _platformFee;
        emit NewRoyaltyVaultPlatformFee(_platformFee);
    }

sofianeOuafir (Joyn) confirmed and commented:

This is an issue and we intend to fix it. The recommended mitigation looks good and will be considered.

We also agree that this is a med risk as this can currently only be done by the contract owner which is us at Joyn

deluca-mike (judge) commented:

Instead of having to come up with a “reasonable” MAX_FEE, consider instead just preventing the fee from ever being raised, and only allowing it to be lowered.

deluca-mike (judge) increased severity to High and commented:

While I was originally leaning Medium Risk, after taking the arguments made by the duplicate issues into account, I am now leaning High Risk. The rationale is that, a DOS of sendToSplitter via a high platformFee not only harms stakeholders of the RoyaltyVault that would get the remainder of the balance, split, but may also prevent all NFT transfers if sendToSplitter is hooked into as part of all token transfer, via royalty payments. A malicious or disgruntled RoyaltyVault owner can hold all the NFTs hostage that call sendToSplitter atomically on transfers.

So there are 2 issues that need to be solved here:

  • protect NFT holders by ensuring platformFee (or any other values) cannot be set to a value that would cause sendToSplitter to fail (splitterShare = 0 or platformShare > balanceOfVault), or don’t have sendToSplitter be called on NFT transfers
  • protect royalty split recipients by putting an arbitrary max to the fee, or only allowing the fee to be reduced

The original report as published on Code4rena, by kirk-baird. 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 fee setter had no maximum and did not settle the existing balance before the fee changed, so the owner could redirect all current and future funds.

Impact

The owner could take the entire contract balance and future balances, and a high fee could make the splitter call fail, potentially blocking NFT transfers that rely on it.

What the attacker needed

Caller is the contract owner

The fix

The fee should be capped at a reasonable maximum, the splitter should be called before any fee change, or the fee should only ever be allowed to go down; the project said it intended to fix it.

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 holds money for several parties and is meant to share it out through a splitter. The person who controls the contract could change a fee setting to take everything for themselves. Because there was no upper limit on that setting, nothing in the code stopped them.

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 kirk-baird

View all

32 more disclosed reports, best first.

More from Joyn 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.