CRITICAL
Rule Definition
Using insecure parameters for this encoder could expose users to brute-force and other types of attacks.
Remediation
Always use recommended parameters.
Violation Code Sample
final int saltLengthKO1 = 15;
final int hashLengthKO1 = 15;
final int memoryKO1 = 512;
final int iterationsKO1 = 2;
Argon2PasswordEncoder pe = new Argon2PasswordEncoder(saltLengthKO1, hashLengthKO1, 1, memoryKO1, iterationsKO1); // insecure parameters
Fixed Code Sample
Argon2PasswordEncoder pe = new Argon2PasswordEncoder(); // OK
// Other solution:
final int saltLengthOK1 = 16;
final int hashLengthOK1 = 16;
final int memoryOK1 = 1024;
final int iterationsOK1 = 3;
Argon2PasswordEncoder pe = new Argon2PasswordEncoder(saltLengthOK1, hashLengthOK1, 1, memoryOK1, iterationsOK1); // OK
Reference
CWE-916: Use of Password Hash With Insufficient Computational Effort
https://cwe.mitre.org/data/definitions/916.html
CWE-522: Insufficiently Protected Credentials
https://cwe.mitre.org/data/definitions/522.html
Related Technologies
Technical Criterion
Secure Coding - Input Validation
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.