57921 sc insight whitelisted role cannot be revoked in nft cairo

Submitted on Oct 29th 2025 at 13:29:09 UTC by @Divine_Dragon for Audit Comp | Belongarrow-up-right

  • Report ID: #57921

  • Report Type: Smart Contract

  • Report severity: Insight

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

Impacts:

  • (Not specified in original report)

Description

Vulnerability Details

addWhitelisted in the nft.cairo contract is used by the contract owner to mark a given address as whitelisted. However, there is no function in the contract to revoke a whitelisted status on-chain. Because of this, if the owner needs to revoke whitelist status they must perform changes off-chain (in the back-end). This creates a mismatch between on-chain data and back-end data:

  • On-chain: address remains whitelisted (true).

  • Back-end: may mark the address as not whitelisted (false) after an off-chain revoke.

This inconsistency can break users' trust: users checking their on-chain status see true, but operations like mintStaticOperation might rely on back-end whitelist checks and fail because the back-end revoked the status off-chain.

Mitigation

circle-info

Replace addWhitelisted with a toggle-style function (for example toggleWhitelisted) that allows the owner to switch an address's whitelisted status between true and false on-chain. This provides a proper on-chain revoke mechanism and prevents divergence between on-chain and back-end state.

References

https://github.com/immunefi-team/audit-comp-belong/blob/0cbcde6fd80dbc55a9e3403c8e5a74827dea19e2/src/nft/nft.cairo#L448-L455

Proof of Concept

Test demonstrating the inability to re-revoke (only adding is implemented):

The test indicates once a whitelisted status is set for an address, there is no way to revert that status on-chain using the provided interface.

chevron-rightTest run outputhashtag

Was this helpful?