Use of a broken or risky cryptographic encryption algorithm
ID |
dart.cryptography.weak_encryption_algorithm |
Severity |
critical |
Remediation Complexity |
medium |
Remediation Risk |
medium |
Remediation Effort |
medium |
Resource |
Cryptography |
Language |
Dart |
Description
A broken or obsolete cryptographic algorithm (DES, 3DES, RC2, RC4, RC5, Blowfish, IDEA) is used to encrypt or sign data. These algorithms are vulnerable to practical attacks or have block / key sizes too small for modern adversaries; ciphertext produced with them must be considered recoverable.
Rationale
DES (56-bit key) is brute-forceable in hours on commodity hardware, 3DES has the Sweet32 birthday attack on its 64-bit block, RC2 and RC4 have practical key-recovery and plaintext-recovery attacks (RC4 famously broken in WPA-TKIP and TLS Bar-Mitzvah), RC5 and IDEA rely on small block sizes that fail under modern data volumes, and Blowfish’s 64-bit block makes it vulnerable to Sweet32 the same way 3DES is.
A Flutter app that encrypts at-rest data (database, exported statements, backups) or in-transit payloads with these algorithms leaks plaintext to anyone with access to the ciphertext — even when the key is unknown — given enough volume or known-plaintext pairs. On mobile, where ciphertext is routinely backed up to iCloud / Google Drive and sometimes synchronised across devices, the practical exposure window is large.
The following code illustrates a vulnerable pattern detected by this rule:
class WeakCiphers {
void pcDirectEngines() {
// VULNERABLE: Use of a broken or risky cryptographic encryption algorithm
final c1 = DESEngine();
// VULNERABLE: Use of a broken or risky cryptographic encryption algorithm
final c2 = DESedeEngine();
// VULNERABLE: Use of a broken or risky cryptographic encryption algorithm
final c3 = RC2Engine();
// VULNERABLE: Use of a broken or risky cryptographic encryption algorithm
final c4 = RC4Engine();
// VULNERABLE: Use of a broken or risky cryptographic encryption algorithm
final c5 = BlowfishEngine();
// VULNERABLE: Use of a broken or risky cryptographic encryption algorithm
final c6 = IDEAEngine();
print('$c1 $c2 $c3 $c4 $c5 $c6');
}
}
Remediation
Use AES (>= 128-bit key) in an authenticated mode (AES-GCM or
AES-CCM), or ChaCha20-Poly1305 for high-throughput / no-AES-NI
environments. Both package:cryptography (AesGcm.with256bits(),
Chacha20.poly1305Aead()) and package:pointycastle (AESEngine
wrapped in GCMBlockCipher) expose safe constructors.
// Vulnerable
final c = DESEngine();
final c2 = BlockCipher('DES');
final stream = RC4Engine();
// Fixed
final aes = AESEngine();
final aead = GCMBlockCipher(AESEngine());
// or via package:cryptography:
// final aead = AesGcm.with256bits();
References
-
OWASP Top 10 2025 - A04 : Cryptographic Failures.
-
OWASP Cryptographic Storage Cheat Sheet — Algorithm and mode recommendations for at-rest encryption
-
Sweet32 birthday attack — Practical attack against 64-bit-block ciphers (3DES, Blowfish) over TLS / VPN
-
Talsec — OWASP Mobile Top 10 for Flutter M10 — Insufficient cryptography in Flutter / Dart with cipher selection guidance
-
package:pointycastle (pub.dev) — Use
AESEngine/GCMBlockCipher/ChaCha7539Engineinstead of DES / RC4 / Blowfish