Skip to content
Business logic Audit finding Intermediate

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.

leastwood Follow

Originally disclosed on Code4rena

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:

PR: https://github.com/pooltogether/v4-core/pull/246

Alex the Entreprenerd (judge) commented:

The sponsor acknowledged and mitigated by actively managing a list of _awardedTokenIds to keep track of the tokens that didn’t go through the catch part of the error hadling

The original report as published on Code4rena, by leastwood. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

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.

More by leastwood

View all

70 more disclosed reports, best first.

More from PoolTogether

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.