hackweb
notes on hacking and technology
IT EN
main menu
user menu
you are not logged in

ECB: the mode that draws the penguin

November 16, 2025 · 1 min read · #crypto #block-cipher #ecb

Electronic Codebook encrypts block by block without chaining. Consequence: identical inputs produce identical outputs, and structure leaks.

Why it is weak

An image encrypted in ECB still shows its outlines (the famous Tux penguin). Beyond aesthetics: an attacker spots repeated blocks, reorders or reuses ciphertext blocks (cut-and-paste), and with an encryption oracle recovers secrets one byte at a time (byte-at-a-time ECB decryption).

C = ECB(known_prefix || SECRET)
# align the secret to block boundaries and guess it byte by byte

Defence

Do not use ECB. Use authenticated modes (GCM) with a unique IV/nonce per message. If you only need confidentiality, CBC with a random IV still beats ECB, but GCM is the correct choice today.


« back to home

latest posts
 
your IP address:
216.73.216.108
visitor #1
MOTD:
Every abstraction leaks somewhere.
Here we look at where.
topics