OWASP·SC09·high

Insecure randomness

The OWASP framing of SWC-120 — on-chain randomness is not private.

What it is

Everything on chain is visible and much of it is influenceable by the block producer. There is no source of secret randomness available to a contract at execution time without an external commitment or an oracle.

Why it matters

Any lottery, reveal, or trait assignment can be predicted or steered by someone with more information or block-building influence than the honest participants.

How to fix it

  • Use a verifiable random function from an oracle.
  • Or commit-reveal, with a penalty for failing to reveal.
  • Never derive the seed from data available in the consuming transaction.

How it is detected

Every audit on EVM Smart Audit checks for SC09 and reports it as passed or flagged in the standards coverage grid — so the report tells you it was checked even when nothing was found. See the detector suite for what else runs alongside it, or the full database for the other 21 checks.

Related weaknesses

Check your contract for insecure randomness

The engine runs this check and 21 others on every audit, and shows what passed as well as what failed.

Start your auditSee pricing