Skip to content
AWSGHSA-g2jj-589x-jvx2

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

GitHub advisory

Affected versions

PackageAffectedFixed in
aws-cpp-sdk-transfer
Product
< v1.9.318v1.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

Critical advisories by email

Wednesdays: the week’s critical and high advisories in the AI and data stack, with the fixed versions. Only in weeks that have some.

Double opt-in. Unsubscribe any time.