Skip to content
Crypto Write-up Advanced

Advisory: security issues in AWS KMS and AWS Encryption SDKs

The AWS KMS ciphertext format and the AWS Encryption SDKs allowed an attacker to replace the key identifier in a ciphertext with their own, causing the victim's decryption attempt to log sensitive information (account ID, IP address, user agent, encryption context) to the attacker's account. Additionally, the SDKs were not robust: a single ciphertext could decrypt to different plaintexts for different recipients.

Thai Duong Follow

Published on vnhacker.blogspot.com

September 25, 2020

Thai Duong (@XorNinja), on vnhacker.blogspot.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

The key identifier in the ciphertext was not authenticated, allowing an attacker to substitute it and cause decryption attempts to be logged in their account; additionally, the AEAD ciphers used lacked key commitment, enabling conflicting plaintexts.

Impact

An attacker could learn the victim's AWS account ID, IP address, user agent, and encryption context, and could also forge ciphertexts that the victim would accept; the attack requires the victim to have an IAM policy allowing access to the attacker's CMK.

What the attacker needed

Victim has IAM policy allowing access to attacker's CMK; attacker can intercept a ciphertext

The fix

Amazon fixed these bugs in release 2.0.0 of the SDKs, which introduced explicit key IDs and key commitment.

How it was found

  1. The attacker creates a CMK that has a key policy that allows access from everyone.
  2. The attacker intercepts a ciphertext from the victim, and replaces its CMK with their CMK.
  3. Whenever the victim attempts to decrypt the modified ciphertext, the attacker learns the timing of such actions, the victim’s AWS Account ID, user agent, encryption context, and IP address.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

When you encrypt data with a key, the ciphertext includes information about which key was used. In AWS KMS, that key identifier was not protected, so an attacker could swap it for their own key. When the victim tried to decrypt, AWS would log the failed attempt in the attacker's account, revealing private details like the victim's IP address and account ID. Also, the encryption method used for multiple recipients could be tricked into showing different messages to different people.

What is Crypto?

Encryption, signatures, randomness or certificate checks that do not protect what they claim to.

More from AWS

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cryptographic weaknesses

The lesson behind this report.

Encryption, signatures, randomness or certificate checks that do not protect what they claim to.