CVE-2023-23684: Wp graphql/wp graphql WPGraphQL Plugin Vulnerable To Server Vulnerability
MODERATECVE-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
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).
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.
Upgrade wp-graphql/wp-graphql to 1.14.6
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
CVE-2023-23684 Affected Wp graphql/wp graphql Versions
1 component(s)| 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?
Which Wp graphql/wp graphql versions are affected?
What version fixes CVE-2023-23684?
Is wp-graphql/wp-graphql affected?
What is the CVSS score of CVE-2023-23684?
What CWE is associated with CVE-2023-23684?
How can I check Packagist dependencies for CVE-2023-23684?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"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"
}
}