Use of a Broken or Risky Cryptographic Algorithm
The product uses a broken or risky cryptographic algorithm or protocol.
Cryptographic algorithms are the backbone of modern information security. Using algorithms that have known weaknesses, such as MD5 or DES, can make it trivial for attackers to defeat the protection.
Comment corriger cette vulnérabilité
Stratégies de prévention pour Broken Cryptographic Algorithm basées sur 4 règles de détection Shoulder.
Replace MD5/SHA1/DES/RC4 with bcrypt, SHA-256, or AES-GCM
- import "crypto/md5" - - func hashPassword(password string) string { - hash := md5.Sum([]byte(password)) - return hex.EncodeToString(hash[:]) + import "golang.org/x/crypto/bcrypt" + + func hashPassword(password string) (string, error) { + hash, err := bcrypt.GenerateFromPassword([]byte(password), 12) + if err != nil { + return "", err + } + return string(hash), nil }
Always specify allowed algorithms when verifying JWT tokens
- const decoded = jwt.verify(token, secret); + const decoded = jwt.verify(token, secret, { + algorithms: ['RS256'] + });
Use SHA-256+ for hashing, AES-256-GCM for encryption, and bcrypt for passwords
- const hash = crypto.createHash('md5').update(data).digest('hex'); + const hash = crypto.createHash('sha256').update(data).digest('hex');
Replace MD5/SHA-1/DES/RC4 with SHA-256/SHA-3 for hashing and AES-GCM for encryption
import hashlib def verify_integrity(data): - return hashlib.md5(data.encode()).hexdigest() + return hashlib.sha256(data.encode()).hexdigest()
Trouvez les vulnérabilités dans votre code
Utilisez Shoulder pour scanner votre code à la recherche de patterns Use of a Broken or Risky Cryptographic Algorithm. 4 règles.
# Scan with Shoulder CLI npx @shoulderdev/cli trust --cwe=327 # Or scan entire project npx @shoulderdev/cli trust .
Règles de Détection (4)
Ce qu'il faut surveiller lors des revues de code
Ces patterns indiquent des vulnérabilités potentielles Use of a Broken or Risky Cryptographic Algorithm. Recherchez-les lors des revues de code et des audits de sécurité.
Scannez votre base de code pour Use of a Broken or Risky Cryptographic Algorithm
Shoulder CLI trouve les motifs vulnérables dans toute votre base de code.