Data is encrypted with DES, triple DES or RC4, which are broken or too weak
What it finds
des.NewCipher(key) or rc4.NewCipher(key): DES has a key small enough to search exhaustively, triple DES has a 64-bit block that leaks plaintext after a few gigabytes under one key, and RC4 has biases that recover plaintext. AES in GCM mode, from crypto/aes and crypto/cipher, or ChaCha20-Poly1305 are the usual choices.
Calls of NewCipher and NewTripleDESCipher of crypto/des and of NewCipher of crypto/rc4 are reported, resolved through the imports.
From the rule's source, weak_cipher.rs.
package p import ( "crypto/aes" "crypto/cipher" "crypto/des" "crypto/rc4") func f(key []byte) (cipher.Block, error) { if _, err := rc4.NewCipher(key); err != nil {tx0 reports: RC4 is too weak to protect data return nil, err } if len(key) == 24 { return des.NewTripleDESCipher(key)tx0 reports: triple DES is too weak to protect data } return aes.NewCipher(key)} Turn it on, off or suppress it
The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/go:weak-cipher" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/go:weak-cipher] reason="..."tx0 explain tx0/go:weak-cipher shows the same in the terminal. Found a false positive? Report it.