57712 sc medium receiver deployment dos via salt reuse

Submitted on Oct 28th 2025 at 11:33:50 UTC by @pirex for Audit Comp | Belongarrow-up-right

  • Report ID: #57712

  • Report Type: Smart Contract

  • Report severity: Medium

  • Target: https://github.com/immunefi-team/audit-comp-belong/blob/feat/cairo/src/nftfactory/nftfactory.cairohttps://github.com/immunefi-team/audit-comp-belong/blob/feat/cairo/src/nftfactory/nftfactory.cairo

  • Impacts:

    • Permanent freezing of unclaimed royalties

Description

Brief/Intro

The NFT factory deploys royalty receiver contracts using a constant salt (0), causing deterministic address collisions when the same referral code and creator combination is reused across multiple collections. Once a receiver is deployed for a given set of parameters, any subsequent produce call with identical constructor calldata reverts, permanently blocking that creator from launching additional royalty-enabled collections with the same promoter. This creates a denial-of-service condition for legitimate platform operations.

Vulnerability Details

The factory's receiver deployment logic in src/nftfactory/nftfactory.cairo:321-338 uses Starknet's deploy_syscall with a hardcoded salt value of 0:

Vulnerable snippet (nftfactory.cairo:321-338)
let (receiver_address, _) = deploy_syscall(
    receiver_class_hash,
    0,  // constant salt
    receiver_constructor_calldata.span(),
    false
).unwrap();

The receiver constructor calldata is built from:

Starknet's address derivation is deterministic:

Since salt is always 0 and the class_hash is constant, any two produce calls with the same referral_code and creator will compute identical constructor calldata, resulting in the same receiver address. The first deployment succeeds, but the second attempt to deploy to an already-occupied address causes deploy_syscall to revert.

1

Realistic scenario — how the DoS occurs

  1. Venue "CryptoClub" gets referral code 42

  2. Artist Alice launches collection "Summer Vibes" with referral_code=42

  3. Factory deploys receiver at address 0xAAA

  4. Artist Alice wants to launch "Winter Blues" with same referral_code=42

  5. Factory attempts to deploy receiver at 0xAAA again

  6. deploy_syscall reverts — Alice cannot launch any more collections with CryptoClub

This is not an edge case: promoters are meant to have persistent referral codes across multiple collections, so this collision occurs during normal usage.

Impact Details

  • Business continuity:

    • Creators become permanently locked out of using specific referral codes after their first collection

    • Promoters cannot work with the same creator more than once

    • The platform's core model (recurring creator-promoter relationships) breaks down

  • Financial:

    • Creators lose the ability to launch new collections with established promotional partners

    • Promoters lose commission opportunities from repeat collaborations

    • Platform loses listing fees from blocked collections

  • Severity justification:

    • No funds are directly stolen, but this is Medium severity because it permanently disrupts a core protocol function (collection creation). The DoS is permanent for the matching creator-promoter pairing.

  • Attack vector:

    • No special privileges required. Any user can trigger this by creating two collections with the same referral code; the second produce call will fail.

References

  • Vulnerable deployment: src/nftfactory/nftfactory.cairo:321-338

  • Constructor calldata: src/nftfactory/nftfactory.cairo:324-329

  • Starknet address derivation: https://docs.starknet.io/documentation/architecture_and_concepts/Smart_Contracts/contract-address/

Proof of Concept

chevron-rightTest reproducing the DoS (expand to view)hashtag

The test test_produce_receiver_address_collision demonstrates the DoS condition:

Run with:

The test confirms:

  1. First produce succeeds and deploys a receiver at a predictable address

  2. Second produce with identical parameters attempts to redeploy at the same address

  3. deploy_syscall reverts with panic data, blocking the collection launch

Derive a unique salt for each receiver deployment so the computed address cannot collide for repeated creator/referral combinations. Example options:

Alternatives:

  • Use an incrementing per-creator or global counter (e.g., collection_counter) as salt.

  • Hash the full collection metadata into the salt for uniqueness.

These ensure each receiver deployment yields a distinct address and prevent permanent DoS from repeated referral/creator reuse.

Was this helpful?