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

Anyone can mint NFTs using `RamNFT::mintRamNFT` without paying an entrance fee.

Vulnerability Details

The mintRamNFT function in RamNFT.sol is public, meaning it can be called by anyone as often as they like without paying an entry fee. However, according to the specification, only the Dussehra contract should be allowed to mint Ram NFTs.

Impact

Users can mint NFTs without paying an entry fee and still participate in the Dussehra event. This would result in minimal or no fees being collected, leaving the organizer and the selected ram with little or nothing to withdraw.

Tools Used

manual review, VSC

Recommendations

Consider implementing an access control mechanism using the onlyDussehra modifier in RamNFT::mintRamNFT:

+ import {Dussehra} from "./Dussehra.sol";
contract RamNFT is ERC721URIStorage {
error RamNFT__NotOrganiser();
error RamNFT__NotChoosingRamContract();
+ error RamNFT__NotDussehraContract();
...
...
uint256 public tokenCounter;
address public organiser;
address public choosingRamContract;
+ Dussehra public dussehraContract;
- constructor() ERC721("RamNFT", "RAM") {
+ constructor(address _dussehra) ERC721("RamNFT", "RAM") {
tokenCounter = 0;
organiser = msg.sender;
+ dussehraContract = Dussehra(_dussehra);
}
+ modifier onlyDussehra() {
+ if (msg.sender != address(dussehraContract)) {
+ revert RamNFT__NotDussehraContract();
+ }
+ _;
+ }
- function mintRamNFT(address to) public {
+ function mintRamNFT(address to) public onlyDussehra {
uint256 newTokenId = tokenCounter++;
_safeMint(to, newTokenId);
Characteristics[newTokenId] = CharacteristicsOfRam({
ram: to,
isJitaKrodhah: false,
isDhyutimaan: false,
isVidvaan: false,
isAatmavan: false,
isSatyavaakyah: false
});
}
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.