F-2025-0004·missing-validation

Ticket ownership can be overwritten due to incorrect logic in NexumManager::buyTickets

Fixedrafflelotteryvrf
TL;DR

Sequential ticket assignment in buyTickets does not check existing ownership, allowing tickets purchased via buySpecificTickets at high indices to be silently overwritten.

Severity
HIGH
Impact
HIGH
Likelihood
MEDIUM
Method
MManual review
CAT.
Complexity
MEDIUM
Exploitability
HIGH
02Section · Description

Description

The contract supports two ticket purchase flows: NexumManager::buySpecificTickets enforces a user-selects-ticket-number system, and NexumManager::buyTickets enforces a sequential assignment process. Because NexumManager::buyTickets assigns tickets based on round.ticketsSold without checking if ticketOwner[productId][roundId][ticketNumber] is already set, a ticket previously bought at a high index via NexumManager::buySpecificTickets can later be overwritten by sequential purchases. This allows an attacker to steal ticket ownership and potentially win jackpots or instant rewards tied to that ticket.

Vulnerable Scenario:

The following steps help understand the issue:

  • Victim buys a high index ticket using NexumManager::buySpecificTickets, ticket #50.
  • ticketOwner[productId][roundId][50] is set to the victim.
  • round.ticketsSold is still low (only 40 sold) because buySpecificTickets purchases do not depend on index order.
  • Ticket purchases continue as normal with calls to NexumManager::buyTickets, which assigns tickets sequentially:
solidity
uint256 ticketNumber = round.ticketsSold;
ticketOwner[productId][roundId][ticketNumber] = msg.sender;
round.ticketsSold++;

When round.ticketsSold reaches 49, an attacker can call NexumManager::buyTickets and overwrite:

solidity
ticketOwner[productId][roundId][50]

If ticket #50 is selected as a winner, the attacker receives the payout instead of the victim.

03Section · Impact

Impact

  • Silent theft of ticket ownership.
  • Attacker can get rewards meant for another user.
  • Loss of trust.
04Section · Recommendation

Recommendation

Prevent overwriting of tickets in NexumManager::buyTickets.

05Section · Resolution

Resolution

Nexalo: Fixed.

Zealynx: Verified. Fixed.

Status
Fixed
F-2025-0004

oog
zealynx

Smart Contract Security Digest

Monthly exploit breakdowns, audit checklists, and DeFi security research — straight to your inbox

© 2026 Zealynx