# Predictable seed snipes selection

Block number or height used as entropy for selection, index or auction windows an attacker can precompute

_Area: Smart contract access control and control flow. Seen in 3 disclosed reports; latest 2023-08-09. Updated 2026-11-17._

## How it works
A contract needs a "random" choice — a starting index, a validator to unbond from, or a window in which a sole bidder can win — and derives it from a value the attacker already knows: `block.number`, block height, or a small fixed block count. Because the input is public and deterministic, the outcome is computable before the transaction is sent. The broken assumption is that block fields are entropy; they are not. Anyone can compute the result for any future block and act on it, or suppress competing actions until the window closes.

## Where it shows up
- `keccak256(... block.number ...) % supply` or similar used to pick a starting index or shuffle [E2](https://bugbountylibrary.com/r/c4%3A2022-03-joyn%3AM-08.md)
- RNG seeded with `block_height`/`block.number` plus a loop counter, feeding a value-bearing choice [E3](https://bugbountylibrary.com/r/c4%3A2022-02-anchor%3AM-08.md)
- Auction close conditions like `block.number > highestBidBlock + nextBidderBlockLimit` with a small fixed limit [E1](https://bugbountylibrary.com/r/c4%3A2023-05-venus%3AM-01.md)
- Metadata or `_baseUri` set before mint, so "rare" IDs are known in advance [E2](https://bugbountylibrary.com/r/c4%3A2022-03-joyn%3AM-08.md)
- Selection that gates rewards, stake, or which asset is touched, and that the caller can retry or skip [E3](https://bugbountylibrary.com/r/c4%3A2022-02-anchor%3AM-08.md)

## How to review
Find every place a block field feeds a choice. Ask: can an outsider compute the outcome for a future block before committing? If yes, the property "selection is unpredictable to the caller at decision time" fails. For auctions, check the anti-sniping window against the chain's cost of filling blocks and whether a private mempool exists [E1](https://bugbountylibrary.com/r/c4%3A2023-05-venus%3AM-01.md). For index shuffles, check whether metadata is readable pre-mint [E2](https://bugbountylibrary.com/r/c4%3A2022-03-joyn%3AM-08.md). For validator/stake selection, check whether the caller controls retry or skip [E3](https://bugbountylibrary.com/r/c4%3A2022-02-anchor%3AM-08.md).

## How finders spotted it
- Read `closeAuction`'s require, saw only `block.number > highestBidBlock + nextBidderBlockLimit`, noted the limit was 10 blocks (~30s) and that BSC block space is cheap with no private mempool [E1](https://bugbountylibrary.com/r/c4%3A2023-05-venus%3AM-01.md)
- Recognized `block.number` is not entropy, and that `_baseUri` was set at initialization so rare IDs were precomputable [E2](https://bugbountylibrary.com/r/c4%3A2022-03-joyn%3AM-08.md)
- Code review of the unbonding path spotted block height as an RNG seed and reasoned validator choice affects reward distribution [E3](https://bugbountylibrary.com/r/c4%3A2022-02-anchor%3AM-08.md)

## Variants seen
- Starting-index shuffle from `block.number` for NFT mint sniping [E2](https://bugbountylibrary.com/r/c4%3A2022-03-joyn%3AM-08.md)
- Validator selection seeded with block height, iterated to capture stake [E3](https://bugbountylibrary.com/r/c4%3A2022-02-anchor%3AM-08.md)
- Fixed-block auction window won by a single floor bid plus block stuffing [E1](https://bugbountylibrary.com/r/c4%3A2023-05-venus%3AM-01.md)

## Impact and severity
Rare NFTs sniped at mint [E2](https://bugbountylibrary.com/r/c4%3A2022-03-joyn%3AM-08.md); one validator capturing essentially all bond rewards by iterating bond/unbond [E3](https://bugbountylibrary.com/r/c4%3A2022-02-anchor%3AM-08.md); bad debt auctioned at the minimum 10% incentive, harming the protocol [E1](https://bugbountylibrary.com/r/c4%3A2023-05-venus%3AM-01.md). Severity rises when the predictable choice gates value the attacker can retry or scale, and when the chain makes suppression cheap [E1](https://bugbountylibrary.com/r/c4%3A2023-05-venus%3AM-01.md)[E3](https://bugbountylibrary.com/r/c4%3A2022-02-anchor%3AM-08.md).

## Evidence
- E1: https://bugbountylibrary.com/r/c4%3A2023-05-venus%3AM-01.md
- E2: https://bugbountylibrary.com/r/c4%3A2022-03-joyn%3AM-08.md
- E3: https://bugbountylibrary.com/r/c4%3A2022-02-anchor%3AM-08.md
