XML-RPC for PHP allows access to local files via malicious argument to the Client::send method
Published 11 Jan 2023 · Updated 28 Nov 2024
Is your project on an affected phpxmlrpc/phpxmlrpc?
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
composer require phpxmlrpc/phpxmlrpc:^4.9.0Details
Abusing the $method argument of Client::send, it was possible to force the client to _access local files_ or _connect to undesired urls_ instead of the intended target server's url (the one used in the Client constructor).
This weakness only affects installations where all the following conditions apply, at the same time:
- the xmlrpc Client is used, ie. not xmlrpc servers
- untrusted data (eg. data from remote users) is used as value for the
$methodargument of methodClient::send(), in conjunction with conditions which trigger usage of curl as http transport (ie. either using the https, http11 or http2 protocols, or callingClient::setUseCurl()beforehand) - either have set the Clients
return_typeproperty to 'xml', or make the resulting Response's objecthttpResponsemember, which is intended to be used for debugging purposes only, available to 3rd parties, eg. by displaying it to the end user or serializing it in some storage (note that the same data can also be accessed via magic propertyResponse::raw_data, and in the Request'shttpResponsemember)
This is most likely a very uncommon usage scenario, and as such the chances of exploitation of this issue may be low.
If it is not possible to upgrade to this release of the library at this time, a proactive security measure, to avoid the Client accessing any local file on the server which hosts it, is to add the following call to your code:
$client->setCurlOptions([CURLOPT_PROTOCOLS, CURLPROTO_HTTPS|CURLPROTO_HTTP]);
Originally reported as issue #81
Is GHSA-m95x-m25c-w9mp 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-7vcx-v65q-9wpgXML-RPC for PHP's `Wrapper::buildClientWrapperCode` method allows code injection via malicious `$client` argument · 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
References
Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.