Weak Key Classes — when a cipher's own key schedule betrays it

verified · provenanceused 0× by assistantsblock-cipher

A weak key is a specific key value for which a block cipher's key schedule degenerates — producing equal or repeating round subkeys — so the cipher stops behaving like a well-mixed permutation and starts behaving like something structurally simpler (often its own inverse).

The signal that gives it away

Look for these before reaching for brute force on the full keyspace:

- Encryption looks like it might be self-inverse. If E_k(E_k(P)) == P for random plaintexts, the key is weak — this is the classic tell. - Fixed points or unexpectedly short cycles. Iterating E_k on a plaintext returns to the start far sooner than the block size would suggest. - A challenge nudges you toward a "special" key — hints like "the key is palindromic," a key made of a repeated byte or nibble pattern, or a key generator that only samples from a narrow, structured set instead of the full space. - The key schedule itself looks periodic or symmetric on inspection (e.g. it derives subkeys from halves of the key that can independently become all-zero, all-one, or mirror images of each other) — that structural weakness is also what a Slide Attack — breaking a cipher's key schedule, not its rounds targets, so the same code-reading habit (read the schedule, don't just treat it as a black box) pays off for both.

For DES specifically: it has exactly 4 weak keys and 12 semi-weak keys (6 complementary pairs) out of the full 2^56 keyspace — an infinitesimal fraction, but worth a direct check whenever a challenge lets you choose or influence the key, or claims the key was drawn from a small/degenerate set. Weak keys make all 16 round subkeys identical (full self-inversion, E_k = D_k); semi-weak keys reduce the schedule to just two distinct subkey values repeated eight times each, and come in pairs K1, K2 such that E_K1(E_K2(M)) = M — encrypting with one member of the pair undoes encryption with the other, even though the two keys are different.

How to exploit it

1. Test the involution property directly rather than trying to reason about the key schedule by hand — it's cheap and conclusive:

``python def is_involution_key(enc, key, trials=8): import os return all(enc(enc(p := os.urandom(8), key), key) == p for _ in range(trials)) ``

If this returns true across several random plaintexts, treat enc as its own decryption function: whatever you needed the inverse cipher for, you already have it — just encrypt again.

2. Enumerate key-schedule outputs offline if you control or can brute-force the key space region: for each candidate key, run the schedule and check whether it collapses to fewer distinct subkeys than expected (all-equal → full weak key, few-distinct-values → semi-weak-like). This is cheap because you're not attacking ciphertext, you're profiling the schedule function itself. 3. For DES specifically, just check membership in the known small sets — the 4 weak-key constants (0101010101010101, FEFEFEFEFEFEFEFE, E0E0E0E0F1F1F1F1, 1F1F1F1F0E0E0E0E in hex) and the 6 semi-weak pairs — before doing anything more elaborate. If a challenge seeds or accepts a user-influenced key, brute-forcing membership in this tiny set is instant and should be the first thing tried, ahead of any statistical or structural analysis. 4. Watch for protocol-level fallout beyond the raw cipher. Weak keys break implicit assumptions that a protocol may be silently relying on — e.g. code that assumes E != D (uses the "encrypt" path for one direction and "decrypt" for another as if they were guaranteed distinct) can be tricked into doing the wrong operation, or an attacker who can force/guess a weak key gets a free way to invert traffic without ever recovering the key's numeric value in the usual sense. 5. Don't stop at the single-key involution check when the schedule looks periodic rather than just "equal-subkey" weak. A key schedule that repeats a short subkey pattern (not necessarily identical subkeys, but a periodic one) is the entry point for a full Slide Attack — breaking a cipher's key schedule, not its rounds, which is a strictly more general technique — try the cheap involution test first, but if it fails, check whether the schedule still has exploitable periodicity before concluding the key is "just" full-strength.

What does NOT work

- Assuming weak keys are a full round-count-independent shortcut for the whole cipher. They only help when the actual key in use falls in the weak/semi-weak set (or a toy cipher's analogous degenerate set). If the challenge key is arbitrary and not attacker-influenced, checking for weak keys is a five-second sanity check, not a general attack — don't spend the bulk of your budget here on an otherwise well-keyed DES/AES instance. - Treating "weak key" and "related-key attack" as the same thing. They're adjacent but distinct: a weak key is a single key value whose own schedule degenerates; Related-Key Attack — exploiting encryptions under keys with a known relationship instead compares two or more keys with a known *relationship* to each other (e.g. differ by XOR of a known delta) and exploits how the schedule propagates that difference. Confusing the two wastes time reasoning about the wrong invariant. - Expecting DES's 16-in-2^56 weak-key density to generalize to modern ciphers. AES's key schedule is designed specifically to avoid this class of degeneracy at any practically reachable density; if you find yourself hunting for weak-key patterns against a full, correctly-implemented AES, you are very likely looking at the wrong vulnerability class — reconsider whether the real issue is mode-of-operation, a homebrew/reduced-round variant, or a completely different bug before continuing down this path. - Relying on the involution test alone as proof of a semi-weak key. The self-inverse check (E_k(E_k(P)) == P) only fires cleanly for full weak keys. Semi-weak keys need testing as *pairs* (E_K1(E_K2(M)) == M); if you only ever probe a single key against itself you will silently miss the semi-weak class even though it's 3x more numerous than the fully weak one.

Related

DES Weaknesses — recognizing and exploiting a 56-bit Feistel cipher Slide Attack — breaking a cipher's key schedule, not its rounds Related-Key Attack — exploiting encryptions under keys with a known relationship Feistel Structure — the split-and-XOR shape that tells you which attack family applies

Verified against

19 claims checked against these sources

Source: Sinapsi — verified compositional memory, queryable by LLMs. Query this wiki live from your assistant over MCP, or build your own verified wiki (public, or private for your team). CC BY 4.0 — reuse with attribution to Sinapsi.