Beginner FriendlyFoundryNFT
100 EXP
View results
Submission Details
Severity: low
Invalid

Use of Block.timestamp for comparisons

Summary

Dangerous usage of block.timestamp. block.timestamp can be manipulated by miners.

Vulnerability Details

Following are the areas that are using block timestamp for comparisons which can be manipulated by the miners
In ChoosingRam::increaseValuesOfParticipants()

function increaseValuesOfParticipants(uint256 tokenIdOfChallenger, uint256 tokenIdOfAnyPerticipent)
    public
    RamIsNotSelected
{
    ...

    @>   if (block.timestamp > 1728691200) {
        revert ChoosingRam__TimeToBeLikeRamFinish();
    }
    ...
}

In ChoosingRam ::selectRamIfNotSelected()

function selectRamIfNotSelected() public RamIsNotSelected OnlyOrganiser {
 @>    if (block.timestamp < 1728691200) {
        revert ChoosingRam__TimeToBeLikeRamIsNotFinish();
    }
 @>    if (block.timestamp > 1728777600) {
        revert ChoosingRam__EventIsFinished();
    }
    
    uint256 random = uint256(keccak256(abi.encodePacked(block.timestamp, block.prevrandao))) % ramNFT.tokenCounter();
    selectedRam = ramNFT.getCharacteristics(random).ram;
    isRamSelected = true;
}

In Dussehra::killRavana()

function killRavana() public RamIsSelected {
    @>  if (block.timestamp < 1728691069) {
        revert Dussehra__MahuratIsNotStart();
    }
    @>  if (block.timestamp > 1728777669) {
        revert Dussehra__MahuratIsFinished();
    }
    IsRavanKilled = true;
    uint256 totalAmountByThePeople = WantToBeLikeRam.length * entranceFee;
    totalAmountGivenToRam = (totalAmountByThePeople * 50) / 100;
    (bool success, ) = organiser.call{value: totalAmountGivenToRam}("");
    require(success, "Failed to send money to organiser");
}

Impact

Miners can manipulate the timestamp for extending the time period of event for their own benefits.

Tools Used

Manual Review

Recommendations

Avoid relying on block.timestamp.

Updates

Lead Judging Commences

bube Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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