Skip to content
Business logic Audit finding Intermediate

PA1D#bidSharesForToken returns incorrect bidShares.creator.value

The bidSharesForToken function returns creator bid share values in raw basis points instead of the 18-decimal percentage format expected by the Zora market. This causes incorrect royalty calculations when the market validates or uses the bid shares.

0x52 Follow

Originally disclosed on Code4rena

Submitted by 0x52

PA1D.sol#L665-L675

bidShares returned are incorrect leading to incorrect royalties.

Proof of Concept

Zora Market

function isValidBidShares(BidShares memory bidShares)
    public
    pure
    override
    returns (bool)
{
    return
        bidShares.creator.value.add(bidShares.owner.value).add(
            bidShares.prevOwner.value
        ) == uint256(100).mul(Decimal.BASE);
}

Above you can see the Zora market lines that validate bidShares, which shows that Zora market bidShare.values should be percentages written out to 18 decimals. However PA1D#bidSharesForToken sets the bidShares.creator.value to the raw basis points set by the owner, which is many order of magnitudes different than expected.

Recommended Mitigation Steps

To return the proper value, basis points returned need to be adjusted. Convert from basis points to percentage by dividing by 10 ** 2 (100) then scale to 18 decimals. The final result it to multiple the basis point by 10 ** (18 - 2) or 10 ** 16:

function bidSharesForToken(uint256 tokenId) public view returns (ZoraBidShares memory bidShares) {
    // this information is outside of the scope of our
    bidShares.prevOwner.value = 0;
    bidShares.owner.value = 0;
    if (_getReceiver(tokenId) == address(0)) {
-       bidShares.creator.value = _getDefaultBp();
+       bidShares.creator.value = _getDefaultBp() * (10 ** 16);
    } else {
-       bidShares.creator.value = _getBp(tokenId);
+       bidShares.creator.value = _getBp(tokenId) * (10 ** 16);
    }
    return bidShares;
}

alexanderattar (Holograph) commented:

Good catch! We’ll implement the suggested solution.

alexanderattar (Holograph) linked a PR:

Feature/holo 612 royalty smart contract improvements


The original report as published on Code4rena, by 0x52. 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

Impact

Royalty calculations could be incorrect, potentially causing creators to receive the wrong amount.

What the attacker needed

None

The fix

The function should multiply the basis point value by 10^16 to convert it to an 18-decimal percentage; the project said it would implement this.

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.

Smart contracts often represent percentages as large integers with many decimal places. Here, one function returned a small whole number (basis points) where the market expected a number scaled up by 10^18, so the royalty amount was far too small. This could mean creators receive the wrong payment.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by 0x52

View all

211 more disclosed reports, best first.

More from Holograph contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.