Issues (4967)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

src/wp-includes/class-wp-http-ixr-client.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * WP_HTTP_IXR_Client
4
 *
5
 * @package WordPress
6
 * @since 3.1.0
7
 *
8
 */
9
class WP_HTTP_IXR_Client extends IXR_Client {
10
	public $scheme;
11
	/**
12
	 * @var IXR_Error
13
	 */
14
	public $error;
15
16
	/**
17
	 * @param string $server
18
	 * @param string|bool $path
19
	 * @param int|bool $port
20
	 * @param int $timeout
21
	 */
22
	public function __construct($server, $path = false, $port = false, $timeout = 15) {
23
		if ( ! $path ) {
24
			// Assume we have been given a URL instead
25
			$bits = parse_url($server);
26
			$this->scheme = $bits['scheme'];
27
			$this->server = $bits['host'];
28
			$this->port = isset($bits['port']) ? $bits['port'] : $port;
29
			$this->path = !empty($bits['path']) ? $bits['path'] : '/';
30
31
			// Make absolutely sure we have a path
32
			if ( ! $this->path ) {
33
				$this->path = '/';
34
			}
35
36
			if ( ! empty( $bits['query'] ) ) {
37
				$this->path .= '?' . $bits['query'];
38
			}
39
		} else {
40
			$this->scheme = 'http';
41
			$this->server = $server;
42
			$this->path = $path;
43
			$this->port = $port;
44
		}
45
		$this->useragent = 'The Incutio XML-RPC PHP Library';
46
		$this->timeout = $timeout;
47
	}
48
49
	/**
50
	 * @return bool
51
	 */
52
	public function query() {
53
		$args = func_get_args();
54
		$method = array_shift($args);
55
		$request = new IXR_Request($method, $args);
56
		$xml = $request->getXml();
57
58
		$port = $this->port ? ":$this->port" : '';
59
		$url = $this->scheme . '://' . $this->server . $port . $this->path;
60
		$args = array(
61
			'headers'    => array('Content-Type' => 'text/xml'),
62
			'user-agent' => $this->useragent,
63
			'body'       => $xml,
64
		);
65
66
		// Merge Custom headers ala #8145
67
		foreach ( $this->headers as $header => $value ) {
68
			$args['headers'][$header] = $value;
69
		}
70
71
		/**
72
		 * Filters the headers collection to be sent to the XML-RPC server.
73
		 *
74
		 * @since 4.4.0
75
		 *
76
		 * @param array $headers Array of headers to be sent.
77
		 */
78
		$args['headers'] = apply_filters( 'wp_http_ixr_client_headers', $args['headers'] );
79
80
		if ( $this->timeout !== false ) {
81
			$args['timeout'] = $this->timeout;
82
		}
83
84
		// Now send the request
85
		if ( $this->debug ) {
86
			echo '<pre class="ixr_request">' . htmlspecialchars($xml) . "\n</pre>\n\n";
87
		}
88
89
		$response = wp_remote_post($url, $args);
90
91
		if ( is_wp_error($response) ) {
92
			$errno    = $response->get_error_code();
93
			$errorstr = $response->get_error_message();
94
			$this->error = new IXR_Error(-32300, "transport error: $errno $errorstr");
95
			return false;
96
		}
97
98
		if ( 200 != wp_remote_retrieve_response_code( $response ) ) {
99
			$this->error = new IXR_Error(-32301, 'transport error - HTTP status code was not 200 (' . wp_remote_retrieve_response_code( $response ) . ')');
100
			return false;
101
		}
102
103
		if ( $this->debug ) {
104
			echo '<pre class="ixr_response">' . htmlspecialchars( wp_remote_retrieve_body( $response ) ) . "\n</pre>\n\n";
105
		}
106
107
		// Now parse what we've got back
108
		$this->message = new IXR_Message( wp_remote_retrieve_body( $response ) );
0 ignored issues
show
Documentation Bug introduced by
It seems like new \IXR_Message(wp_remo...trieve_body($response)) of type object<IXR_Message> is incompatible with the declared type boolean of property $message.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
109 View Code Duplication
		if ( ! $this->message->parse() ) {
110
			// XML error
111
			$this->error = new IXR_Error(-32700, 'parse error. not well formed');
112
			return false;
113
		}
114
115
		// Is the message a fault?
116 View Code Duplication
		if ( $this->message->messageType == 'fault' ) {
117
			$this->error = new IXR_Error($this->message->faultCode, $this->message->faultString);
118
			return false;
119
		}
120
121
		// Message must be OK
122
		return true;
123
	}
124
}
125