CVE-2023-23684: Wp graphql/wp graphql WPGraphQL Plugin Vulnerable To Server Vulnerability

MODERATE
Advisory Identifier: GHSA-cfh4-7wq9-6pgg
CVSS 6.5
CWE-918
Published
Advisory Summary

CVE-2023-23684 is a MODERATE (CVSS 6.5) wpgraphql plugin vulnerable to server vulnerability (CWE-918: Server-Side Request Forgery (SSRF)) affecting Wp graphql/wp graphql libraries in the Packagist ecosystem. The issue involves wpgraphql plugin vulnerable to server side request forgery (ssrf). Remediation is available by upgrading affected packages to version 1.14.6.

CVE-2023-23684 at a Glance

CVE Identifier CVE-2023-23684
GHSA Identifier GHSA-cfh4-7wq9-6pgg
Severity MODERATE
CVSS v3.1 Base Score 6.5
CWE Classification CWE-918: Server-Side Request Forgery (SSRF)
Affected Product Wp graphql/wp graphql
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 6.5

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

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

How to Fix CVE-2023-23684

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

wp-graphql/wp-graphql fixed: 1.14.6
Upgrade wp-graphql/wp-graphql to 1.14.6
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 wp-graphql/wp-graphql

How to Check if You Are Affected

To determine whether your application is affected by CVE-2023-23684, inspect your project dependencies for Wp graphql/wp graphql:

inspect dependencies for wp-graphql/wp-graphql

Analyze the terminal output to locate any version of Wp graphql/wp graphql in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.14.6), 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-918: Server-Side Request Forgery (SSRF), where the web server receives a url or similar request from an upstream component and retrieves the contents of this url, but it does not sufficiently ensure that the request is being sent to the expected destination. In Wp graphql/wp graphql, 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 Users with capabilities to upload media (editors and above) are succeptible to SSRF (Server-Side Request Forgery) when executing the `createMediaItem` Mutation. Authenticated users making GraphQL requests that execute the `createMediaItem` could pass executable paths in the mutations `filePath` argument that could give them unwarranted access to the server. It's recommended to update to WPGraphQL v1.14.6 or newer. If you're unable to do so, below is a snippet you can add to your functions.php (or similar) that filters the `createMediaItem` mutation's resolver. ### Patches - [v1.14.6](https://github.com/wp-graphql/wp-graphql/releases/tag/v1.14.6) - https://github.com/wp-graphql/wp-graphql/pull/2840 ### Workarounds If you're unable to upgrade to v1.14.6 or higher, you should be able to use the following snippet in your functions.php to override the vulnerable resolver. This snippet has been tested as far back as WPGraphQL v0.15 ```php add_filter( 'graphql_pre_resolve_field', function( $nil, $source, $args, $context, \GraphQL\Type\Definition\ResolveInfo $info, $type_name, $field_key, $field, $field_resolver ) { if ( $info->fieldName !== 'createMediaItem' ) { return $nil; } $input = $args['input'] ?? null; if ( ! isset( $input['filePath'] ) ) { return $nil; } $uploaded_file_url = $input['filePath']; // Check that the filetype is allowed $check_file = wp_check_filetype( $uploaded_file_url ); // if the file doesn't pass the check, throw an error if ( ! $check_file['ext'] || ! $check_file['type'] || ! wp_http_validate_url( $uploaded_file_url ) ) { throw new \GraphQL\Error\UserError( sprintf( __( 'Invalid filePath "%s"', 'wp-graphql' ), $input['filePath'] ) ); } $protocol = wp_parse_url( $input['filePath'], PHP_URL_SCHEME ); // prevent the filePath from being submitted with a non-allowed protocols $allowed_protocols = [ 'https', 'http', 'file' ]; if ( ! in_array( $protocol, $allowed_protocols, true ) ) { throw new \GraphQL\Error\UserError( sprintf( __( 'Invalid protocol. "%1$s". Only "%2$s" allowed.', 'wp-graphql' ), $protocol, implode( '", "', $allowed_protocols ) ) ); } return $nil; }, 10, 9 ); ``` ### References - https://patchstack.com/database/vulnerability/wp-graphql/wordpress-wp-graphql-plugin-1-14-5-server-side-request-forgery-ssrf-vulnerability

CVE-2023-23684 Affected Wp graphql/wp graphql Versions

1 component(s)
Fixed Versions:
1.14.6
Product / Package Ecosystem Affected Versions Fixed Version
wp-graphql/wp-graphql
Packagist
< 1.14.6
1.14.6

References

Frequently Asked Questions

What is CVE-2023-23684?
CVE-2023-23684 is a security vulnerability in Wp graphql/wp graphql involving WPGraphQL Plugin vulnerable to Server Side Request Forgery (SSRF) under CWE-918: Server-Side Request Forgery (SSRF).
Which Wp graphql/wp graphql versions are affected?
Affected versions include releases prior to 1.14.6 across affected packages: wp-graphql/wp-graphql.
What version fixes CVE-2023-23684?
Upgrading to 1.14.6 (or the latest patched release for your respective branch) resolves the vulnerability.
Is wp-graphql/wp-graphql affected?
Yes, wp-graphql/wp-graphql is affected in releases prior to 1.14.6. Upgrade your dependency to 1.14.6 or later.
What is the CVSS score of CVE-2023-23684?
CVE-2023-23684 has a CVSS v3.1 base score of 6.5 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2023-23684?
CVE-2023-23684 is classified under CWE-918: Server-Side Request Forgery (SSRF) (The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.).
How can I check Packagist dependencies for CVE-2023-23684?
Run the dependency tree command: 'inspect dependencies for wp-graphql/wp-graphql'. 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-cfh4-7wq9-6pgg",
  "modified" : "2023-11-17T22:31:01Z",
  "published" : "2023-06-30T20:35:37Z",
  "aliases" : [ "CVE-2023-23684" ],
  "summary" : "WPGraphQL Plugin vulnerable to Server Side Request Forgery (SSRF)",
  "details" : "### Impact\nUsers with capabilities to upload media (editors and above) are succeptible to SSRF (Server-Side Request Forgery) when executing the `createMediaItem` Mutation. \n\nAuthenticated users making GraphQL requests that execute the `createMediaItem` could pass executable paths in the mutations `filePath` argument that could give them unwarranted access to the server. \n\nIt's recommended to update to WPGraphQL v1.14.6 or newer. If you're unable to do so, below is a snippet you can add to your functions.php (or similar) that filters the `createMediaItem` mutation's resolver. \n\n### Patches\n\n- [v1.14.6](https://github.com/wp-graphql/wp-graphql/releases/tag/v1.14.6)\n- https://github.com/wp-graphql/wp-graphql/pull/2840\n\n### Workarounds\nIf you're unable to upgrade to v1.14.6 or higher, you should be able to use the following snippet in your functions.php to override the vulnerable resolver. \n\nThis snippet has been tested as far back as WPGraphQL v0.15\n\n```php\nadd_filter( 'graphql_pre_resolve_field', function( $nil, $source, $args, $context, \\GraphQL\\Type\\Definition\\ResolveInfo $info, $type_name, $field_key, $field, $field_resolver ) {\n\n\tif ( $info->fieldName !== 'createMediaItem' ) {\n\t\treturn $nil;\n\t}\n\n\t$input = $args['input'] ?? null;\n\n        if ( ! isset( $input['filePath'] ) ) {\n\t\treturn $nil;\n\t}\n\n\t$uploaded_file_url   = $input['filePath'];\n\n\t// Check that the filetype is allowed\n\t$check_file = wp_check_filetype( $uploaded_file_url );\n\n\t// if the file doesn't pass the check, throw an error\n\tif ( ! $check_file['ext'] || ! $check_file['type'] || ! wp_http_validate_url( $uploaded_file_url ) ) {\n\t\tthrow new \\GraphQL\\Error\\UserError( sprintf( __( 'Invalid filePath \"%s\"', 'wp-graphql' ), $input['filePath'] ) );\n\t}\n\n\t$protocol = wp_parse_url( $input['filePath'], PHP_URL_SCHEME );\n\n\t// prevent the filePath from being submitted with a non-allowed protocols\n\t$allowed_protocols = [ 'https', 'http', 'file' ];\n\n\tif ( ! in_array( $protocol, $allowed_protocols, true ) ) {\n\t\tthrow new \\GraphQL\\Error\\UserError( sprintf( __( 'Invalid protocol. \"%1$s\". Only \"%2$s\" allowed.', 'wp-graphql' ), $protocol, implode( '\", \"', $allowed_protocols ) ) );\n\t}\n\n\treturn $nil;\n\n}, 10, 9 );\n```\n\n### References\n\n- https://patchstack.com/database/vulnerability/wp-graphql/wordpress-wp-graphql-plugin-1-14-5-server-side-request-forgery-ssrf-vulnerability\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "wp-graphql/wp-graphql"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.14.6"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 1.14.5"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/wp-graphql/wp-graphql/security/advisories/GHSA-cfh4-7wq9-6pgg"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-23684"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/wp-graphql/wp-graphql/pull/2840"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/wp-graphql/wp-graphql"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/wp-graphql/wp-graphql/releases/tag/v1.14.6"
  }, {
    "type" : "WEB",
    "url" : "https://patchstack.com/database/vulnerability/wp-graphql/wordpress-wp-graphql-plugin-1-14-5-server-side-request-forgery-ssrf-vulnerability?_s_id=cve"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-918" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-06-30T20:35:37Z",
    "nvd_published_at" : "2023-11-13T03:15:07Z"
  }
}