SNARKeling Treasure Hunt

First Flight #59
Beginner FriendlyGameFiFoundry
100 EXP
Submission Details
Impact: medium
Likelihood: high

Incorrect address emitted in Claimed event leads to misleading logs

Author Revealed upon completion

The contract emits the Claimed event with msg.sender instead of the actual payout recipient, causing off-chain systems to misinterpret who received the reward.

Description

  • The contract emits the caller (msg.sender) instead of the actual recipient:

event Claimed(bytes32 indexed treasureHash, address indexed recipient);
// ...
// @> Emits msg.sender instead of recipient
emit Claimed(treasureHash, msg.sender);

Risk

Likelihood

  • Occurs on every successful claim()

Impact

  • Off-chain systems (indexers, dashboards, analytics) record incorrect recipient

  • Breaks accounting, attribution, and monitoring

  • Can mislead users and auditors analyzing contract activity

Proof of Concept

Add this test

function testClaimEventEmitsWrongRecipient() public {
(
bytes memory proof,
bytes32 treasureHash,
address payable recipient
) = _loadFixture();
vm.prank(participant);
vm.expectEmit(true, true, false, false);
// Expect recipient, but contract emits msg.sender instead
emit TreasureHunt.Claimed(treasureHash, recipient);
// This will FAIL because actual emitted value is msg.sender
hunt.claim(proof, treasureHash, recipient);
}

Recommended Mitigation

- emit Claimed(treasureHash, msg.sender);
+ emit Claimed(treasureHash, recipient);

Support

FAQs

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

Give us feedback!