GHSA-7vcx-v65q-9wpg: XML-RPC for PHP's `Wrapper :buildClientWrapperCode` Method Allows Code Injection Vulnerability

MODERATE
CWE-94
Published
Advisory Summary

GHSA-7vcx-v65q-9wpg is a MODERATE :buildclientwrappercode` method allows code injection vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting XML-RPC for PHP's `Wrapper libraries in the Packagist ecosystem. The issue involves :buildclientwrappercode` method allows code injection via malicious `$client` argument. Remediation is available by upgrading affected packages to version 4.9.0.

GHSA-7vcx-v65q-9wpg at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-7vcx-v65q-9wpg
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-94: Improper Control of Generation of Code ('Code Injection')
Affected Product XML-RPC for PHP's `Wrapper
Package Ecosystem Packagist
Published Date
Last Updated

How to Fix GHSA-7vcx-v65q-9wpg

To remediate this vulnerability, upgrade all affected XML-RPC for PHP's `Wrapper dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

phpxmlrpc/phpxmlrpc fixed: 4.9.0
Upgrade phpxmlrpc/phpxmlrpc to 4.9.0
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 phpxmlrpc/phpxmlrpc

How to Check if You Are Affected

To determine whether your application is affected by GHSA-7vcx-v65q-9wpg, inspect your project dependencies for XML-RPC for PHP's `Wrapper:

inspect dependencies for phpxmlrpc/phpxmlrpc

Analyze the terminal output to locate any version of XML-RPC for PHP's `Wrapper in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.9.0), 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-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. In XML-RPC for PHP's `Wrapper, 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

In order for this weakness to be exploited, the following conditions have to apply, at the same time: - method `Wrapper::buildClientWrapperCode`, or any methods which depend on it, such as `Wrapper::wrapXmlrpcServer`, `Wrapper::wrapXmlrpcMethod` or `Wrapper::buildWrapMethodSource` must be in use. Note that they are _not_ used by default in either the Client or Server classes provided by the library; the developer has to specifically make use of them in his/her own code - the `$client` argument to either of those methods should have been built with malicious data, ie. data controlled by a 3rd party, passed to its constructor call This is most likely an uncommon usage scenario, and as such the chances of exploitation may be low. *NB* the graphical debugger which is shipped as part of the library is vulnerable to this, when used with the option "Generate stub for method call" selected. In that case, the debugger will _display_ but not _execute_ the malicious code, which would have to be provided via carefully crafted values for the "Address" and "Path" inputs. The attack scenario in this case is that a developer copies into his/her own source code the php snippet generated by the debugger, in a situation where the debugger is used with "Address"/"Path" input values supplied by a 3rd party. The malicious payload in the "Address"/"Path" input values should be easily recognized as suspicious by any barely proficient developer, as it resembles a bog-standard injection attack. It goes without saying that a responsible developer should not blindly copy and paste into his/her own code anything generated by a 3rd party tool, such as the phpxmlrpc debugger, without giving it at least a cursory scan. Originally reported as issue #80

GHSA-7vcx-v65q-9wpg Affected XML-RPC for PHP's `Wrapper Versions

1 component(s)
Fixed Versions:
4.9.0
Product / Package Ecosystem Affected Versions Fixed Version
phpxmlrpc/phpxmlrpc
Packagist
< 4.9.0
4.9.0

References

Frequently Asked Questions

What is GHSA-7vcx-v65q-9wpg?
GHSA-7vcx-v65q-9wpg is a security vulnerability in XML-RPC for PHP's `Wrapper involving :buildClientWrapperCode` method allows code injection via malicious `$client` argument under CWE-94: Improper Control of Generation of Code ('Code Injection').
Which XML-RPC for PHP's `Wrapper versions are affected?
Affected versions include releases prior to 4.9.0 across affected packages: phpxmlrpc/phpxmlrpc.
What version fixes GHSA-7vcx-v65q-9wpg?
Upgrading to 4.9.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is phpxmlrpc/phpxmlrpc affected?
Yes, phpxmlrpc/phpxmlrpc is affected in releases prior to 4.9.0. Upgrade your dependency to 4.9.0 or later.
What CWE is associated with GHSA-7vcx-v65q-9wpg?
GHSA-7vcx-v65q-9wpg is classified under CWE-94: Improper Control of Generation of Code ('Code Injection') (The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.).
How can I check Packagist dependencies for GHSA-7vcx-v65q-9wpg?
Run the dependency tree command: 'inspect dependencies for phpxmlrpc/phpxmlrpc'. 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-7vcx-v65q-9wpg",
  "modified" : "2023-01-11T23:53:34Z",
  "published" : "2023-01-11T23:53:34Z",
  "aliases" : [ ],
  "summary" : "XML-RPC for PHP's `Wrapper::buildClientWrapperCode` method allows code injection via malicious `$client` argument",
  "details" : "In order for this weakness to be exploited, the following conditions have to apply, at the same time:\n\n- method `Wrapper::buildClientWrapperCode`, or any methods which depend on it, such as `Wrapper::wrapXmlrpcServer`, `Wrapper::wrapXmlrpcMethod` or `Wrapper::buildWrapMethodSource` must be in use. Note that they are _not_ used by default in either the Client or Server classes provided by the library; the developer has to specifically make use of them in his/her own code\n- the `$client` argument to either of those methods should have been built with malicious data, ie. data controlled by a 3rd party, passed to its constructor call\n\nThis is most likely an uncommon usage scenario, and as such the chances of exploitation may be low.\n\n*NB* the graphical debugger which is shipped as part of the library is vulnerable to this, when used with the option \"Generate stub for method call\" selected. In that case, the debugger will _display_ but not _execute_ the malicious code, which would have to be provided via carefully crafted values for the \"Address\" and \"Path\" inputs.\n\nThe attack scenario in this case is that a developer copies into his/her own source code the php snippet generated by the debugger, in a situation where the debugger is used with \"Address\"/\"Path\" input values supplied by a 3rd party.\nThe malicious payload in the \"Address\"/\"Path\" input values should be easily recognized as suspicious by any barely proficient developer, as it resembles a bog-standard injection attack.\nIt goes without saying that a responsible developer should not blindly copy and paste into his/her own code anything generated by a 3rd party tool, such as the phpxmlrpc debugger, without giving it at least a cursory scan.\n\nOriginally reported as issue #80",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "phpxmlrpc/phpxmlrpc"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "4.9.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/gggeek/phpxmlrpc/security/advisories/GHSA-7vcx-v65q-9wpg"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/gggeek/phpxmlrpc/issues/80"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/gggeek/phpxmlrpc/commit/cf6e605e09d001ce520bfa8e7b168cfa514e663b"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/gggeek/phpxmlrpc"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-94" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-01-11T23:53:34Z",
    "nvd_published_at" : null
  }
}