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

Health Tokens can be acquired so easily by anyone

Summary

There's a critical vulnerability within the system that allows users to claim health tokens without the prerequisite of purchasing a Martenitsa token. This oversight not only undermines the intended access control mechanism but also poses a significant risk to the integrity of the platform's event participation and producer roles.

Vulnerability Details

The vulnerability is rooted in the updateCountMartenitsaTokensOwner function, which lacks adequate checks to ensure that users have legitimately acquired Martenitsa tokens before being eligible to claim health tokens. This flaw enables users to manipulate the system to gain access to health tokens when they call the collectReward function, which are utilized as tickets for events. Participants, leveraging these tokens, can erroneously assume the role of a producer during the event duration, potentially disrupting the intended flow of activities and compromising the platform's security and user trust.

Impact

This vulnerability can lead to unauthorized access to health tokens, potentially allowing users to participate in events as producers without the necessary qualifications. This could disrupt event schedules, compromise the integrity of the platform, and undermine user trust.

Tools Used

This Vulnerability was found manually

Recommendations

To address this vulnerability, it is recommended that the updateCountMartenitsaTokensOwner function be modified to include checks that verify the user's ownership of Martenitsa tokens before allowing the increment of their health token count below is one way to do that:

function updateCountMartenitsaTokensOwner(
address owner,
uint tokenId,
string memory operation
) external {
require(ownerOf(tokenId)== owner,"Sorry you are not the token's owner")
if (
keccak256(abi.encodePacked(operation)) ==
keccak256(abi.encodePacked("add"))
) {
countMartenitsaTokensOwner[owner] += 1;
} else if (
keccak256(abi.encodePacked(operation)) ==
keccak256(abi.encodePacked("sub"))
) {
countMartenitsaTokensOwner[owner] -= 1;
} else {
revert("Wrong operation");
}
}
Updates

Lead Judging Commences

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

Missing access control

Support

FAQs

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