In cryptography, "salt" is extra piece of data which is included in a hashing algorithm. It makes dictionary attacks more difficult. Using a cryptographic hash function without an unpredictable salt increases the likelihood that an attacker will be able to successfully guess a hashed value such as a password with a dictionary attack.
This rule raises an issue when a hashing function which has been specifically designed for hashing sensitive data, such as pbkdf2, is used with a non-random, reused or too short salt value. It does not raise an issue on base hashing algorithms such as sha1 or md5 as these are often used for other purposes.
hashlib
import crypt
from hashlib import pbkdf2_hmac
hash = pbkdf2_hmac('sha256', password, b'D8VxSmTZt2E2YV454mkqAY5e', 100000) # Noncompliant: salt is hardcoded
crypt
hash = crypt.crypt(password) # Noncompliant: salt is not provided
hashlib
import crypt
from hashlib import pbkdf2_hmac
salt = os.urandom(32)
hash = pbkdf2_hmac('sha256', password, salt, 100000) # Compliant
crypt
salt = crypt.mksalt(crypt.METHOD_SHA256) hash = crypt.crypt(password, salt) # Compliant