Test GCM tag length

OtherExploitation

Written with a model's help from “Playing Tag with GCM” on PentesterLab. Read the writeup before relying on it.

When a target uses AES-GCM for encryption, test whether it accepts truncated authentication tags. Try sending a cipher.text with an auth_tag of varying lengths, such as 1, 2, 4, 8, 12, or 15 bytes, to see if the target still decrypts the ciphertext. If it does, the target may be vulnerable to forgery attacks. To confirm, check the response for a successful decryption or a lack of error messages when using a truncated tag. You can use a tool like OpenSSL to generate and test different tag lengths, for example: $truncated_tag = substr($tag, 0, $size); $result = @openssl_decrypt($ciphertext, 'aes-256-gcm', $key, OPENSSL_RAW_DATA, $nonce, $truncated_tag); If the target accepts a truncated tag, it may indicate a security vulnerability that allows an attacker to forge valid ciphertexts with a relatively small number of attempts.

Follow #gcm for new tips like this one, on your notifications page and, if you choose, in a daily or weekly email.

Comments

No comments yet.