symmetric-cipher-attacks

Symmetric cipher attack playbook. Use when exploiting block cipher mode weaknesses (CBC padding oracle, ECB cut-and-paste, bit flipping), stream cipher key reuse, or meet-in-the-middle attacks.

By yaklang · 2,915 installs

npx skills add yaklang/hack-skills --skill symmetric-cipher-attacks

Source repository · Upstream listing

SKILL: Symmetric Cipher Attacks — Expert Cryptanalysis Playbook AI LOAD INSTRUCTION : Expert techniques for attacking symmetric encryption in CTF and authorized testing. Covers CBC padding oracle, CBC bit flipping, ECB detection and exploitation, stream cipher key reuse, LFSR/LCG state recovery, RC4 biases, and meet in the middle attacks. Base models often confuse ECB and CBC attack strategies or fail to set up byte at a time ECB decryption correctly. 0. RELATED ROUTING [rsa attack techniques](../rsa attack techniques/SKILL.md) when symmetric key is protected by RSA [hash attack techniques](../hash attack techniques/SKILL.md) when HMAC or hash based authentication is involved [lattice crypto attacks](../lattice crypto attacks/SKILL.md) for LCG/LFSR state recovery via lattice methods Advanced Reference Also load [BLOCK CIPHER ATTACKS.md](./BLOCK CIPHER ATTACKS.md) when you need: Detailed attack scripts with full Python implementations Step by step byte at a time ECB walkthrough PadBuster usage and custom padding oracle scripts LCG/LFSR recovery implementation Quick attack selection Observable Behavior Likely Weakness Attack Same plaintext → same ciphertext (block aligned) ECB mode Cut and paste / byte at a time Padding error distinguishable CBC padding oracle Decrypt without key Can modify ciphertext, affects next block CBC mode, no integrity check Bit flipping Key reused with XOR/stream cipher Two time pad XOR ciphertexts together Predictable PRNG output LCG or LFSR State recovery Double encryption used 2DES like Meet in the middle 1. PADDING ORACLE ATTACK (CBC MODE) 1.1 Mechanism CBC decryption: P i = D K(C i) ⊕ C {i 1} If the server reveals whether padding is valid (PKCS 7), we can decrypt any block by manipulating the previous ciphertext block. 1.2 Attack Steps 1.3 Python Implementation 1.4 Tools 2. CBC BIT FLIPPING 2.1 Concept Flipping bit at position j in C {i 1} flips the same bit at position j in P i (and corrupts all of P {i 1}). 2.2 Practical Example 3. ECB MODE ATTACKS 3.1 Detection 3.2 ECB Cut and Paste Reorder ciphertext blocks to create new valid plaintexts. 3.3 Byte at a Time ECB Decryption Decrypt unknown appended secret one byte at a time. 4. STREAM CIPHER ATTACKS 4.1 Known Plaintext / Key Reuse (Two Time Pad) 4.2 Single Byte XOR Brute Force 4.3 Repeating Key XOR (Kasiski like) 4.4 LFSR State Recovery (Berlekamp Massey) 4.5 RC4 Biases Bias Description Exploitation Initial byte bias P(K[0] = 0) ≈ 2/256 (double normal) Statistical plaintext recovery for first bytes Fluhrer Mantin Shamir Weak key scheduling with IV WEP attack (historical) NOMORE attack Long term biases in keystream TLS/RC4 plaintext recovery (2^24 2^26 ciphertexts) Invariance weakness Key dependent biases throughout stream Statistical attack on many encryptions 5. MEET IN THE MIDDLE 5.1 Double Encryption Attack 6. DECISION TREE 7. TOOLS Tool Purpose PadBuster Automated padding oracle exploitation xortool Repeating key XOR analysis (key length detection + cracking) CyberChef Quick XOR, encoding, block cipher operations SageMath LFSR/LCG analysis, lattice based recovery pycryptodome AES/DES implementation for testing hashcat Brute force symmetric keys (GPU accelerated) Custom Python All attacks above implementable in pure Python