Weak Cryptography Detection
Identifies imports and function calls for deprecated crypto algorithms and suggests modern replacements. See patterns.yaml for detection rules.
Detection Workflow
- Scan imports — flag
crypto/md5,crypto/sha1,crypto/des,hashlib.md5,hashlib.sha1 - Scan calls — flag
md5.New(),md5.Sum(),sha1.New(),sha1.Sum(),DES.new() - Classify — hashing (MD5/SHA1) vs encryption (DES/RC4) vs password storage
- Recommend — SHA-256+ for hashing, AES-256 for encryption, bcrypt/scrypt/argon2 for passwords
Vulnerable
import "crypto/md5"
hash := md5.Sum(data)
Safe
import "crypto/sha256"
hash := sha256.Sum256(data)