Reproduced Exploit

Guanciale: Wheel rewards are credited to the VRF coordinator

rawFulfillRandomWords can only be called by the VRF coordinator. _handleRewardPayout still adds extra spins and gPoints to msg.sender. The player stored on the spin request stays at zero. One SPIN token is minted to the coordinator.

Dec 2024•Ethereum•logic•3 min read

Loss

The player receives 0 extra spins and 0 gPoints. The VRF coordinator receives 1 spin and 5 gPoints

Chain

Ethereum

Category

logic

Date

Dec 2024

Source

AuditVault

EVM Playground

Source-level debugger — step opcodes and Solidity in sync

evm-hack-analyzer

The attack is replayed in an in-browser EVM preloaded with the exact dumped fork state. The execution tree shows every call; step by Solidity line or by opcode across all depths — source, Stack, Memory, Storage, Balances (native / ERC-20 / NFT), Transient storage and Return value stay in sync. Click a tree node, opcode, or source line to jump. Query opens a search over the trace: previous and next writes, balance changes and calls, breakpoints, and a diff of everything that changed between two steps. No backend, no live RPC.

Loading fork state…

Source & credit. Reproduction of a public audit finding curated by AuditVault — the original finding: 45547-c-02-incorrect-receiver-of-extraspins-and-gpoints-in-handle. Standalone Foundry PoC and full write-up: 45547-c-02-incorrect-receiver-of-extraspins-and-gpoints-in-handle_exp in the evm-hack-registry mirror.


Vulnerability classes: vuln/logic/reward-calculation

Key info#

FieldValue
LossThe player receives 0 extra spins and 0 gPoints. The VRF coordinator receives 1 spin and 5 gPoints
Vulnerable contractWheelOfGuantune._handleRewardPayout
Attacker EOA0x1111111111111111111111111111111111111111
Attack contractExploit
Attack txExploit.run()
Chain / block / dateEthereum model · local · 2024-12
Compilersolc 0.8.27, cancun
Bug classReward credited to msg.sender inside a VRF callback

TL;DR#

rawFulfillRandomWords can only be called by the VRF coordinator. _handleRewardPayout still adds extra spins and gPoints to msg.sender. The player stored on the spin request stays at zero. One SPIN token is minted to the coordinator.

Background#

Shieldify's December 2024 review of Guanciale Stake, finding C-02, in WheelOfGuantune. The team marked the issue fixed. The blamed lines are the extraSpinsOfUser[msg.sender] and gPointsOfUser[msg.sender] updates.

The vulnerable code#

SOLIDITY
$.extraSpinsOfUser[msg.sender] += extraSpins; // @> VULN: credits the VRF coordinator, not user
// FIX: $.extraSpinsOfUser[user] += extraSpins;
$.gPointsOfUser[msg.sender] += gPoints; // @> VULN: gPoints follow msg.sender as well
// FIX: $.gPointsOfUser[user] += gPoints;

Root cause#

The payout function receives the spinning user and does not use it. The only address allowed to enter the callback is the coordinator, so msg.sender is never the player.

Preconditions#

  • A player calls spin() and the request stores that player.
  • The coordinator later calls rawFulfillRandomWords.
  • The drawn reward type is extra spins or gPoints.

Attack walkthrough#

  1. The player calls spin. The request records the player.
  2. The coordinator fulfills the request.
  3. The extra-spin table returns 1. That 1 is added to the coordinator, and 1 SPIN is minted to the coordinator.
  4. The gPoints table returns 5. Those 5 are added to the coordinator.
  5. The player's spin balance and gPoints balance are both 0.

Diagrams#

flowchart TD A["Player calls spin"] --> B["Request stores the player"] B --> C["Coordinator calls rawFulfillRandomWords"] C --> D["VULN extra spins added to msg.sender"] D --> E["VULN gPoints added to msg.sender"] E --> F["Player stays at 0 and coordinator holds 1 SPIN"]

Impact#

The player who paid for the spin does not receive the extra spin or the gPoints. The coordinator's extra-spin balance becomes 1 and its SPIN balance becomes 1e18. The same mis-credit applies to gPoints.

Remediation#

Write both balances to the user argument, which is the address stored on the spin request, as in the Shieldify diff.

How to reproduce#

BASH
cd 45547-c-02-incorrect-receiver-of-extraspins-and-gpoints-in-handle_exp
forge test -vv

test_exploit_coordinator_receives_the_players_reward asserts the player is at 0 and the coordinator holds 1 spin, 5 gPoints, and 1 SPIN. Captured output is output.txt.

Sources#


Sources & further analysis#

Reproductions & code

Alerts & third-party analyses

  • Web3Sec X hacked database: search.
  • Rekt leaderboard: search.
  • Solodit incident search: search.

These dashboards index community alerts tweets, post-mortems, and independent write-ups. Reach them through the protocol name above to cross-check this reproduction against other analyses.