PrizePool.awardExternalERC721() Erroneously Emits Events
The awardExternalERC721 function emits an AwardedExternalERC721 event listing all tokenIds, even those that failed to transfer. An off-chain script or user could be misled into thinking a tokenId was successfully awarded.
Submitted by leastwood.
Impact
The awardExternalERC721() function uses solidity’s try and catch statement to ensure a single tokenId cannot deny function execution. If the try statement fails, an ErrorAwardingExternalERC721 event is emitted with the relevant error, however, the failed tokenId is not removed from the list of tokenIds emitted at the end of function execution. As a result, the AwardedExternalERC721 is emitted with the entire list of tokenIds, regardless of failure. An off-chain script or user could therefore be tricked into thinking an ERC721 tokenId was successfully awarded.
Proof of Concept
https://github.com/pooltogether/v4-core/blob/master/contracts/prize-pool/PrizePool.sol#L250-L270
Tools Used
Manual code review
Recommended Mitigation Steps
Consider emitting only successfully transferred tokenIds in the AwardedExternalERC721 event.
PierrickGT (PoolTogether) confirmed and patched:
Alex the Entreprenerd (judge) commented:
The sponsor acknowledged and mitigated by actively managing a list of
_awardedTokenIdsto keep track of the tokens that didn’t go through thecatchpart of the error hadling
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Impact
An off-chain script or user could be tricked into thinking an ERC721 tokenId was successfully awarded.
What the attacker needed
None
The fix
The code should be fixed to emit only successfully transferred tokenIds in the AwardedExternalERC721 event.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
When a smart contract awards digital collectibles (ERC721 tokens), it sends out an event to announce success. This report found that the event included tokens that actually failed to transfer, so someone watching the event might think all tokens were awarded when some were not.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.