Hardcoded iv

From zakirkun/ice-tea · View interactive version

Hardcoded iv is an AI agent skill from the GitHub repository zakirkun/ice-tea. Detects static or hardcoded Initialization Vectors (IV) or nonces in symmetric encryption, breaking confidentiality.

How to use this skill

Skill file

Hardcoded IV / Nonce

Overview

A static or predictable Initialization Vector (IV) in block cipher modes (CBC, CTR, GCM) critically weakens encryption:

The IV/nonce must be randomly generated for each encryption operation and stored alongside the ciphertext.

Detection Strategy

Remediation

Generate a cryptographically random IV for every encryption operation.

Vulnerable (Python):

from Crypto.Cipher import AES
iv = b'\x00' * 16  # Static zero IV!
cipher = AES.new(key, AES.MODE_CBC, iv)

Safe (Python):

import os
from Crypto.Cipher import AES
iv = os.urandom(16)  # Random IV
cipher = AES.new(key, AES.MODE_CBC, iv)
ciphertext = iv + cipher.encrypt(plaintext)  # Prepend IV to output
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.