MediumGHSA-7vcx-v65q-9wpg

XML-RPC for PHP's `Wrapper::buildClientWrapperCode` method allows code injection via malicious `$client` argument

Published 11 Jan 2023 · Updated 28 Nov 2024

Is your project on an affected phpxmlrpc/phpxmlrpc?

Private repo? Upload its lockfile instead, or connect GitHub to check every repo.

Look after several Laravel or PHP apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie

Affected package

Affected
<4.9.0
Fixed in
4.9.0
Update to the fixed version for your release line, for example:composer require phpxmlrpc/phpxmlrpc:^4.9.0

Details

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

Is GHSA-7vcx-v65q-9wpg in any of your client repos?

Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected phpxmlrpc/phpxmlrpc, and gives you the command that fixes it.

More advisories for phpxmlrpc/phpxmlrpc

  • MediumGHSA-m95x-m25c-w9mpXML-RPC for PHP allows access to local files via malicious argument to the Client::send method · 11 Jan 2023
  • MediumGHSA-pxqj-xrv5-qvjfXML-RPC for PHP's debugger vulnerable to possible XSS attack · 11 Jan 2023
  • MediumGHSA-q7qq-9gx2-ggxvphpxmlrpc vulnerable to argument injection · 2 Dec 2022
  • HighGHSA-3fgr-xjr6-xqm8code injection in phpxmlrpc/phpxmlrpc · 28 Nov 2022
phpxmlrpc/phpxmlrpc security overview

References

Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.