CVE-2023-51651: Aws/aws sdk php Path Traversal Vulnerability

MODERATE
Advisory Identifier: GHSA-557v-xcg6-rm5m
CVSS 6.0
CWE-22
Published
Advisory Summary

CVE-2023-51651 is a MODERATE (CVSS 6.0) path traversal vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Aws/aws sdk php libraries in the Packagist ecosystem. The issue involves potential uri resolution path traversal in the aws sdk for php. Remediation is available by upgrading affected packages to version 3.288.1.

CVE-2023-51651 at a Glance

CVE Identifier CVE-2023-51651
GHSA Identifier GHSA-557v-xcg6-rm5m
Severity MODERATE
CVSS v3.1 Base Score 6.0
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product Aws/aws sdk php
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 6.0

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:N).

Attack Vector Local (AV:L)
Attack Complexity Low (AC:L)
Privileges Required High (PR:H)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2023-51651

To remediate this vulnerability, upgrade all affected Aws/aws sdk php dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

aws/aws-sdk-php fixed: 3.288.1
Upgrade aws/aws-sdk-php to 3.288.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for aws/aws-sdk-php

How to Check if You Are Affected

To determine whether your application is affected by CVE-2023-51651, inspect your project dependencies for Aws/aws sdk php:

inspect dependencies for aws/aws-sdk-php

Analyze the terminal output to locate any version of Aws/aws sdk php in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.288.1), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In Aws/aws sdk php, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact 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. Versions of the AWS SDK for PHP v3 before 3.288.1 are affected by this issue. ### Patches Upgrade to the AWS SDK for PHP >= 3.288.1, if you are on version < 3.288.1. ### References RFC 3986 - [https://datatracker.ietf.org/doc/html/rfc3986](https://datatracker.ietf.org/doc/html/rfc3986#section-5.2.4) ### For more information If you have any questions or comments about this advisory, please contact [AWS's Security team](mailto:aws-security@amazon.com).

CVE-2023-51651 Affected Aws/aws sdk php Versions

1 component(s)
Fixed Versions:
3.288.1
Product / Package Ecosystem Affected Versions Fixed Version
aws/aws-sdk-php
Packagist
< 3.288.1
3.288.1

References

Frequently Asked Questions

What is CVE-2023-51651?
CVE-2023-51651 is a security vulnerability in Aws/aws sdk php involving Potential URI resolution path traversal in the AWS SDK for PHP under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which Aws/aws sdk php versions are affected?
Affected versions include releases prior to 3.288.1 across affected packages: aws/aws-sdk-php.
What version fixes CVE-2023-51651?
Upgrading to 3.288.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is aws/aws-sdk-php affected?
Yes, aws/aws-sdk-php is affected in releases prior to 3.288.1. Upgrade your dependency to 3.288.1 or later.
What is the CVSS score of CVE-2023-51651?
CVE-2023-51651 has a CVSS v3.1 base score of 6.0 (MODERATE) with vector string CVSS:3.1/AV:L/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:N.
What CWE is associated with CVE-2023-51651?
CVE-2023-51651 is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') (The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.).
How can I check Packagist dependencies for CVE-2023-51651?
Run the dependency tree command: 'inspect dependencies for aws/aws-sdk-php'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-557v-xcg6-rm5m",
  "modified" : "2023-12-22T22:27:19Z",
  "published" : "2023-12-21T23:16:13Z",
  "aliases" : [ "CVE-2023-51651" ],
  "summary" : "Potential URI resolution path traversal in the AWS SDK for PHP",
  "details" : "### Impact\nWithin 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.\n\nVersions of the AWS SDK for PHP v3 before 3.288.1 are affected by this issue.\n\n### Patches\nUpgrade to the AWS SDK for PHP >= 3.288.1, if you are on version < 3.288.1.\n\n### References\nRFC 3986 - [https://datatracker.ietf.org/doc/html/rfc3986](https://datatracker.ietf.org/doc/html/rfc3986#section-5.2.4)\n\n### For more information\nIf you have any questions or comments about this advisory, please contact [AWS's Security team](mailto:aws-security@amazon.com).",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "aws/aws-sdk-php"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.288.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/aws/aws-sdk-php/security/advisories/GHSA-557v-xcg6-rm5m"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-51651"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/aws/aws-sdk-php/commit/aebc9f801438746ac4ade327551576cb75f635f2"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/FriendsOfPHP/security-advisories/blob/master/aws/aws-sdk-php/CVE-2023-51651.yaml"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/aws/aws-sdk-php"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/aws/aws-sdk-php/releases/tag/3.288.1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-12-21T23:16:13Z",
    "nvd_published_at" : "2023-12-22T21:15:09Z"
  }
}