// For flags

CVE-2022-31159

Partial Path Traversal in com.amazonaws:aws-java-sdk-s3

Severity Score

6.5
*CVSS v3.1

Exploit Likelihood

*EPSS

Affected Versions

*CPE

Public Exploits

1
*Multiple Sources

Exploited in Wild

-
*KEV

Decision

-
*SSVC
Descriptions

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 `..` .

El SDK de AWS para Java permite a desarrolladores de Java trabajar con Amazon Web Services. Se presenta un problema de salto de ruta parcial en el método "downloadDirectory" del componente AWS S3 TransferManager del AWS SDK para Java v1 versiones anteriores a 1.12.261. Las aplicaciones que usan el SDK controlan el argumento "destinationDirectory", pero las claves de los objetos de S3 están determinadas por la aplicación que cargó los objetos. El método "downloadDirectory" permite a quien lo llama pasar un objeto del sistema de archivos en la clave del objeto, pero contenía un problema en la lógica de comprobación del nombre de la clave. Un actor con conocimientos podía omitir la lógica de comprobación incluyendo un doble punto UNIX en la clave del cubo. Bajo determinadas condiciones, esto podría permitirles recuperar un directorio de su cubo de S3 que está un nivel más arriba en el sistema de archivos de su directorio de trabajo. El alcance de este problema es limitado a directorios cuyo prefijo de nombre coincide con el destinationDirectory. Por ejemplo, para el directorio de destino "/tmp/foo", el actor puede causar una descarga en "/tmp/foo-bar", pero no en "/tmp/bar". Si es usado "com.amazonaws.services.s3.transfer.TransferManager::downloadDirectory" para descargar el contenido de un cubo no confiable, el contenido de ese cubo puede escribirse fuera del directorio de destino previsto. La versión 1.12.261 contiene un parche para este problema. Como mitigación, cuando llame a "com.amazonaws.services.s3.transfer.TransferManager::downloadDirectory", pase un "KeyFilter" que prohíba los objetos "S3ObjectSummary" cuyo método "getKey" devuelva una cadena que contenga la subcadena ".."

*Credits: N/A
CVSS Scores
Attack Vector
Network
Attack Complexity
Low
Privileges Required
Low
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
None
Availability
None
Attack Vector
Network
Attack Complexity
High
Privileges Required
Low
User Interaction
Required
Scope
Changed
Confidentiality
High
Integrity
High
Availability
Low
* Common Vulnerability Scoring System
SSVC
  • Decision:-
Exploitation
-
Automatable
-
Tech. Impact
-
* Organization's Worst-case Scenario
Timeline
  • 2022-05-18 CVE Reserved
  • 2022-07-15 CVE Published
  • 2024-02-05 EPSS Updated
  • 2024-08-03 CVE Updated
  • 2024-08-03 First Exploit
  • ---------- Exploited in Wild
  • ---------- KEV Due Date
CWE
  • CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
CAPEC
Affected Vendors, Products, and Versions
Vendor Product Version Other Status
Vendor Product Version Other Status <-- --> Vendor Product Version Other Status
Amazon
Search vendor "Amazon"
Aws-sdk-java
Search vendor "Amazon" for product "Aws-sdk-java"
<= 1.12.260
Search vendor "Amazon" for product "Aws-sdk-java" and version " <= 1.12.260"
-
Affected