High severityJavaCryptographyMEDIUM confidence
Hardcoded Crypto Key IV
Cryptographic key or IV is derived from a hardcoded literal (CWE-798/CWE-321).
Standards mapping
- OWASP Top 10
- A02:2021 - Cryptographic Failures
- OWASP ASVS
- V6.4.1 (L2)
Vulnerable vs. safe
Flagged by this check
SecretKeySpec k = new SecretKeySpec("1234567890123456".getBytes(), "AES");Passes - the safe pattern
SecretKeySpec loaded = new SecretKeySpec(keyBytes, "AES");Why it matters & how to fix it
Cryptographic key or IV is derived from a hardcoded literal (CWE-798/CWE-321). Embedded keys can be extracted from the artifact, defeating the encryption. Load keys from a secrets manager / KMS or a protected keystore, derive per-user keys with a KDF, and use a fresh random IV per message.
References
Rule ID integsec-java-hardcoded-crypto-key-iv - engine: Opengrep - license: MIT - Copyright (c) IntegSec Inc.
TurboPentest runs this check automatically
Connect a GitHub repo and this check runs on every white-box pentest - AI-validated and reported with proof, from $99 per target.
Start a pentestRelated checks
- JavaScript / TypeScript - CryptographyInsecure Randomness For Secrets
- JavaScript / TypeScript - CryptographyWeak Cipher Algorithm
- JavaScript / TypeScript - CryptographyWeak Hash Algorithm
- Python - CryptographyInsecure Random Token
- Python - CryptographyWeak Cipher DES ECB
- Python - CryptographyWeak Hash MD5 SHA1