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-admin/upgrade.php (3 issues)

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
 * Upgrade WordPress Page.
4
 *
5
 * @package WordPress
6
 * @subpackage Administration
7
 */
8
9
/**
10
 * We are upgrading WordPress.
11
 *
12
 * @since 1.5.1
13
 * @var bool
14
 */
15
define( 'WP_INSTALLING', true );
16
17
/** Load WordPress Bootstrap */
18
require( dirname( dirname( __FILE__ ) ) . '/wp-load.php' );
19
20
nocache_headers();
21
22
timer_start();
23
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
24
25
delete_site_transient('update_core');
26
27
if ( isset( $_GET['step'] ) )
28
	$step = $_GET['step'];
29
else
30
	$step = 0;
31
32
// Do it. No output.
33
if ( 'upgrade_db' === $step ) {
34
	wp_upgrade();
35
	die( '0' );
36
}
37
38
/**
39
 * @global string $wp_version
40
 * @global string $required_php_version
41
 * @global string $required_mysql_version
42
 * @global wpdb   $wpdb
43
 */
44
global $wp_version, $required_php_version, $required_mysql_version;
45
46
$step = (int) $step;
47
48
$php_version    = phpversion();
49
$mysql_version  = $wpdb->db_version();
50
$php_compat     = version_compare( $php_version, $required_php_version, '>=' );
51 View Code Duplication
if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) )
52
	$mysql_compat = true;
53
else
54
	$mysql_compat = version_compare( $mysql_version, $required_mysql_version, '>=' );
55
56
@header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
57
?>
58
<!DOCTYPE html>
59
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
60
<head>
61
	<meta name="viewport" content="width=device-width" />
62
	<meta http-equiv="Content-Type" content="<?php bloginfo( 'html_type' ); ?>; charset=<?php echo get_option( 'blog_charset' ); ?>" />
63
	<meta name="robots" content="noindex,nofollow" />
64
	<title><?php _e( 'WordPress &rsaquo; Update' ); ?></title>
65
	<?php
66
	wp_admin_css( 'install', true );
67
	wp_admin_css( 'ie', true );
68
	?>
69
</head>
70
<body class="wp-core-ui">
71
<p id="logo"><a href="<?php echo esc_url( __( 'https://wordpress.org/' ) ); ?>" tabindex="-1"><?php _e( 'WordPress' ); ?></a></p>
72
73
<?php if ( get_option( 'db_version' ) == $wp_db_version || !is_blog_installed() ) : ?>
74
75
<h1><?php _e( 'No Update Required' ); ?></h1>
76
<p><?php _e( 'Your WordPress database is already up-to-date!' ); ?></p>
77
<p class="step"><a class="button button-large" href="<?php echo get_option( 'home' ); ?>/"><?php _e( 'Continue' ); ?></a></p>
78
79
<?php elseif ( !$php_compat || !$mysql_compat ) :
80
	if ( !$mysql_compat && !$php_compat )
81
		printf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $wp_version, $required_php_version, $required_mysql_version, $php_version, $mysql_version );
82
	elseif ( !$php_compat )
83
		printf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher. You are running version %3$s.'), $wp_version, $required_php_version, $php_version );
84
	elseif ( !$mysql_compat )
85
		printf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires MySQL version %2$s or higher. You are running version %3$s.'), $wp_version, $required_mysql_version, $mysql_version );
86
?>
87
<?php else :
88
switch ( $step ) :
89
	case 0:
90
		$goback = wp_get_referer();
91
		if ( $goback ) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $goback of type false|string is loosely compared to true; this is ambiguous if the string can be empty. You might want to explicitly use !== false instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For string values, the empty string '' is a special case, in particular the following results might be unexpected:

''   == false // true
''   == null  // true
'ab' == false // false
'ab' == null  // false

// It is often better to use strict comparison
'' === false // false
'' === null  // false
Loading history...
92
			$goback = esc_url_raw( $goback );
93
			$goback = urlencode( $goback );
94
		}
95
?>
96
<h1><?php _e( 'Database Update Required' ); ?></h1>
97
<p><?php _e( 'WordPress has been updated! Before we send you on your way, we have to update your database to the newest version.' ); ?></p>
98
<p><?php _e( 'The database update process may take a little while, so please be patient.' ); ?></p>
99
<p class="step"><a class="button button-large button-primary" href="upgrade.php?step=1&amp;backto=<?php echo $goback; ?>"><?php _e( 'Update WordPress Database' ); ?></a></p>
100
<?php
101
		break;
102
	case 1:
103
		wp_upgrade();
104
105
			$backto = !empty($_GET['backto']) ? wp_unslash( urldecode( $_GET['backto'] ) ) : __get_option( 'home' ) . '/';
106
			$backto = esc_url( $backto );
0 ignored issues
show
It seems like $backto can also be of type array; however, esc_url() does only seem to accept string, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
107
			$backto = wp_validate_redirect($backto, __get_option( 'home' ) . '/');
108
?>
109
<h1><?php _e( 'Update Complete' ); ?></h1>
110
	<p><?php _e( 'Your WordPress database has been successfully updated!' ); ?></p>
111
	<p class="step"><a class="button button-large" href="<?php echo $backto; ?>"><?php _e( 'Continue' ); ?></a></p>
112
113
<!--
114
<pre>
115
<?php printf( __( '%s queries' ), $wpdb->num_queries ); ?>
116
117
<?php printf( __( '%s seconds' ), timer_stop( 0 ) ); ?>
118
</pre>
119
-->
120
121
<?php
122
		break;
123
endswitch;
124
endif;
125
?>
126
</body>
127
</html>
128