Skip to content

VNX-760: Password hash or KDF uses a constant or predictable salt

Reports a password hash or KDF salted with a literal constant, a salt-named constant that reaches the hash call, a fixed bcrypt salt, or the user's own username or email, in Go, Java, JavaScript/TypeScript and Python.

Updated 02 Nov 2026Checked against cli@de9b52a
Field Value
Rule ID VNX-760
Severity High
SARIF level error
Kind sast
Languages Go, Java, JavaScript / TypeScript, Python
CWE CWE-760
CAPEC CAPEC-66
ATT&CK T1190
CWSS vector CWSS:1.0/TI:H/AP:RU/AL:S/IC:N/FC:LT/RP:RU/RL:S/AV:L/AS:N/IN:A/SC:A/BI:H/DI:H/EX:H/EC:N/P:H
Tags password-hash predictable-salt cwe-760
Source internal/sast/rules/vnx-760.rego

Overview

VNX-760 maps to CWE-760: Use of a One-Way Hash with a Predictable Salt. It reports a constant written in the salt position of hashlib.pbkdf2_hmac, hashlib.scrypt, PBKDF2HMAC, new PBEKeySpec, pbkdf2.Key, scrypt.Key, argon2.IDKey, crypto.pbkdf2Sync or crypto.scryptSync, a literal $2... salt given to bcrypt, a salt-named variable assigned a constant and then used in a hash or KDF call, and a username or email used as the PBKDF2 salt.

It does not report random salts (os.urandom, secrets, SecureRandom, crypto/rand, randomBytes, gensalt()), a stored hash passed back to hashpw to verify, or salt constants used for something other than password hashing (itsdangerous signing namespaces, column names, lengths). Constant IVs and nonces are VNX-CRYPTO-010.

Why This Matters

A salt only helps if every password gets a different, unpredictable one. A constant salt is the same as no salt across the whole user table: one precomputed table covers every account, and identical passwords still produce identical hashes.

What Gets Flagged

SALT = b"s3cr3t-static-salt"                                            # flagged
return hashlib.pbkdf2_hmac('sha256', password.encode(), b'NaCl', 100000) # flagged
private static final String SALT = "acme-2019";                         // flagged
PBEKeySpec spec = new PBEKeySpec(password, "salt".getBytes(), 65536, 128); // flagged
return scrypt.Key([]byte(password), []byte("NaCl"), 32768, 8, 1, 32)    // flagged

Remediation

  1. Generate a fresh random salt of at least 16 bytes for every password (os.urandom(16), SecureRandom.nextBytes, crypto/rand.Read, crypto.randomBytes(16)) and store it beside the hash.
  2. Prefer bcrypt or Argon2 libraries that generate and embed the salt themselves.

References

Suppressing this rule

Put a nosec comment on the line, or on line 1 to cover the whole file. Use the comment marker of the file’s language (#, //, -- or ;):

# nosec vnx-760
// nosec vnx-760

Or record an ignore rule: vulnetix ignore add --rule vnx-760 --reason "...". See Suppressing findings.

Edit this pageSources: cli/internal/sast/rules/vnx-760.rego, cli/internal/sast/docs/vnx-760.md
esc
↑ ↓ move↵ openSearches in your browser. A key like autonomy.max or a code like threshold_required jumps straight to it.