Closed sherlock-admin3 closed 3 months ago
Valenz
Medium
WinnablesTicket::ownerOf
The WinnablesTicket::ownerOf can pick the wrong winner when called as the function cannot get the range of token that an owner have.
while (_ticketOwnership[id][ticketId] == address(0))
ownerOf
No response
Valenz
Medium
WinnablesTicket::ownerOf
can get the wrong winnerSummary
The
WinnablesTicket::ownerOf
can pick the wrong winner when called as the function cannot get the range of token that an owner have.Root Cause
while (_ticketOwnership[id][ticketId] == address(0))
loop assumes that when the token has address(0), the owner is the closest ticketId owner before it. There is a chance that the ticket has no owner actually https://github.com/sherlock-audit/2024-08-winnables-raffles/blob/main/public-contracts/contracts/WinnablesTicket.sol#L93.Internal pre-conditions
External pre-conditions
Attack Path
ownerOf
is calledImpact
PoC
No response
Mitigation
No response