CVE-2022-31159
Java vulnerability analysis and mitigation

Overview

A partial-path traversal vulnerability (CVE-2022-31159) was discovered in the AWS SDK for Java v1, specifically affecting versions up to 1.12.260 of the com.amazonaws:aws-java-sdk-s3 package. The vulnerability exists within the downloadDirectory method in the AWS S3 TransferManager component, where insufficient validation of object key names could allow bypass of security controls (GitHub Advisory).

Technical details

The vulnerability stems from insufficient protection against partial-path traversal in the leavesRoot method. The issue occurs when the result of parent.getCanonicalPath() is not slash-terminated, allowing for partial path traversal. For example, '/usr/outnot'.startsWith('/usr/out') check can be bypassed even though 'outnot' is not under the 'out' directory. The vulnerability has a CVSS v3.1 score of 7.9 (High), with the vector string CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:L (GitHub Advisory).

Impact

When the TransferManager::downloadDirectory method is used to download contents from untrusted buckets, an attacker could potentially write bucket contents outside of the intended destination directory. The scope is limited to directories whose name prefix matches the destinationDirectory. For example, with a destination directory '/tmp/foo', an attacker can cause a download to '/tmp/foo-bar', but not '/tmp/bar' (GitHub Advisory).

Mitigation and workarounds

Users should upgrade to AWS SDK for Java version 1.12.261 or later to address this vulnerability. As a workaround, when calling TransferManager::downloadDirectory, implement a KeyFilter that forbids S3ObjectSummary objects whose getKey method returns a string containing the substring '..' (GitHub Advisory).

Additional resources


SourceThis report was generated using AI

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

“Best User Experience I have ever seen, provides full visibility to cloud workloads.”
David EstlickCISO
“Wiz provides a single pane of glass to see what is going on in our cloud environments.”
Adam FletcherChief Security Officer
“We know that if Wiz identifies something as critical, it actually is.”
Greg PoniatowskiHead of Threat and Vulnerability Management