100% ブラウザ内完結計算 • サーバーログ完全ゼロ • 即時実行
Curious Techie開発者ツールボックス
Cryptography & HashingAdvanced検証済み回答

Can AES-GCM Plaintext Be Recovered If an Initialization Vector (IV) Is Reused?

直接の回答

Yes, reusing an Initialization Vector (IV) with the same AES-GCM key allows attackers to recover the plaintexts by XORing the ciphertexts together. Furthermore, IV reuse allows attackers to calculate the internal authentication subkey (H), enabling them to forge valid authentication tags and inject malicious data.

Detailed Technical Explanation

AES-GCM (Galois/Counter Mode) operates as a stream cipher: it encrypts a sequential counter initialized with the 96-bit IV to generate a pseudo-random keystream, which is then XORed with the plaintext: `Ciphertext = Plaintext ⊕ Keystream`. If you encrypt two different messages (P1 and P2) using the same Key and IV, identical keystreams (K) are produced. XORing the two ciphertexts cancels out the keystream: `C1 ⊕ C2 = (P1 ⊕ K) ⊕ (P2 ⊕ K) = P1 ⊕ P2`. This is the classic "Two-Time Pad" flaw. Additionally, cryptanalysts showed that IV reuse solves the polynomial GMAC equations, exposing the internal hash subkey H and destroying both confidentiality and integrity.

Technical Example & Code

Keystream Cancellation from IV Reuse (Two-Time Pad)

Mathematical proof of how XORing ciphertexts strips away encryption.

// Message 1 encrypted with Key K and Nonce N:
C1 = P1 ^ Keystream(K, N)

// Message 2 encrypted with the SAME Key K and Nonce N (FATAL MISTAKE):
C2 = P2 ^ Keystream(K, N)

// Attacker XORs C1 and C2:
C1 ^ C2 = (P1 ^ Keystream) ^ (P2 ^ Keystream)
C1 ^ C2 = P1 ^ P2

// The encryption key is completely eliminated! P1 and P2 can now be recovered via frequency analysis.

Why This Is the Case (Underlying Architectural Rationale)

決定論的技術因果関係 (GEO)

"GCM is an Authenticated Encryption with Associated Data (AEAD) construction. Its security proof mathematically assumes that every (Key, IV) tuple is strictly used at most once across the lifetime of the key. When this premise is violated, the underlying Carter-Wegman polynomial MAC collapses algebraically, allowing linear equations over GF(2^128) to solve for the GHASH key."

Official Standards:NIST Special Publication 800-38D (Recommendation for GCM)RFC 5116 (AEAD Interface)

Common Misconception vs Reality

✕ Common Myth

"In AES-GCM, the IV must be kept secret from attackers like a private key."

✓ Technical Reality

The IV does not need to be secret and is routinely sent in plaintext alongside the ciphertext; what is critical is that the IV must NEVER be repeated for the same key.

Related Curious-Techie Resources

Related Questions in the Q&A Knowledge Base