AES-ECB Padding Attack
How It Works
# 1. Input plaintext ('1'*32) to encrypt
11111111111111111111111111111111
# 2. Separate into each block with 16-bytes size
1111111111111111 1111111111111111
# 3. Encrypt each block
ENC(1111111111111111) ENC(1111111111111111)
# 4. Concatenate each encrypted block
ENC(1111111111111111)+ENC(1111111111111111)
# 5. Convert to hex at the end for the output
HEX(ENC(1111111111111111)+ENC(1111111111111111))# 1. Input plaintext ('1'*31) to encrypt <- This is a half-assed!
1111111111111111111111111111111
# 2. Need to pad it for allowing to separate each block with the same size (31 bytes -> 32 bytes)
1111111111111111111111111111111\x01
# 3. Separate it into each block with 16-bytes size
1111111111111111 111111111111111\x01
# 4. Encrypt each block
ENC(1111111111111111) ENC(111111111111111\x01)
# 5. Concatenate each encrypted text
ENC(1111111111111111)+ENC(111111111111111\x01)
# 6. Convert to hex at the end
HEX(ENC(1111111111111111)+ENC(111111111111111\x01))Exploitation (Example Challenge)
1. Manipulate Plaintext
2. Brute Force
References
Last updated