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

In `RamNFT::mintRamNFT` there is a possibility of Reentrancy as effects are done after an external call

Summary

We can clearly see that effects are done after an external safeMint call

function mintRamNFT(address to) public {
uint256 newTokenId = tokenCounter++;
--> _safeMint(to, newTokenId);
--> Characteristics[newTokenId] = CharacteristicsOfRam({
ram: to,
isJitaKrodhah: false,
isDhyutimaan: false,
isVidvaan: false,
isAatmavan: false,
isSatyavaakyah: false
});
}

Impact

Someone can mint the RamNFT again and agian without changing the characterstics

Tools Used

Manual Review

Recommendations

  1. Use Reentrancy Guard

  2. Make the function follow CEI to prevent it

  3. Do this instead

function mintRamNFT(address to) public {
uint256 newTokenId = tokenCounter++;
+ Characteristics[newTokenId] = CharacteristicsOfRam({
+ ram: to,
+ isJitaKrodhah: false,
+ isDhyutimaan: false,
+ isVidvaan: false,
+ isAatmavan: false,
+ isSatyavaakyah: false
+ });
- _safeMint(to, newTokenId);
- Characteristics[newTokenId] = CharacteristicsOfRam({
- ram: to,
- isJitaKrodhah: false,
- isDhyutimaan: false,
- isVidvaan: false,
- isAatmavan: false,
- isSatyavaakyah: false
- });
+ _safeMint(to, newTokenId);
}
Updates

Lead Judging Commences

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

Invalid - reentrancy in safeMint

The problem is that the `mintRamNFT` function is public and anyone can call it, not that the function uses `_safeMint`.

Support

FAQs

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