CVE-2026-62271: ex_aws_kms defaults RSA key-material wrapping to PKCS#1 v1.5 in get_parameters_for_import/3
Summary
Use of RSA Algorithm without OAEP vulnerability in ex-aws exawskms (ExAws.KMS module) causes callers who import external key material to wrap their secret KMS key material with the deprecated PKCS#1 v1.5 padding scheme by default.
This vulnerability is associated with program file lib/exaws/kms.ex and program routine ExAws.KMS.getparametersforimport/3.
ExAws.KMS.getparametersforimport/3 defaults its wrappingalgorithm argument to "RSAESPKCS1V15". AWS KMS returns this value as the WrappingAlgorithm for the import operation, and it dictates the RSA padding scheme the caller uses to wrap (RSA-encrypt) their secret key material before calling ImportKeyMaterial. AWS KMS also supports the stronger RSAESOAEPSHA1 and RSAESOAEPSHA256 schemes. By defaulting to RSAESPKCS1V15, the library steers callers who do not explicitly override the argument toward the weakest of the three. PKCS#1 v1.5 encryption padding is susceptible to Bleichenbacher adaptive chosen-ciphertext (padding oracle) attacks, which can recover the wrapped plaintext without the private key given an oracle that reveals whether a decrypted value was validly padded. Because the unwrap happens inside AWS KMS, which does not expose a padding oracle, the practical exploitability is low and this is a defense-in-depth weakness. Callers can avoid the weak default by explicitly passing "RSAESOAEPSHA256" (or "RSAESOAEPSHA1") as the wrapping algorithm.
This issue affects exawskms: from 2.1.0 before 2.7.0.
Details
1. Weak default. ExAws.KMS.getparametersforimport/3 in lib/exaws/kms.ex defaults its wrappingalgorithm argument to "RSAESPKCS1V15". AWS KMS also offers RSAESOAEPSHA1 and RSAESOAEPSHA256, so callers who do not pass the argument get the weakest of the three.
2. Wrapping with that scheme. KMS returns the requested value as the WrappingAlgorithm of the import operation, and it dictates the RSA padding the caller uses to encrypt their secret key material under the KMS-provided public key before calling ImportKeyMaterial.
3. Exposure. PKCS#1 v1.5 encryption padding is vulnerable to Bleichenbacher adaptive chosen-ciphertext attacks: an adversary who holds the wrapped ciphertext and can query a padding oracle (anything that reveals whether a decrypted value was validly v1.5-padded) recovers the plaintext without the private key. OAEP is not susceptible. The unwrap happens inside AWS KMS, which does not expose such an oracle, so this is a defense-in-depth weakness.
Proof of concept
1. Call ExAws.KMS.getparametersforimport("alias/import-target") without a wrapping algorithm and read op.data["WrappingAlgorithm"]: it is "RSAESPKCS1V15". 2. Wrap 32 bytes of secret key material with PKCS#1 v1.5 type-2 padding under an RSA public key, producing the ciphertext the attacker observes. 3. Give the attacker the public key, the ciphertext and a boolean oracle that reports whether a decrypted value is validly v1.5-padded. 4. Run the Bleichenbacher '98 attack: repeatedly multiply the ciphertext by s^e mod n, query the oracle, and narrow the interval containing the plaintext until it converges. 5. The recovered plaintext equals the wrapped key material, obtained without the private key.
Impact
This is a cryptographic weak-default issue affecting anyone who uses ExAws.KMS.getparametersforimport/3 to import external key material and relies on the default wrapping algorithm. Such callers wrap sensitive KMS key material with deprecated PKCS#1 v1.5 padding rather than OAEP. Real-world exploitation requires a padding oracle against the RSA decryption, and the KMS-side unwrap does not expose one, so the concrete risk is a defense-in-depth weakness rather than a directly reachable attack.
Workarounds
Explicitly pass "RSAESOAEPSHA256" (or "RSAESOAEPSHA1") as the wrappingalgorithm argument to ExAws.KMS.getparametersforimport/3 instead of relying on the default, and wrap the key material with the corresponding OAEP padding scheme.
Other sources
Use of RSA Algorithm without OAEP vulnerability in ex-aws exawskms (ExAws.KMS module) causes callers who import external key material to wrap their secret KMS key material with the deprecated PKCS#1 v1.5 padding scheme by default.
This vulnerability is associated with program file lib/exaws/kms.ex and program routine ExAws.KMS.getparametersforimport/3.
ExAws.KMS.getparametersforimport/3 defaults its wrappingalgorithm argument to "RSAESPKCS1V15". AWS KMS returns this value as the WrappingAlgorithm for the import operation, and it dictates the RSA padding scheme the caller uses to wrap (RSA-encrypt) their secret key material before calling ImportKeyMaterial. AWS KMS also supports the stronger RSAESOAEPSHA1 and RSAESOAEPSHA256 schemes. By defaulting to RSAESPKCS1V15, the library steers callers who do not explicitly override the argument toward the weakest of the three. PKCS#1 v1.5 encryption padding is susceptible to Bleichenbacher adaptive chosen-ciphertext (padding oracle) attacks, which can recover the wrapped plaintext without the private key given an oracle that reveals whether a decrypted value was validly padded. Because the unwrap happens inside AWS KMS, which does not expose a padding oracle, the practical exploitability is low and this is a defense-in-depth weakness. Callers can avoid the weak default by explicitly passing "RSAESOAEPSHA256" (or "RSAESOAEPSHA1") as the wrapping algorithm.
This issue affects exawskms: from 2.1.0 before 2.7.0.
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
erlang/ex_aws_kmsto a version that resolves this vulnerability.Fixed in 2.7.0 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 2.7.0 - Configuration
Explicitly pass RSAES_OAEP_SHA_256 or RSAES_OAEP_SHA_1 instead of relying on the RSAES_PKCS1_V1_5 default, and wrap the key material with the corresponding OAEP padding scheme.
ExAws.KMS.get_parameters_for_import/3 wrapping_algorithm = RSAES_OAEP_SHA_256 (or RSAES_OAEP_SHA_1)
Event History
Frequently Asked Questions
Who is exposed to this issue?
Callers that import external key material into AWS KMS using ExAws.KMS.get_parameters_for_import/3 and do not explicitly set the wrapping_algorithm are directed to use RSAES_PKCS1_V1_5. Callers that explicitly select an OAEP wrapping algorithm are not using the vulnerable default.
What would an attacker need to exploit the weakness?
Exploitation of PKCS#1 v1.5 encryption padding requires a padding oracle that reveals whether a decrypted ciphertext had valid padding. The described attack can recover wrapped plaintext without the private key when such an oracle is available.
Does the default behavior use a weaker wrapping scheme?
Yes. The default wrapping_algorithm is RSAES_PKCS1_V1_5, while AWS KMS also supports RSAES_OAEP_SHA_1 and RSAES_OAEP_SHA_256.
What can be done before a library update is available?
Explicitly pass an OAEP wrapping algorithm to ExAws.KMS.get_parameters_for_import/3 rather than relying on its default. RSAES_OAEP_SHA_1 and RSAES_OAEP_SHA_256 are supported by AWS KMS.
How can I determine whether my code is affected?
Review calls to ExAws.KMS.get_parameters_for_import/3 used for external key-material imports. Calls that omit the wrapping_algorithm argument or otherwise use RSAES_PKCS1_V1_5 should be treated as affected.