Beginner FriendlyFoundryGameFi
100 EXP
View results
Submission Details
Severity: medium
Valid

`participants` variable is not deleted after event which leads to DOS of `stopEvent` function

Summary

participants variable is not deleted after event which leads to owner unable to stop event.

Vulnerability Details

After event is started using startEvent function, users participates in the event using joinEvent function. When a user enter this function, his account's address is added in the participants array variable which stores all the current participants of the contract.

The issue arises when the event is ended. When event ends using stopEvent function, users who participated in the event are no longer participants so their addresses should be removed from participants variable after the event ends. But the stopEvent function does not deletes the users added. Making the participants variable a ever growing list with new additions after each event.

Impact

After many events, the participants array variable will become very large such that when owner runs stopEvent function, it reaches gas limit and the transaction will revert. Due to this, owner won't be able to stop the event, therefore, resulting in the DOS of stopEvent function and the event will always be active.

Tools Used

Manual Review

Recommendations

Add this code in MartenitsaEvent::stopEvent function:

for (uint256 i = 0; i < participants.length; i++) {
isProducer[participants[i]] = false;
}
+ delete participants;
Updates

Lead Judging Commences

bube Lead Judge over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

_participants is not updated

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.