VNX-338 – Use of Cryptographically Weak Pseudo-Random Number Generator (PRNG)

Overview

VNX-338 maps to CWE-338: Use of Cryptographically Weak Pseudo-Random Number Generator (PRNG). Detects source patterns associated with CWE-338 (Use of Cryptographically Weak Pseudo-Random Number Generator (PRNG)). Each finding should be manually reviewed for exploitability in context.

Severity: High | CWE: CWE-338 | Languages: go

Why This Matters

This weakness class (Use of Cryptographically Weak Pseudo-Random Number Generator (PRNG)) creates a concrete exploit surface: the rule searches for the concrete source-level patterns most commonly associated with CWE-338 and surfaces them for review. Each finding should be evaluated in context — the rule catches the pattern, not the context.

What Gets Flagged

// FLAGGED: contains 'math/rand' pattern
math/rand

Remediation

  1. Review each flagged line and determine whether the pattern represents a real instance of CWE-338 or a false positive.
  2. Replace the flagged construct with a documented safe alternative appropriate to your language and framework.
  3. For confirmed false positives, add a # vulnetix-ignore: VNX-338 comment on the line.
  4. Ensure equivalent test coverage exists to prevent regression.

References