The getUserMemorabiliaDetailed
function uses non-scalable, nested for
loops that iterate through every memorabilia token in the system to find those owned by a user. As protocol usage grows, the gas cost of this function is guaranteed to exceed the block limit, causing a permanent Denial of Service (DoS) and breaking a core protocol feature.
The impact is a permanent Denial of Service (DoS) on the getUserMemorabiliaDetailed
function. This breaks any front-end component that relies on it, preventing users from viewing their assets and severely degrading the platform's user experience and overall usability.
Likelihood: (High)
The likelihood is High. The vulnerability will inevitably be triggered under normal protocol usage. As more memorabilia are minted over time, it is certain the function's gas cost will exceed the block limit.
Impact: (Medium)
The impact is Medium. This DoS vulnerability breaks a core feature, preventing users from viewing their assets on any front-end. While not a loss of funds, it severely damages the platform's usability and trustworthiness.
Proof of Concept for Denial of Service (DoS) in test_DoS_GetUserMemorabiliaDetaile()
Overview: The getUserMemorabiliaDetailed
function uses inefficient nested loops that iterate through all system tokens. This non-scalable design guarantees that as protocol usage grows, the function's gas cost will exceed the block limit, causing a permanent Denial of Service (DoS).
Actors :
Attacker: No special attacker is needed. The vulnerability is triggered by normal protocol usage over time.
Victim: Any user of the front-end application who wants to view their collected memorabilia.
Protocol: The FestivalPass
contract, whose getUserMemorabiliaDetailed
function becomes permanently unusable.
Set up the project environment:
Add the Proof of Concept test case:
Copy the complete test_DoS_GetUserMemorabiliaDetailed
function provided in the "Working Test Case" section and append it to the end of the test/FestivalPass.t.sol
file.
Run the specific test:
Execute the following command in your terminal. This command will compile the contracts and run only the PoC test for this vulnerability.
The vulnerability's root cause is the inefficient iteration through all possible token IDs. The recommended solution is to implement a tracking system that maps users directly to their owned tokens, eliminating the need for gas-intensive loops.
The following changes should be applied to FestivalPass.sol
:
1 - Add a new state variable to track owned tokens for each user.
2 - Update the redeemMemorabilia function to populate the new tracking array upon minting.
3 - Replace the vulnerable getUserMemorabiliaDetailed function with a highly efficient one that simply returns the tracked data.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.