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. E.g. 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 buckets 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 that `getKey` method return a string containing the substring `..` .
:information_source: This issue was automatically re-opened by Mend because the vulnerable library in the specific branch(es) has been detected in the Mend inventory.
CVE-2022-31159 - High Severity Vulnerability
Vulnerable Libraries - aws-java-sdk-s3-1.11.636.jar, aws-java-sdk-s3-1.11.490.jar, aws-java-sdk-s3-1.11.264.jar
aws-java-sdk-s3-1.11.636.jar
The AWS Java SDK for Amazon S3 module holds the client classes that are used for communicating with Amazon Simple Storage Service
Library home page: https://aws.amazon.com/sdkforjava
Path to dependency file: /commons/pac-batch-commons/pom.xml
Path to vulnerable library: /home/wss-scanner/.m2/repository/com/amazonaws/aws-java-sdk-s3/1.11.636/aws-java-sdk-s3-1.11.636.jar
Dependency Hierarchy: - :x: **aws-java-sdk-s3-1.11.636.jar** (Vulnerable Library)
aws-java-sdk-s3-1.11.490.jar
The AWS Java SDK for Amazon S3 module holds the client classes that are used for communicating with Amazon Simple Storage Service
Library home page: https://aws.amazon.com/sdkforjava
Path to dependency file: /jobs/pacman-data-shipper/pom.xml
Path to vulnerable library: /jobs/pacman-data-shipper/pom.xml,/jobs/recommendation-enricher/pom.xml
Dependency Hierarchy: - :x: **aws-java-sdk-s3-1.11.490.jar** (Vulnerable Library)
aws-java-sdk-s3-1.11.264.jar
The AWS Java SDK for Amazon S3 module holds the client classes that are used for communicating with Amazon Simple Storage Service
Library home page: https://aws.amazon.com/sdkforjava
Path to dependency file: /api/pacman-api-admin/pom.xml
Path to vulnerable library: /home/wss-scanner/.m2/repository/com/amazonaws/aws-java-sdk-s3/1.11.264/aws-java-sdk-s3-1.11.264.jar
Dependency Hierarchy: - :x: **aws-java-sdk-s3-1.11.264.jar** (Vulnerable Library)
Found in HEAD commit: acf9a0620c1a37cee4f2896d71e1c3731c5c7b06
Found in base branch: master
Vulnerability Details
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. E.g. 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 buckets 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 that `getKey` method return a string containing the substring `..` .
Publish Date: 2022-07-15
URL: CVE-2022-31159
CVSS 3 Score Details (7.9)
Base Score Metrics: - Exploitability Metrics: - Attack Vector: Network - Attack Complexity: High - Privileges Required: Low - User Interaction: Required - Scope: Changed - Impact Metrics: - Confidentiality Impact: High - Integrity Impact: High - Availability Impact: Low
For more information on CVSS3 Scores, click here.Suggested Fix
Type: Upgrade version
Origin: https://github.com/aws/aws-sdk-java/security/advisories/GHSA-c28r-hw5m-5gv3
Release Date: 2022-07-15
Fix Resolution: 1.12.261
:rescue_worker_helmet: Automatic Remediation will be attempted for this issue.