Normal behavior
The getUserMemorabiliaDetailed function is intended to return all memorabilia NFTs owned by a given user, including their token IDs, collection IDs, and item IDs, by iterating through existing memorabilia collections and checking balances.
Specific issue
The function performs nested, unbounded loops over all existing collections and all items within each collection, regardless of whether the queried user owns those NFTs.
As the number of collections and items grows, the gas cost of this function increases linearly (or worse), eventually exceeding gas limits and causing the function to become unusable.
This allows a malicious or compromised organizer to permanently deny service to this function by inflating on-chain state.
Likelihood:
The organizer role can continuously create new memorabilia collections and increase currentItemId by redeeming items, which monotonically increases the iteration space.
The function is expected to be called by frontends, wallets, or indexers, making gas exhaustion highly likely as the protocol scales.
Impact:
The function will eventually exceed block gas limits or RPC execution limits, making it impossible to call.
Frontend applications, indexers, and user interfaces relying on this function will fail, resulting in a permanent denial of service.
The function will eventually exceed block gas limits or RPC execution limits, making it impossible to call.
Frontend applications, indexers, and user interfaces relying on this function will fail, resulting in a permanent denial of service.
Avoid iterating over global state.
Instead, maintain per-user memorabilia ownership indexes updated during mint and burn operations.
This change ensures gas usage scales with the number of NFTs owned by the user rather than total protocol state, eliminating the denial-of-service vector.
The contest is live. Earn rewards by submitting a finding.
Submissions are being reviewed by our AI judge. Results will be available in a few minutes.
View all submissionsThe contest is complete and the rewards are being distributed.