Skip to content
Business logic Audit finding Intermediate

Differing percentage denominators causes confusion and potentially brick claims

A constant named PERCENTAGE_SCALE was defined as 10e5 while the code actually divided by 10000, so a collection owner could easily use the wrong denominator when creating a split. If that happened, the calculated claimable amount could exceed the contract's funds, making claims fail and locking funds permanently.

hickuphh3 Follow

Originally disclosed on Code4rena

Submitted by hickuphh3, also found by 0x

https://github.com/code-423n4/2022-03-joyn/blob/main/splits/contracts/Splitter.sol#L14

https://github.com/code-423n4/2022-03-joyn/blob/main/splits/contracts/Splitter.sol#L103

Details & Impact

There is a PERCENTAGE_SCALE = 10e5 defined, but the actual denominator used is 10000. This is aggravated by the following factors:

  1. Split contracts are created by collection owners, not the factory owner. Hence, there is a likelihood for someone to mistakenly use PERCENTAGE_SCALE instead of 10000.
  2. The merkle root for split distribution can only be set once, and a collection’s split and royalty vault can’t be changed once created.

Thus, if an incorrect denominator is used, the calculated claimable amount could exceed the actual available funds in the contract, causing claims to fail and funds to be permanently locked.

Recommended Mitigation Steps

Remove PERCENTAGE_SCALE because it is unused, or replace its value with 10_000 and use that instead.

P.S: there is an issue with the example scaled percentage given for platform fees (5% = 200). Should be 500 instead of 200.

sofianeOuafir (Joyn) confirmed and commented:

This is an issue and we intend to fix it


The original report as published on Code4rena, by hickuphh3. 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 a misleading, unused constant (PERCENTAGE_SCALE = 10e5) coexisted with the real denominator of 10000, inviting collection owners to use the wrong value when configuring splits.

Impact

If a collection owner used the wrong denominator, claimable amounts could exceed the contract balance, causing claims to fail and funds to be permanently locked; the text does not claim this was exploited in practice.

What the attacker needed

Collection owner configures a split; wrong denominator chosen

The fix

The unused PERCENTAGE_SCALE constant should be removed, or its value changed to 10_000 and used consistently; the project confirmed it intends to fix the issue.

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 split contract shares money out in percentages. To turn a percentage into an amount, the code divides by a fixed number, and two different numbers were floating around in the codebase. If someone used the wrong one, the contract would think it owed more than it actually held, so payouts would fail and the money could get stuck.

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 hickuphh3

View all

43 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.

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.