Appsecure logo

CVE-2022-31159: High Vulnerability in Amazon AWS SDK for Java

A high-severity partial-path traversal vulnerability exists in the AWS SDK for Java, affecting versions prior to 1.12.261. Organizations should prioritize patching to mitigate risks associated with unauthorized data access.

HIGHPublic ExploitCVSS 7.9 · Published July 15, 2022

Not a customer? See how AppSecure simulates real world attacks to protect your infrastructure.

Speak to Experts

The AWS SDK for Java enables Java developers to work with Amazon Web Services. A partial-path traversal issue exists within the `downloadDirectory` method in the AWS S3 TransferManager component of the AWS SDK for Java v1 prior to version 1.12.261. Applications using the SDK control the `destinationDirectory` argument, but S3 object keys are determined by the application that uploaded the objects.

The `downloadDirectory` method allows the caller to pass a filesystem object in the object key but contained an issue in the validation logic for the key name. A knowledgeable actor could bypass the validation logic by including a UNIX double-dot in the bucket key. Under certain conditions, this could permit them to retrieve a directory from their S3 bucket that is one level up in the filesystem from their working directory.

This issue’s scope is limited to directories whose name prefix matches the destinationDirectory. For example, for destination directory `/tmp/foo`, the actor can cause a download to `/tmp/foo-bar`, but not `/tmp/bar`. If `com.amazonaws.services.s3.transfer.TransferManager::downloadDirectory` is used to download an untrusted bucket's contents, the contents of that bucket can be written outside of the intended destination directory.

Version 1.12.261 contains a patch for this issue. As a workaround, when calling `com.amazonaws.services.s3.transfer.TransferManager::downloadDirectory`, pass a `KeyFilter` that forbids `S3ObjectSummary` objects where the `getKey` method returns a string containing the substring `..`.

Organizations should prioritize patching immediately.

Vulnerability Details

The vulnerability identified as CVE-2022-31159 has been classified as high severity with a CVSS score of 7.9. It affects the AWS SDK for Java, specifically versions prior to 1.12.261. The vulnerability is characterized by a partial-path traversal issue, allowing unauthorized access to files outside of the intended directory.

The official CVE description notes that the `downloadDirectory` method can be manipulated to bypass validation checks when the object key includes a UNIX double-dot, leading to potential exposure of sensitive data.

The CWE classification for this vulnerability is CWE-22, which relates to improper restriction of operations within the bounds of a memory buffer.

Technical Analysis

The root cause of this vulnerability lies in the validation logic of the `downloadDirectory` method. The method's design allows users to define a `destinationDirectory`, but it fails to adequately validate the `key` parameter used to access S3 objects.

The attack vector is network-based, and the attack complexity is considered high due to the requirement of user interaction. A low privilege level is required to exploit this vulnerability, and the impact on confidentiality and integrity is significant.

To exploit this vulnerability, an attacker needs to craft a specific key that includes a double-dot, which allows them to access files one level up in the filesystem hierarchy. The potential impacts include unauthorized access to sensitive information, particularly if untrusted buckets are involved.

Risk & Impact Analysis

Risk to organizations includes exposure of sensitive data stored in S3 buckets, potentially leading to data breaches and compliance violations. Given that this vulnerability has a CVSS score of 7.9, it falls within a high severity level requiring immediate attention.

Organizations leveraging AWS SDK for Java must evaluate their exposure and the likelihood of exploitation. The blast radius for this vulnerability can be significant, especially in environments where S3 buckets are used to store critical information.

Given the exploitability score indicates a high likelihood of successful exploitation, organizations should address this vulnerability in their priority patch cycle.

Signal

Status

Known Exploit

Yes

Public PoC

Yes

Actively Exploited

No

Ransomware Use

No

Affected Versions

The affected versions are all versions of the AWS SDK for Java prior to 1.12.261. Organizations should upgrade to this version or later to mitigate the risk associated with this vulnerability.

Mitigation & Remediation

Organizations should implement the following measures to mitigate the risks associated with CVE-2022-31159:

1. Upgrade to AWS SDK for Java version 1.12.261 or later.

2. If upgrading is not immediately possible, use a `KeyFilter` that forbids `S3ObjectSummary` objects with keys containing the substring `..` during calls to `downloadDirectory`.

3. Monitor logs for unusual access patterns to S3 buckets, which may indicate attempts to exploit this vulnerability.

4. Regularly review and audit access controls and permissions for S3 buckets to ensure they align with least privilege principles.

For further guidance, organizations can refer to our penetration testing services to validate security measures.

Detection Guidance

To detect potential exploitation of CVE-2022-31159, organizations should monitor the following indicators:

1. Log entries for S3 bucket access, especially those involving the `downloadDirectory` method.

2. Unusual patterns or spikes in data retrieval requests from specific S3 buckets.

3. Any attempts to access files that should not be available based on current directory structure and permissions.

AppSecure Threat Intelligence Insight

The long-term significance of this vulnerability highlights the critical need for robust input validation mechanisms in cloud storage services. The partial-path traversal nature of CVE-2022-31159 serves as a reminder that even established services can harbor vulnerabilities that may allow unauthorized data access.

Security teams should take this as an opportunity to review their security posture regarding cloud storage and implement practices that minimize the risk of similar vulnerabilities arising in the future.

This incident also represents a trend where vulnerabilities arise from improper handling of user inputs, particularly in methods that interact with file systems. Organizations must enhance their testing strategies to include scenarios that simulate potential exploitation paths.

For more insights, organizations can explore our vulnerability management program to build resilience against future threats.

Additionally, organizations are encouraged to review our penetration testing methodology to enhance their security frameworks.

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Latest CVEs. Recently published vulnerabilities from the NVD database.

View all vulnerabilities
CVE IDSeverity
CVE-2025-65418HIGH
CVE-2025-65417MEDIUM
CVE-2025-65416MEDIUM
CVE-2025-65415MEDIUM
CVE-2025-61314HIGH

Protect Your Business with Hacker-Focused Approach.