Partial Path Traversal in aws-cpp-sdk-transfer
MediumPublished Aug 9, 2022
### Overview A partial-path traversal issue exists within the DownloadToDirectory method in the aws-cpp-sdk-transfer component of the AWS SDK for C++. Applications using the SDK control the directory argument, but S3 object keys are determined by the application that uploaded the objects. The TransferManager::DownloadToDirectory method allows the caller to pass a directory string but contained an issue in the validation logic for the directory 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 directory. E.g. for directory/tmp/foo, the actor can cause a download to /tmp/foo-bar, but not /tmp/bar. Versions of the AWS CPP SDK for before and including v1.9.318 are affected by this issue. ### Impact If TransferManager::DownloadToDirectory is used to download an untrusted buckets contents, the contents of that bucket can be written outside of the intended destination directory. ### Root ...
Affected versions
| Package | Affected | Fixed in |
|---|---|---|
| aws-cpp-sdk-transfer Product | < v1.9.318 | v1.9.318 |
Details and references
### Overview A partial-path traversal issue exists within the DownloadToDirectory method in the aws-cpp-sdk-transfer component of the AWS SDK for C++. Applications using the SDK control the directory argument, but S3 object keys are determined by the application that uploaded the objects. The TransferManager::DownloadToDirectory method allows the caller to pass a directory string but contained an issue in the validation logic for the directory 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 directory. E.g. for directory/tmp/foo, the actor can cause a download to /tmp/foo-bar, but not /tmp/bar. Versions of the AWS CPP SDK for before and including v1.9.318 are affected by this issue. ### Impact If TransferManager::DownloadToDirectory is used to download an untrusted buckets contents, the contents of that bucket can be written outside of the intended destination directory. ### Root Cause There was no client side validation that the destination path of the object could escape the parent directory. We have added validation on the destination path to make sure that the object cannot be written outside of the parent directory. ### Patches Upgrade to the AWS SDK for CPP >= v1.9.318, if you are on a version < v1.9.318. ### References Similar vulnerabilities: ESAPI (The OWASP Enterprise Security API) - https://nvd.nist.gov/vuln/detail/CVE-2022-23457 For more information AWS Java SDK - https://nvd.nist.gov/vuln/detail/CVE-2022-31159 If you have any questions or comments about this advisory, please contact [AWS's Security team](mailto:aws-security@amazon.com).
- Severity from
- GitHub (reviewed advisory)
More AWS advisories
All AWS| Date | Advisory | Severity | Fixed in |
|---|---|---|---|
| Dec 102022 | Privilege Escalation Vector in CloudWatch Agent for Windows | High7.1 | 1.247355 |
| Sep 272022 | Issue with configuring session ticket names in s2n-tls | Medium | v1.3.23 |
| Sep 272022 | Server denial-of-service by using sslv2 message format in a HelloRetryRequest handshake | Low | <v1.3.23 |
| Jul 152022 | Partial Path Traversal in com.amazonaws:aws-java-sdk-s3 | High7.9 | 1.12.261 |
| May 162022 | Security vulnerability in a third party software, Slurm < 20.11.9 and 21.08.8 | Critical | 20.11.9 |
| May 52022 | Potential denial of service when sending version negotiation or close packets | Medium | v1.1.1 |