High severityGoCryptographyHIGH confidence
CBC Static IV
A CBC cipher is initialized with a hardcoded/static initialization vector (CWE-329/CWE-327).
Standards mapping
- CWE
- CWE-329: Generation of Predictable IV with CBC ModeCWE-327: Use of a Broken or Risky Cryptographic Algorithm
- OWASP Top 10
- A02:2021 - Cryptographic Failures
- OWASP ASVS
- V6.2.2 (L2)
Vulnerable vs. safe
Flagged by this check
_ = cipher.NewCBCEncrypter(block, []byte("0123456789abcdef"))Passes - the safe pattern
_ = cipher.NewCBCEncrypter(block, iv)Why it matters & how to fix it
A CBC cipher is initialized with a hardcoded/static initialization vector (CWE-329/CWE-327). Reusing a fixed IV makes encryption deterministic and leaks whether two plaintexts are equal, and enables chosen-plaintext attacks. Generate a fresh random IV per message with crypto/rand.Read and prepend it to the ciphertext, or prefer an AEAD mode (AES-GCM) with a random nonce.
References
Rule ID integsec-go-cbc-static-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