High severityJavaScript / TypeScriptHardcoded SecretsHIGH confidence
Hardcoded Crypto Key Or IV
A hard-coded key or IV is passed to a crypto cipher.
Standards mapping
- OWASP Top 10
- A02:2021 - Cryptographic Failures
- OWASP ASVS
- V6.4.1 (L2)V6.2.2 (L2)
Vulnerable vs. safe
Flagged by this check
const c1 = crypto.createCipheriv("aes-256-cbc", "0123456789abcdef0123456789abcdef", iv);Passes - the safe pattern
const c2 = crypto.createCipheriv("aes-256-gcm", derivedKey, randomIv);Why it matters & how to fix it
A hard-coded key or IV is passed to a crypto cipher. Derive keys from a KDF or load them from a secrets manager, and generate a fresh random IV per message with crypto.randomBytes().
References
Rule ID integsec-js-hardcoded-crypto-key-or-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 - Hardcoded SecretsBasic Auth Credentials In URL
- JavaScript / TypeScript - Hardcoded SecretsDB Connection String With Credentials
- JavaScript / TypeScript - Hardcoded SecretsHardcoded Credential String
- Python - Hardcoded SecretsBasic Auth Credentials In URL
- Python - Hardcoded SecretsDB Connection String Credentials
- Python - Hardcoded SecretsDjango Databases Password Literal