Skip to content
Chain Defenders

Research · Web3 Security · High

Unchecked randomness accounts permit fake VRF data

The gacha flow did not verify that its randomness account belonged to Switchboard, potentially allowing attacker-controlled data to determine rewards.

9 November 2026

What went wrong

The gacha flow accepted randomness_account as an UncheckedAccount<'info>. Helpers parsed its data, but the finding reports no explicit check that the account belonged to the Switchboard On-Demand program.

An attacker could potentially supply an account whose bytes resembled the expected randomness layout. Parsing that layout did not establish that the trusted oracle program had produced or maintained the data.

Why it mattered

The game used randomness to determine gacha rewards. Accepting fabricated randomness data could make those outcomes predictable or controllable by the player supplying the account.

The reported issue concerns authentication of the account used by this integration. It does not demonstrate a failure of Switchboard's VRF cryptography or establish that every protocol using Switchboard is affected.

The important boundary was between externally supplied account data and data authenticated as belonging to the expected oracle program.

The fix

The report recommends validating the account owner before consuming randomness, in the purchase and reveal handlers or their shared validation helpers. The following is the recommended ownership check, rather than the vulnerable implementation:

require!(
    ctx.accounts.randomness_account.owner == SWITCHBOARD_ON_DEMAND_PROGRAM_ID.parse::<Pubkey>().unwrap(),
    GameError::InvalidVrfAccount
);

This rejects accounts that are not owned by the expected program. It addresses the missing ownership validation identified in the report.

Takeaway

Account data having the expected shape does not authenticate its source. Before using externally supplied randomness, validate that the account belongs to the program the integration trusts.

Finding status: Fixed.

Shipping something similar? We review the code before it holds money.

Request an audit