Skip to content

Partial Path Traversal in aws-cpp-sdk-transfer

Moderate
sbiscigl published GHSA-g2jj-589x-jvx2 Aug 9, 2022

Package

aws-cpp-sdk-transfer (Github)

Affected versions

< v1.9.318

Patched versions

v1.9.318

Description

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.

Severity

Moderate

CVE ID

No known CVE

Weaknesses

No CWEs