GivingThanks

First Flight #28
Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: medium
Valid

The `GivingThanks::donate` function is vulnerablw to Reentrancy attacks and can be exploited

Summary

GivingThanks::donate function makes an external call to send ether before performing checks protect itself from reentrancy attack. This can be exploited if the address of the receiver is a Smart Contract and implements a payable callback function

Vulnerability Details

**A reentrancy attack is when the execution flow is transferred to an external contract, usually via an external call **e.g. a “fallback” function , allowing the function (or another function) to be called recursively.

Impact

A malicious charity can mint itself infinite amount of NFTs by repeatedly donating to itself in it's fallback function.

Tools Used

Manual review.

Recommendations

Mutexes or locks can be implemented. Another solution is to use a third party library code with modifier function for protection, e.g. ReentrancyGuard from OpenZeppelin with it's nonReentrant modifier. For extensive information you can refer to https://www.cyfrin.io/blog/what-is-a-reentrancy-attack-solidity-smart-contracts .

Updates

Lead Judging Commences

n0kto Lead Judge 12 months ago
Submission Judgement Published
Validated
Assigned finding tags:

finding-donate-reentrancy-multiple-NFT-minted

Impact: High, one charity can reenter the donate function with the same ETH provided and mint several NFT. Likelyhood: Low, any malicious charity can do it but Admin is trusted and should verify the charity contract before "verifying" it.

Support

FAQs

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