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/plugin-install.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
 * Install plugin administration panel.
4
 *
5
 * @package WordPress
6
 * @subpackage Administration
7
 */
8
// TODO route this pages via a specific iframe handler instead of the do_action below
9 View Code Duplication
if ( !defined( 'IFRAME_REQUEST' ) && isset( $_GET['tab'] ) && ( 'plugin-information' == $_GET['tab'] ) )
10
	define( 'IFRAME_REQUEST', true );
11
12
/**
13
 * WordPress Administration Bootstrap.
14
 */
15
require_once( dirname( __FILE__ ) . '/admin.php' );
16
17
if ( ! current_user_can('install_plugins') )
18
	wp_die(__('Sorry, you are not allowed to install plugins on this site.'));
19
20
if ( is_multisite() && ! is_network_admin() ) {
21
	wp_redirect( network_admin_url( 'plugin-install.php' ) );
22
	exit();
23
}
24
25
$wp_list_table = _get_list_table('WP_Plugin_Install_List_Table');
26
$pagenum = $wp_list_table->get_pagenum();
27
28
if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) {
29
	$location = remove_query_arg( '_wp_http_referer', wp_unslash( $_SERVER['REQUEST_URI'] ) );
0 ignored issues
show
It seems like wp_unslash($_SERVER['REQUEST_URI']) targeting wp_unslash() can also be of type array; however, remove_query_arg() does only seem to accept boolean|string, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
30
31
	if ( ! empty( $_REQUEST['paged'] ) ) {
32
		$location = add_query_arg( 'paged', (int) $_REQUEST['paged'], $location );
33
	}
34
35
	wp_redirect( $location );
36
	exit;
37
}
38
39
$wp_list_table->prepare_items();
40
41
$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
42
43
if ( $pagenum > $total_pages && $total_pages > 0 ) {
44
	wp_redirect( add_query_arg( 'paged', $total_pages ) );
45
	exit;
46
}
47
48
$title = __( 'Add Plugins' );
49
$parent_file = 'plugins.php';
50
51
wp_enqueue_script( 'plugin-install' );
52
if ( 'plugin-information' != $tab )
53
	add_thickbox();
54
55
$body_id = $tab;
56
57
wp_enqueue_script( 'updates' );
58
59
/**
60
 * Fires before each tab on the Install Plugins screen is loaded.
61
 *
62
 * The dynamic portion of the action hook, `$tab`, allows for targeting
63
 * individual tabs, for instance 'install_plugins_pre_plugin-information'.
64
 *
65
 * @since 2.7.0
66
 */
67
do_action( "install_plugins_pre_{$tab}" );
68
69
/*
70
 * Call the pre upload action on every non-upload plugin install screen
71
 * because the form is always displayed on these screens.
72
 */
73
if ( 'upload' !== $tab ) {
74
	/** This action is documented in wp-admin/plugin-install.php */
75
	do_action( 'install_plugins_pre_upload' );
76
}
77
78
get_current_screen()->add_help_tab( array(
79
'id'		=> 'overview',
80
'title'		=> __('Overview'),
81
'content'	=>
82
	'<p>' . sprintf( __('Plugins hook into WordPress to extend its functionality with custom features. Plugins are developed independently from the core WordPress application by thousands of developers all over the world. All plugins in the official <a href="%s">WordPress Plugin Directory</a> are compatible with the license WordPress uses.' ), __( 'https://wordpress.org/plugins/' ) ) . '</p>' .
83
	'<p>' . __( 'You can find new plugins to install by searching or browsing the directory right here in your own Plugins section.' ) . ' <span id="live-search-desc" class="hide-if-no-js">' . __( 'The search results will be updated as you type.' ) . '</span></p>'
84
85
) );
86
get_current_screen()->add_help_tab( array(
87
'id'		=> 'adding-plugins',
88
'title'		=> __('Adding Plugins'),
89
'content'	=>
90
	'<p>' . __('If you know what you&#8217;re looking for, Search is your best bet. The Search screen has options to search the WordPress Plugin Directory for a particular Term, Author, or Tag. You can also search the directory by selecting popular tags. Tags in larger type mean more plugins have been labeled with that tag.') . '</p>' .
91
	'<p>' . __( 'If you just want to get an idea of what&#8217;s available, you can browse Featured and Popular plugins by using the links above the plugins list. These sections rotate regularly.' ) . '</p>' .
92
	'<p>' . __( 'You can also browse a user&#8217;s favorite plugins, by using the Favorites link above the plugins list and entering their WordPress.org username.' ) . '</p>' .
93
	'<p>' . __( 'If you want to install a plugin that you&#8217;ve downloaded elsewhere, click the Upload Plugin button above the plugins list. You will be prompted to upload the .zip package, and once uploaded, you can activate the new plugin.' ) . '</p>'
94
) );
95
96
get_current_screen()->set_help_sidebar(
97
	'<p><strong>' . __('For more information:') . '</strong></p>' .
98
	'<p>' . __('<a href="https://codex.wordpress.org/Plugins_Add_New_Screen">Documentation on Installing Plugins</a>') . '</p>' .
99
	'<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>'
100
);
101
102
get_current_screen()->set_screen_reader_content( array(
103
	'heading_views'      => __( 'Filter plugins list' ),
104
	'heading_pagination' => __( 'Plugins list navigation' ),
105
	'heading_list'       => __( 'Plugins list' ),
106
) );
107
108
/**
109
 * WordPress Administration Template Header.
110
 */
111
include(ABSPATH . 'wp-admin/admin-header.php');
112
?>
113
<div class="wrap <?php echo esc_attr( "plugin-install-tab-$tab" ); ?>">
114
<h1 class="wp-heading-inline"><?php
115
echo esc_html( $title );
116
?></h1>
117
118
<?php
119
if ( ! empty( $tabs['upload'] ) && current_user_can( 'upload_plugins' ) ) {
120
	printf( ' <a href="%s" class="upload-view-toggle page-title-action"><span class="upload">%s</span><span class="browse">%s</span></a>',
121
		( 'upload' === $tab ) ? self_admin_url( 'plugin-install.php' ) : self_admin_url( 'plugin-install.php?tab=upload' ),
122
		__( 'Upload Plugin' ),
123
		__( 'Browse Plugins' )
124
	);
125
}
126
?>
127
128
<hr class="wp-header-end">
129
130
<?php
131
/*
132
 * Output the upload plugin form on every non-upload plugin install screen, so it can be
133
 * displayed via JavaScript rather then opening up the devoted upload plugin page.
134
 */
135
if ( 'upload' !== $tab ) {
136
	?>
137
	<div class="upload-plugin-wrap">
138
		<?php
139
		/** This action is documented in wp-admin/plugin-install.php */
140
		do_action( 'install_plugins_upload' );
141
		?>
142
	</div>
143
	<?php
144
	$wp_list_table->views();
145
	echo '<br class="clear" />';
146
}
147
148
/**
149
 * Fires after the plugins list table in each tab of the Install Plugins screen.
150
 *
151
 * The dynamic portion of the action hook, `$tab`, allows for targeting
152
 * individual tabs, for instance 'install_plugins_plugin-information'.
153
 *
154
 * @since 2.7.0
155
 *
156
 * @param int $paged The current page number of the plugins list table.
157
 */
158
do_action( "install_plugins_{$tab}", $paged ); ?>
159
160
	<span class="spinner"></span>
161
</div>
162
163
<?php
164
wp_print_request_filesystem_credentials_modal();
165
wp_print_admin_notice_templates();
166
167
/**
168
 * WordPress Administration Template Footer.
169
 */
170
include(ABSPATH . 'wp-admin/admin-footer.php');
171