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/media-upload.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
 * Manage media uploaded file.
4
 *
5
 * There are many filters in here for media. Plugins can extend functionality
6
 * by hooking into the filters.
7
 *
8
 * @package WordPress
9
 * @subpackage Administration
10
 */
11
12
if ( ! isset( $_GET['inline'] ) )
13
	define( 'IFRAME_REQUEST' , true );
14
15
/** Load WordPress Administration Bootstrap */
16
require_once( dirname( __FILE__ ) . '/admin.php' );
17
18
if ( ! current_user_can( 'upload_files' ) ) {
19
	wp_die( __( 'Sorry, you are not allowed to upload files.' ), 403 );
20
}
21
22
wp_enqueue_script('plupload-handlers');
23
wp_enqueue_script('image-edit');
24
wp_enqueue_script('set-post-thumbnail' );
25
wp_enqueue_style('imgareaselect');
26
wp_enqueue_script( 'media-gallery' );
27
28
@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...
29
30
// IDs should be integers
31
$ID = isset($ID) ? (int) $ID : 0;
32
$post_id = isset($post_id)? (int) $post_id : 0;
33
34
// Require an ID for the edit screen.
35
if ( isset( $action ) && $action == 'edit' && !$ID ) {
36
	wp_die(
37
		'<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
38
		'<p>' . __( 'Invalid item ID.' ) . '</p>',
39
		403
40
	);
41
}
42
43 View Code Duplication
if ( ! empty( $_REQUEST['post_id'] ) && ! current_user_can( 'edit_post' , $_REQUEST['post_id'] ) ) {
44
	wp_die(
45
		'<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
46
		'<p>' . __( 'Sorry, you are not allowed to edit this item.' ) . '</p>',
47
		403
48
	);
49
}
50
51
// Upload type: image, video, file, ..?
52
if ( isset($_GET['type']) ) {
53
	$type = strval($_GET['type']);
54
} else {
55
	/**
56
	 * Filters the default media upload type in the legacy (pre-3.5.0) media popup.
57
	 *
58
	 * @since 2.5.0
59
	 *
60
	 * @param string $type The default media upload type. Possible values include
61
	 *                     'image', 'audio', 'video', 'file', etc. Default 'file'.
62
	 */
63
	$type = apply_filters( 'media_upload_default_type', 'file' );
64
}
65
66
// Tab: gallery, library, or type-specific.
67
if ( isset($_GET['tab']) ) {
68
	$tab = strval($_GET['tab']);
69
} else {
70
	/**
71
	 * Filters the default tab in the legacy (pre-3.5.0) media popup.
72
	 *
73
	 * @since 2.5.0
74
	 *
75
	 * @param string $type The default media popup tab. Default 'type' (From Computer).
76
	 */
77
	$tab = apply_filters( 'media_upload_default_tab', 'type' );
78
}
79
80
$body_id = 'media-upload';
81
82
// Let the action code decide how to handle the request.
83
if ( $tab == 'type' || $tab == 'type_url' || ! array_key_exists( $tab , media_upload_tabs() ) ) {
84
	/**
85
	 * Fires inside specific upload-type views in the legacy (pre-3.5.0)
86
	 * media popup based on the current tab.
87
	 *
88
	 * The dynamic portion of the hook name, `$type`, refers to the specific
89
	 * media upload type. Possible values include 'image', 'audio', 'video',
90
	 * 'file', etc.
91
	 *
92
	 * The hook only fires if the current `$tab` is 'type' (From Computer),
93
	 * 'type_url' (From URL), or, if the tab does not exist (i.e., has not
94
	 * been registered via the {@see 'media_upload_tabs'} filter.
95
	 *
96
	 * @since 2.5.0
97
	 */
98
	do_action( "media_upload_{$type}" );
99
} else {
100
	/**
101
	 * Fires inside limited and specific upload-tab views in the legacy
102
	 * (pre-3.5.0) media popup.
103
	 *
104
	 * The dynamic portion of the hook name, `$tab`, refers to the specific
105
	 * media upload tab. Possible values include 'library' (Media Library),
106
	 * or any custom tab registered via the {@see 'media_upload_tabs'} filter.
107
	 *
108
	 * @since 2.5.0
109
	 */
110
	do_action( "media_upload_{$tab}" );
111
}
112
113