Cross token accounting is broken
The contract's release functions accept a payment token, but the released and totalReleased accounting is global rather than per token. An attacker can send a worthless token and call release for a victim, inflating the victim's released amount so that later real-token payouts are zeroed out and cannot be withdrawn.
- Disclosed after under an hour
57515 sc high cross token accounting is broken
Submitted on Oct 26th 2025 at 21:25:50 UTC by @Hunterrrr for Audit Comp | Belong
- Report ID: #57515
- Report Type: Smart Contract
- Report severity: High
- Target: https://github.com/immunefi-team/audit-comp-belong/blob/feat/cairo/src/receiver/receiver.cairo
Impacts:
- Permanent freezing of funds
- Permanent freezing of unclaimed royalties
- Griefing (e.g. no profit motive for an attacker, but damage to the users or the protocol)
Description
Cross‑token accounting is broken
Your interface lets callers choose a payment_token for every payout:
fn releaseAll(ref self: TState, payment_token: ContractAddress);
fn release(ref self: TState, payment_token: ContractAddress, to: ContractAddress);
…but the bookkeeping accessors do not take a token parameter:
fn totalReleased(self: @TState) -> u256;
fn released(self: @TState, account: ContractAddress) -> u256;
That mismatch almost certainly means the implementation tracks released and totalReleased globally rather than per token. In any PaymentSplitter‑style contract that supports multiple ERC‑20s (as your payment_token args suggest), accounting must be token‑scoped. Otherwise, payouts in one token contaminate the math for other tokens.
For a given account, the releasable amount for a token should be:
releasable(token, account)
= (totalReceived(token) * shares(account) / totalShares)
- released(token, account)
If released(account) is tracked without the token dimension:
- A payout in token (A) increases released(account) and will be subtracted when releasing token (B), even though they’re different assets/denominations.
- An attacker (or even a well‑meaning third party—since release is typically permissionless) can send a worthless token to the contract and call release(worthlessToken, victim) to inflate released(victim). Later, when real tokens arrive, releasable(realToken, victim) underflows/zeros out and the victim can’t withdraw. That’s a permanent DoS on payouts for that account and token, leaving funds stuck.
This is not theoretical—mixing accounting across assets is one of the most common PaymentSplitter bugs and results in loss of funds or permanent inability to withdraw.
Proof of Concept
// Add this test to src/tests/test_receiver.cairo
#[test]
#[should_panic(expected: 'Account not due payment')]
fn test_cross_token_accounting_dos() {
// Deploy standard setup: receiver + real token A
let (_, _, _receiver, erc20_a) = deploy_factory_nft_receiver_erc20(true, true);
let receiver = IReceiverDispatcher { contract_address: _receiver };
// Deploy a second ERC20 (worthless token B)
let erc20mock_class = declare("ERC20Mock").unwrap().contract_class();
let (erc20_b, _) = erc20mock_class.deploy(@array![]).unwrap();
// 1) Attack: fund receiver with token B and release to inflate released(CREATOR)
IERC20MintableDispatcher { contract_address: erc20_b }.mint(_receiver, 1000000);
receiver.release(erc20_b, constants::CREATOR());
assert_eq!(receiver.released(constants::CREATOR()), 800000);
// 2) Later, real funds arrive in token A
IERC20MintableDispatcher { contract_address: erc20_a }.mint(_receiver, 100000);
// 3) Releasing token A should now revert (cross-token contamination):
// to_release == 0 due to global released/total_released being polluted by token B
receiver.release(erc20_a, constants::CREATOR());
}
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 implementation tracks released and totalReleased globally instead of per payment token, so payouts in one token affect the releasable amount for every other token.
Impact
Payouts for a victim in a real token can be permanently blocked, leaving funds stuck, and the attack needs no profit motive because release is permissionless.
What the attacker needed
Release is permissionless; attacker can supply a worthless token; victim has shares in the receiver
The fix
Accounting for released and totalReleased should be scoped per payment token so that payouts in one token do not affect another.
How it was found
- Deploy the receiver and a real token A using the standard setup.
- Deploy a second, worthless token B.
- Mint token B to the receiver and call release for the creator, which inflates the global released amount.
- Mint real token A to the receiver.
- Call release for token A for the creator, which reverts because the releasable amount is zero.
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.
This contract splits incoming payments between people. It lets anyone trigger a payout in any token, but it keeps one running total of how much each person has been paid, no matter which token was used. So someone can pay a person in a fake token worth nothing, and the contract then thinks that person has already been paid, blocking their real money.
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.