URI path traversal in AWS SDK for PHP may access unintended S3 objects

Note: This data is for reference and cybersecurity research purposes only.CyStack advises users not to use this information for unlawful purposes.

What is CVE-2023-51651?

CVE-2023-51651 is a vulnerability classified as Improper Limitation of a Pathname to a Restricted Directory, affecting aws-sdk-php (affected versions: >= 3.0.0, < 3.288.1). This vulnerability is rated Medium, with a CVSS score of 6. There is not enough data to determine whether this vulnerability has been exploited.

Overview

Original source data

AWS SDK for PHP is the Amazon Web Services software development kit for PHP. Within the scope of requests to S3 object keys and/or prefixes containing a Unix double-dot, a URI path traversal is possible. The issue exists in the buildEndpoint method in the RestSerializer component of the AWS SDK for PHP v3 prior to 3.288.1. The buildEndpoint method relies on the Guzzle Psr7 UriResolver utility, which strips dot segments from the request path in accordance with RFC 3986. Under certain conditions, this could lead to an arbitrary object being accessed. This issue has been patched in version 3.288.1.

Affected products and scope

  • Composer package aws/aws-sdk-php, AWS SDK for PHP v3: affected versions are >= 3.0.0, < 3.288.1.
  • The GitHub advisory identifies 3.288.1 as patched and lists versions at or above that boundary as patched.
  • No separate packaging branches, distributor backports, or default deployment status are identified; those cases require separate verification.

Technical details

This is a CWE-22 flaw in S3 request URI construction. The affected component is RestSerializer, specifically its buildEndpoint method. That method relies on the Guzzle Psr7 UriResolver utility, which strips dot segments from the request path in accordance with RFC 3986. When an S3 object key or prefix supplied by a user or another untrusted source contains .., path normalization can cause the request to address an object different from the one intended by the application. The ability to control the input and the permissions available to an attacker depend on the consuming application, and the public record does not define the complete authorization flow or every S3 operation that may be affected. The patch changes RestSerializer handling to disable transformation of request URI paths containing dot segments.

Exploitability

The CNA advisory characterizes exploitation as local, with low complexity, no user interaction, and high privileges required. The NVD assessment records a different privilege requirement, so the effective access assumptions should be reviewed for each application and execution context. The issue is not described as a direct network attack against S3 or against the SDK by itself. The supplied record does not establish whether a public exploit exists or whether exploitation has been observed; that status remains unknown.

Technical impact

The flaw can change which S3 object a request addresses, causing an object outside the intended target to be accessed or processed. The CNA assessment indicates possible confidentiality and integrity consequences, but the public technical description confirms arbitrary object access without defining every read, write, or delete operation. The practical scope depends on the application's S3 permissions and whether an attacker can influence the key or prefix supplied to the SDK. Because the attack characterization requires high privileges, the real risk should be assessed against each application's authorization model.

Business impact

An application may address an S3 object different from the one selected by the user or workflow. Depending on the S3 operation, this could expose data or cause processing to target the wrong object. The CNA impact characterization includes confidentiality and integrity consequences, but the advisory does not specify the exact operations, object permissions, or breach scenario involved. The record provides no basis to claim that a specific data disclosure has occurred.

Remediation

  1. Upgrade aws/aws-sdk-php to version 3.288.1, the confirmed fixed version identified by the advisory.
  2. Verify the version actually resolved by Composer in lockfiles, build artifacts, and runtime environments rather than relying only on the manifest declaration.
  3. Review workflows that accept S3 keys or prefixes from untrusted sources, and validate the final object target before sensitive operations.
  4. If upgrading is not immediately possible, the record does not document a dedicated vendor mitigation. A temporary application-layer compensating control can reject or constrain untrusted keys and prefixes containing Unix .., but this is deployment-specific protection and does not replace the vendor fix.

Detection

  1. Inventory PHP applications and Composer dependencies to identify deployments using aws/aws-sdk-php.
  2. Compare the version resolved in lockfiles, build artifacts, and runtime environments with the affected boundary in the record.
  3. Review code that constructs S3 requests, especially paths that place user, tenant, job, or other external data into object keys or prefixes.
  4. In a controlled test environment, verify after upgrading that keys or prefixes containing dot segments are sent to the intended object.
  5. As a precaution, review application logs and S3 telemetry for unexpected object access associated with keys or prefixes containing a double-dot. This is preventative monitoring, and the absence of anomalous logs does not prove that a deployment is safe.
Sources (17)
Learn more

Run an in-depth assessment with complete web risk management

CyStack VulnScan continuously discovers assets, validates vulnerabilities, and helps security teams prioritize remediation across the organization.