Why it matters
An attacker can produce two inputs with the same digest, so a signature or integrity check built on it can be forged, and fast hashes make stolen password digests quick to crack.
How to fix it
Use sha256 or stronger. For passwords use a password hash (argon2, bcrypt, scrypt).
Example
The rule's own test fixtures, verbatim: the test suite requires the rule to report the first and not the second.
const crypto = require("crypto");
function fingerprint(password) {
return crypto.createHash("md5").update(password).digest("hex");
}const crypto = require("crypto");
function fingerprint(password) {
return crypto.createHash("sha256").update(password).digest("hex");
}What TrustIvan reads
Runs on repository scans of JavaScript source once static analysis is turned on (SAST_RULES and the separately built analyzer image); it is off by default.
Weakness classes and references
Related checks
- TLS verification disabled (JavaScript)
JavaScriptSeverity: High
trustivan-javascript-tls-verification-disabled - Weak cipher (JavaScript)
JavaScriptSeverity: High
trustivan-javascript-weak-cipher - React dangerous HTML (JavaScript)
JavaScriptSeverity: Medium
trustivan-javascript-react-dangerous-html - Insecure random secret (JavaScript)
JavaScriptSeverity: Medium
trustivan-javascript-insecure-random-secret - Child process exec interpolation (JavaScript)
JavaScriptSeverity: Medium
trustivan-javascript-child-process-exec-interpolation - JWT none algorithm (JavaScript)
JavaScriptSeverity: High
trustivan-javascript-jwt-none-algorithm
Terms: SAST (static application security testing), Taint analysis, CWE (Common Weakness Enumeration), OWASP Top 10
All static analysis (SAST) checks · The whole catalogue · How this works in TrustIvan · Documentation